ROSE  0.11.96.11
sageInterface.h
1 #ifndef ROSE_SAGE_INTERFACE
2 #define ROSE_SAGE_INTERFACE
3 
4 #include "sage3basic.hhh"
5 #include <stdint.h>
6 #include <utility>
7 
8 #include "rosePublicConfig.h" // for ROSE_BUILD_JAVA_LANGUAGE_SUPPORT
9 
10 #if 0 // FMZ(07/07/2010): the argument "nextErrorCode" should be call-by-reference
11 SgFile* determineFileType ( std::vector<std::string> argv, int nextErrorCode, SgProject* project );
12 #else
13 SgFile* determineFileType ( std::vector<std::string> argv, int& nextErrorCode, SgProject* project );
14 #endif
15 
16 #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
17 #include "rewrite.h"
18 #endif
19 
20 // DQ (7/20/2008): Added support for unparsing abitrary strings in the unparser.
21 #include "astUnparseAttribute.h"
22 #include <set>
23 
24 #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
25 #include "LivenessAnalysis.h"
26 #include "abstract_handle.h"
27 #include "ClassHierarchyGraph.h"
28 #endif
29 
30 #include "ompSupport.h"
31 // DQ (8/19/2004): Moved from ROSE/src/midend/astRewriteMechanism/rewrite.h
33 ROSE_DLL_API std::string getVariantName (VariantT v);
34 
35 // DQ (12/9/2004): Qing, Rich and Dan have decided to start this namespace within ROSE
36 // This namespace is specific to interface functions that operate on the Sage III AST.
37 // The name was chosen so as not to conflict with other classes within ROSE.
38 // This will become the future home of many interface functions which operate on
39 // the AST and which are generally useful to users. As a namespace multiple files can be used
40 // to represent the compete interface and different developers may contribute interface
41 // functions easily.
42 
43 // Constructor handling: (We have sageBuilder.h now for this purpose, Liao 2/1/2008)
44 // We could add simpler layers of support for construction of IR nodes by
45 // hiding many details in "makeSg***()" functions. Such functions would
46 // return pointers to the associated Sg*** objects and would be able to hide
47 // many IR specific details, including:
48 // memory handling
49 // optional parameter settings not often required
50 // use of Sg_File_Info objects (and setting them as transformations)
51 //
52 // namespace AST_Interface (this name is taken already by some of Qing's work :-)
53 
55 #define TRANS_FILE Sg_File_Info::generateDefaultFileInfoForTransformationNode()
56 
57 
63 namespace SageInterface
64  {
65  // Liao 6/22/2016: keep records of loop init-stmt normalization, later help undo it to support autoPar.
67  {
68  // a lookup table to check if a for loop has been normalized for its c99-style init-stmt
69  std::map <SgForStatement* , bool > forLoopInitNormalizationTable;
70  // Detailed record about the original declaration (1st in the pair) and the normalization generated new declaration (2nd in the pair)
71  std::map <SgForStatement* , std::pair<SgVariableDeclaration*, SgVariableDeclaration*> > forLoopInitNormalizationRecord;
72  } ;
73 
74  ROSE_DLL_API extern Transformation_Record trans_records;
75 
76  // DQ (4/3/2014): Added general AST support separate from the AST.
77 
78  // Container and API for analysis information that is outside of the AST and as a result
79  // prevents frequent modification of the IR.
81  {
82  // DQ (4/3/2014): This stores all associated declarations as a map of sets.
83  // the key to the map is the first nondefining declaration and the elements of the set are
84  // all of the associated declarations (including the defining declaration).
85 
86  private:
88  std::map<SgDeclarationStatement*,std::set<SgDeclarationStatement*>* > declarationMap;
89 
90  public:
91  void addDeclaration(SgDeclarationStatement* decl);
92  const std::set<SgDeclarationStatement*>* getDeclarations(SgDeclarationStatement* decl);
93 
94  std::map<SgDeclarationStatement*,std::set<SgDeclarationStatement*>* > & getDeclarationMap();
95 
96  bool isLocatedInDefiningScope(SgDeclarationStatement* decl);
97 
98  };
99 
100  // DQ (4/3/2014): This constructs a data structure that holds analysis information about
101  // the AST that is separate from the AST. This is intended to be a general mechanism
102  // to support analysis information without constantly modifying the IR.
103  DeclarationSets* buildDeclarationSets(SgNode*);
104 
106 ROSE_DLL_API extern int gensym_counter;
107 
109  void addMessageStatement( SgStatement* stmt, std::string message );
110 
113  {
114  private:
115  std::string name;
116  public:
117  UniqueNameAttribute(std::string n="") {name =n; };
118  void set_name (std::string n) {name = n;};
119  std::string get_name () {return name;};
120  };
121 
122  //------------------------------------------------------------------------
124 
128 // DQ (8/5/2020): the "using namespace" directive will not hide existing visability of symbols in resolving visability.
129 // So we need to test if a symbol is visible exclusing matching alises due to using direectives before we can decide to
130 // persue name space qualification. This is best demonstrated by Cxx_tests/test2020_18.C, test2020_19.C, test2020_20.C,
131 // and test2020_21.C.
132  ROSE_DLL_API SgSymbol *lookupSymbolInParentScopesIgnoringAliasSymbols (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateParameterPtrList* templateParameterList = NULL, SgTemplateArgumentPtrList* templateArgumentList = NULL);
133 
134 // DQ (8/21/2013): Modified to make newest function parameters be default arguments.
135 // DQ (8/16/2013): For now we want to remove the use of default parameters and add the support for template parameters and template arguments.
137 // SgSymbol *lookupSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope=NULL);
138 // SgSymbol *lookupSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentList);
139  ROSE_DLL_API SgSymbol *lookupSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateParameterPtrList* templateParameterList = NULL, SgTemplateArgumentPtrList* templateArgumentList = NULL);
140 
141  // Liao 1/22/2008, used for get symbols for generating variable reference nodes
142  // ! Find a variable symbol in current and ancestor scopes for a given name
143  ROSE_DLL_API SgVariableSymbol *lookupVariableSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope=NULL);
144 
145  // DQ (11/24/2007): Functions moved from the Fortran support so that they could be called from within astPostProcessing.
147  ROSE_DLL_API SgFunctionSymbol *lookupFunctionSymbolInParentScopes (const SgName & functionName, SgScopeStatement *currentScope=NULL);
148 
149  // Liao, 1/24/2008, find exact match for a function
151  ROSE_DLL_API SgFunctionSymbol *lookupFunctionSymbolInParentScopes (const SgName & functionName,
152  const SgType* t,
153  SgScopeStatement *currentScope=NULL);
154 
155  ROSE_DLL_API SgFunctionSymbol *lookupTemplateFunctionSymbolInParentScopes (const SgName & functionName, SgFunctionType * ftype, SgTemplateParameterPtrList * tplparams, SgScopeStatement *currentScope=NULL);
156  ROSE_DLL_API SgFunctionSymbol *lookupTemplateMemberFunctionSymbolInParentScopes (const SgName & functionName, SgFunctionType * ftype, SgTemplateParameterPtrList * tplparams, SgScopeStatement *currentScope=NULL);
157 
158  ROSE_DLL_API SgTemplateVariableSymbol * lookupTemplateVariableSymbolInParentScopes (const SgName & name, SgTemplateParameterPtrList * tplparams, SgTemplateArgumentPtrList* tplargs, SgScopeStatement *currentScope=NULL);
159 
160 
161 // DQ (8/21/2013): Modified to make newest function parameters be default arguments.
162 // DQ (8/16/2013): For now we want to remove the use of default parameters and add the support for template parameters and template arguments.
163 // DQ (5/7/2011): Added support for SgClassSymbol (used in name qualification support).
164 // SgClassSymbol* lookupClassSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL);
165  ROSE_DLL_API SgClassSymbol* lookupClassSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateArgumentPtrList* templateArgumentList = NULL);
166  ROSE_DLL_API SgTypedefSymbol* lookupTypedefSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL);
167 
168  ROSE_DLL_API SgNonrealSymbol* lookupNonrealSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateParameterPtrList* templateParameterList = NULL, SgTemplateArgumentPtrList* templateArgumentList = NULL);
169 #if 0
170  // DQ (8/13/2013): This function does not make since any more, now that we have made the symbol
171  // table handling more precise and we have to provide template parameters for any template lookup.
172  // We also have to know if we want to lookup template classes, template functions, or template
173  // member functions (since each have specific requirements).
174  SgTemplateSymbol* lookupTemplateSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL);
175 #endif
176 #if 0
177 // DQ (8/13/2013): I am not sure if we want this functions in place of lookupTemplateSymbolInParentScopes.
178 // Where these are called we might not know enough information about the template parameters or function
179 // types, for example.
180  SgTemplateClassSymbol* lookupTemplateClassSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateParameterPtrList* templateParameterList = NULL, SgTemplateArgumentPtrList* templateArgumentList = NULL);
181  SgTemplateFunctionSymbol* lookupTemplateFunctionSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateParameterPtrList* templateParameterList = NULL);
182  SgTemplateMemberFunctionSymbol* lookupTemplateMemberFunctionSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL, SgTemplateParameterPtrList* templateParameterList = NULL);
183 #endif
184 
185 // DQ (8/21/2013): Modified to make some of the newest function parameters be default arguments.
186 // DQ (8/13/2013): I am not sure if we want this functions in place of lookupTemplateSymbolInParentScopes.
187  ROSE_DLL_API SgTemplateClassSymbol* lookupTemplateClassSymbolInParentScopes (const SgName & name, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentList, SgScopeStatement *cscope = NULL);
188 
189  ROSE_DLL_API SgEnumSymbol* lookupEnumSymbolInParentScopes (const SgName & name, SgScopeStatement *currentScope = NULL);
190  ROSE_DLL_API SgNamespaceSymbol* lookupNamespaceSymbolInParentScopes(const SgName & name, SgScopeStatement *currentScope = NULL);
191 
192 // DQ (7/17/2011): Added function from cxx branch that I need here for the Java support.
193 // SgClassSymbol* lookupClassSymbolInParentScopes (const SgName & name, SgScopeStatement *cscope);
194 
203  // DQ (12/9/2004): Moved this function (by Alin Jula) from being a member of SgInitializedName
204  // to this location where it can be a part of the interface for the Sage III AST.
205  ROSE_DLL_API int set_name (SgInitializedName * initializedNameNode, SgName new_name);
206 
210 
211  // DQ (6/27/2005):
216  ROSE_DLL_API void outputLocalSymbolTables (SgNode * node);
217 
219  {
220  public:
221  void visit (SgNode * node);
222  };
228  // DQ (9/28/2005):
229  void rebuildSymbolTable (SgScopeStatement * scope);
230 
233  void clearUnusedVariableSymbols (SgNode* root = NULL);
234 
235  // DQ (3/1/2009):
237  void fixupReferencesToSymbols( const SgScopeStatement* this_scope, SgScopeStatement* copy_scope, SgCopyHelp & help );
238 
240 
241  //------------------------------------------------------------------------
243 
250  // DQ (9/21/2005): General function for extracting the name of declarations (when they have names)
251  std::string get_name (const SgNode * node);
252 
257  // DQ (6/13/2005): General function for extracting the name of declarations (when they have names)
258  std::string get_name (const SgStatement * stmt);
259 
264  std::string get_name (const SgExpression * expr);
265 
270  // DQ (6/13/2005): General function for extracting the name of declarations (when they have names)
271  std::string get_name (const SgDeclarationStatement * declaration);
272 
277  // DQ (6/13/2005): General function for extracting the name of declarations (when they have names)
278  std::string get_name (const SgScopeStatement * scope);
279 
284  // DQ (2/11/2007): Added this function to make debugging support more complete (useful for symbol table debugging support).
285  std::string get_name (const SgSymbol * symbol);
286 
291  std::string get_name (const SgType * type);
292 
293 
296  std::string get_name (const SgSupport * node);
297 
298 
301  std::string get_name (const SgLocatedNodeSupport * node);
302 
305  std::string get_name ( const SgC_PreprocessorDirectiveStatement* directive );
306 
309  std::string get_name ( const SgToken* token );
310 
313  // PP (11/22/2021): General function for extracting the type of declarations (when they declare types)
314  SgType* getDeclaredType(const SgDeclarationStatement* declaration);
315 
316 
317  // DQ (3/20/2016): Added to refactor some of the DSL infrastructure support.
327 
330  extern std::map<std::string,int> local_name_collision_map;
331  extern std::map<std::string,SgNode*> local_name_to_node_map;
332  extern std::map<SgNode*,std::string> local_node_to_name_map;
333 
337 
341 
343 
344  //------------------------------------------------------------------------
346 
351  // DQ (6/21/2005): Get the default destructor from the class declaration
352  ROSE_DLL_API SgMemberFunctionDeclaration *getDefaultDestructor (SgClassDeclaration* classDeclaration);
353 
356  // DQ (6/22/2005): Get the default constructor from the class declaration
357  ROSE_DLL_API SgMemberFunctionDeclaration *getDefaultConstructor (SgClassDeclaration* classDeclaration);
360  // DQ (8/27/2005):
361  ROSE_DLL_API bool templateDefinitionIsInClass (SgTemplateInstantiationMemberFunctionDecl* memberFunctionDeclaration);
362 
367  // DQ (9/17/2005):
369 
371  ROSE_DLL_API bool isStructDeclaration(SgNode * node);
373  ROSE_DLL_API bool isUnionDeclaration(SgNode * node);
374 
375 #if 0
376  // DQ (8/28/2005): This is already a member function of the SgFunctionDeclaration
377  // (so that it can handle template functions and member functions)
378 
382  // DQ (8/27/2005):
383  bool isTemplateMemberFunction (SgTemplateInstantiationMemberFunctionDecl* memberFunctionDeclaration);
384 #endif
385 
386  // DQ (11/9/2020): Added function to support adding a default constructor definition to a class
387  // if it does not have a default constructor, but has any other constructor that would prevend
388  // a compiler generated default constructor from being generated by the compiler.
389  // Note the physical_file_id is so that it can be marked to be unparsed when header file unparsing is active.
390  ROSE_DLL_API bool addDefaultConstructorIfRequired ( SgClassType* classType, int physical_file_id = Sg_File_Info::TRANSFORMATION_FILE_ID );
391 
393 
394  //------------------------------------------------------------------------
396 
402 
404  void saveToPDF(SgNode* node, std::string filename);
405  void saveToPDF(SgNode* node); // enable calling from gdb
406 
408  void printAST (SgNode* node);
409 
411  void printAST2TextFile (SgNode* node, const char* filename, bool printType=true);
412 
414  void printAST2TextFile (SgNode* node, std::string filename, bool printType=true);
415 
416  // DQ (2/12/2012): Added some diagnostic support.
418  void whereAmI(SgNode* node);
419 
421  std::string extractPragmaKeyword(const SgPragmaDeclaration *);
422 
424  ROSE_DLL_API bool isOmpStatement(SgNode* );
427  // DQ (8/27/2005):
428  bool isOverloaded (SgFunctionDeclaration * functionDeclaration);
429 
430 // DQ (2/14/2012): Added support function used for variable declarations in conditionals.
432  void initializeIfStmt(SgIfStmt *ifstmt, SgStatement* conditional, SgStatement * true_body, SgStatement * false_body);
433 
435  void initializeSwitchStatement(SgSwitchStatement* switchStatement,SgStatement *item_selector,SgStatement *body);
436 
438  void initializeWhileStatement(SgWhileStmt* whileStatement, SgStatement * condition, SgStatement *body, SgStatement *else_body);
439 
442 
444  ROSE_DLL_API bool isMain (const SgNode* node);
445  // DQ (6/22/2005):
456  std::string generateUniqueName ( const SgNode * node, bool ignoreDifferenceBetweenDefiningAndNondefiningDeclarations);
457 
460  std::string generateUniqueVariableName(SgScopeStatement* scope, std::string baseName = "temp");
461 
462  // DQ (8/10/2010): Added const to first parameter.
463  // DQ (3/10/2007):
465  std::string declarationPositionString (const SgDeclarationStatement * declaration);
466 
467  // DQ (1/20/2007):
469  ROSE_DLL_API std::string generateProjectName (const SgProject * project, bool supressSuffix = false );
470 
474 
477 
479  void addVarRefExpFromArrayDimInfo(SgNode * astNode, Rose_STL_Container<SgNode *>& NodeList_t);
480 
481  // DQ (10/6/2006): Added support for faster mangled name generation (caching avoids recomputation).
485 #ifndef SWIG
486 // DQ (3/10/2013): This appears to be a problem for the SWIG interface (undefined reference at link-time).
487  void clearMangledNameCache (SgGlobal * globalScope);
488  void resetMangledNameCache (SgGlobal * globalScope);
489 #endif
490 
491  std::string getMangledNameFromCache (SgNode * astNode);
492  std::string addMangledNameToCache (SgNode * astNode, const std::string & mangledName);
493 
495 
499 
500  // DQ (10/14/2006): This function tests the AST to see if for a non-defining declaration, the
501  // bool declarationPreceedsDefinition ( SgClassDeclaration* classNonDefiningDeclaration, SgClassDeclaration* classDefiningDeclaration );
503  bool declarationPreceedsDefinition (SgDeclarationStatement *nonDefiningDeclaration, SgDeclarationStatement *definingDeclaration);
504 
505  // DQ (10/19/2006): Function calls have interesting context dependent rules to determine if
506  // they are output with a global qualifier or not. Were this is true we have to avoid global
507  // qualifiers, since the function's scope has not been defined. This is an example of where
508  // qualification of function names in function calls are context dependent; an interesting
509  // example of where the C++ language is not friendly to source-to-source processing :-).
511 
516  ROSE_DLL_API std::vector < SgNode * >astIntersection (SgNode * original, SgNode * copy, SgCopyHelp * help = NULL);
517 
519  ROSE_DLL_API SgNode* deepCopyNode (const SgNode* subtree);
520 
522  template <typename NodeType>
523  NodeType* deepCopy (const NodeType* subtree) {
524  return dynamic_cast<NodeType*>(deepCopyNode(subtree));
525  }
526 
528  ROSE_DLL_API SgExpression* copyExpression(SgExpression* e);
529 
531  ROSE_DLL_API SgStatement* copyStatement(SgStatement* s);
532 
533 // from VarSym.cc in src/midend/astOutlining/src/ASTtools
536 
539 
541 ROSE_DLL_API void myRemoveStatement(SgStatement* stmt);
542 
544 ROSE_DLL_API bool isConstantTrue(SgExpression* e);
545 
547 ROSE_DLL_API bool isConstantFalse(SgExpression* e);
548 
550 ROSE_DLL_API bool isCallToParticularFunction(const std::string& qualifiedName, size_t arity, SgExpression* e);
551 
553 bool ROSE_DLL_API isStatic(SgDeclarationStatement* stmt);
554 
556 ROSE_DLL_API void setStatic(SgDeclarationStatement* stmt);
557 
559 ROSE_DLL_API bool isExtern(SgDeclarationStatement* stmt);
560 
562 ROSE_DLL_API void setExtern(SgDeclarationStatement* stmt);
563 
565 bool ROSE_DLL_API isMutable(SgInitializedName* name);
566 
568 std::vector<SgInitializedName*> getInParameters(const SgInitializedNamePtrList &params);
569 
571 std::vector<SgInitializedName*> getOutParameters(const SgInitializedNamePtrList &params);
572 
576  public:
577  virtual ~StatementGenerator() {};
578  virtual SgStatement* generate(SgExpression* where_to_write_answer) = 0;
579 };
580 
584  bool isAssignmentStatement(SgNode* _s, SgExpression** lhs=NULL, SgExpression** rhs=NULL, bool* readlhs=NULL);
585 
587 ROSE_DLL_API SgInitializedName* convertRefToInitializedName(SgNode* current, bool coarseGrain=true);
588 
591 
593 ROSE_DLL_API SgNode* getSgNodeFromAbstractHandleString(const std::string& input_string);
594 
596 ROSE_DLL_API void dumpInfo(SgNode* node, std::string desc="");
597 
599 ROSE_DLL_API std::vector<SgDeclarationStatement*>
600 sortSgNodeListBasedOnAppearanceOrderInSource(const std::vector<SgDeclarationStatement*>& nodevec);
601 
602 // DQ (4/13/2013): We need these to support the unparing of operators defined by operator syntax or member function names.
604 // bool isPrefixOperator( const SgMemberFunctionRefExp* memberFunctionRefExp );
605 bool isPrefixOperator( SgExpression* exp );
606 
608 bool isPrefixOperatorName( const SgName & functionName );
609 
611 bool isPostfixOperator( SgExpression* exp );
612 
614 bool isIndexOperator( SgExpression* exp );
615 
616 // DQ (1/10/2014): Adding more general support for token based unparsing.
618 SgStatement* lastStatementOfScopeWithTokenInfo (SgScopeStatement* scope, std::map<SgNode*,TokenStreamSequenceToNodeMapping*> & tokenStreamSequenceMap);
619 
620 // DQ (8/12/2020): Check the access permissions of all defining and nodefining declarations.
622 
623 // DQ (8/14/2020): Check the symbol tables for specific scopes (debugging support).
624 void checkSymbolTables ( SgNode* );
625 
626 // DQ (11/9/2020): Added support for makring IR nodes and subtrees of the AST to be unparsed (physical_file_id
627 // is required when unparsing header files is true or support multiple files and shared IR nodes).
628 void markSubtreeToBeUnparsed(SgNode* root, int physical_file_id);
629 void markNodeToBeUnparsed(SgNode* node, int physical_file_id);
630 
631 
633 
634 //------------------------------------------------------------------------
636 
640 // DQ (11/25/2020): Add support to set this as a specific language kind file (there is at least one language kind file processed by ROSE).
641 // The value of 0 allows the old implementation to be tested, and the value of 1 allows the new optimized implementation to be tested.
642 // However to get all of the functions to be inlined, we have to recompile all of ROSE.
643 #define INLINE_OPTIMIZED_IS_LANGUAGE_KIND_FUNCTIONS 1
644 
645 // std::string version(); // utility_functions.h, version number
648 #if INLINE_OPTIMIZED_IS_LANGUAGE_KIND_FUNCTIONS
649  ROSE_DLL_API inline bool is_C_language () { return Rose::is_C_language; }
650  ROSE_DLL_API inline bool is_OpenMP_language () { return Rose::is_OpenMP_language; }
651  ROSE_DLL_API inline bool is_UPC_language () { return Rose::is_UPC_language; }
652  ROSE_DLL_API inline bool is_UPC_dynamic_threads() { return Rose::is_UPC_dynamic_threads; }
653  ROSE_DLL_API inline bool is_C99_language () { return Rose::is_C99_language; }
654  ROSE_DLL_API inline bool is_Cxx_language () { return Rose::is_Cxx_language; }
655  ROSE_DLL_API inline bool is_Fortran_language () { return Rose::is_Fortran_language; }
656  ROSE_DLL_API inline bool is_CAF_language () { return Rose::is_CAF_language; }
657  ROSE_DLL_API inline bool is_Cuda_language() { return Rose::is_Cuda_language; }
658  ROSE_DLL_API inline bool is_OpenCL_language() { return Rose::is_OpenCL_language; }
659 #else
660  ROSE_DLL_API bool is_C_language ();
661  ROSE_DLL_API bool is_OpenMP_language ();
662  ROSE_DLL_API bool is_UPC_language ();
664  ROSE_DLL_API bool is_UPC_dynamic_threads();
665  ROSE_DLL_API bool is_C99_language ();
666  ROSE_DLL_API bool is_Cxx_language ();
667  ROSE_DLL_API bool is_Fortran_language ();
668  ROSE_DLL_API bool is_CAF_language ();
669  ROSE_DLL_API bool is_Cuda_language();
670  ROSE_DLL_API bool is_OpenCL_language();
671 #endif
672 
673  ROSE_DLL_API bool is_mixed_C_and_Cxx_language ();
674  ROSE_DLL_API bool is_mixed_Fortran_and_C_language ();
675  ROSE_DLL_API bool is_mixed_Fortran_and_Cxx_language ();
676  ROSE_DLL_API bool is_mixed_Fortran_and_C_and_Cxx_language ();
677 
678  ROSE_DLL_API bool is_language_case_insensitive ();
680 
682 
683 //------------------------------------------------------------------------
685 
689  // DQ (10/5/2006): Added support for faster (non-quadratic) computation of unique
690  // labels for scopes in a function (as required for name mangling).
696  void resetScopeNumbers (SgFunctionDefinition * functionDeclaration);
697 
698  // DQ (10/5/2006): Added support for faster (non-quadratic) computation of unique
699  // labels for scopes in a function (as required for name mangling).
708  void clearScopeNumbers (SgFunctionDefinition * functionDefinition);
709 
710 
713 // SgNamespaceDefinitionStatement * getEnclosingNamespaceScope (SgNode * node);
714 
715  bool isPrototypeInScope (SgScopeStatement * scope,
716  SgFunctionDeclaration * functionDeclaration,
717  SgDeclarationStatement * startingAtDeclaration);
718 
720  bool ROSE_DLL_API isAncestor(SgNode* node1, SgNode* node2);
722 //------------------------------------------------------------------------
724 
728  void dumpPreprocInfo (SgLocatedNode* locatedNode);
730 
732 ROSE_DLL_API PreprocessingInfo * findHeader(SgSourceFile * source_file, const std::string & header_file_name, bool isSystemHeader);
733 
735 ROSE_DLL_API PreprocessingInfo * insertHeader(SgSourceFile * source_file, const std::string & header_file_name, bool isSystemHeader, bool asLastHeader);
736 
738 ROSE_DLL_API void insertHeader (SgStatement* stmt, PreprocessingInfo* newheader, bool asLastHeader);
739 
741 ROSE_DLL_API PreprocessingInfo * insertHeader(SgSourceFile * source_file, const std::string & header_file_name, bool isSystemHeader = false, PreprocessingInfo::RelativePositionType position = PreprocessingInfo::before);
742 
744 ROSE_DLL_API PreprocessingInfo* insertHeader(const std::string& filename, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::after, bool isSystemHeader=false, SgScopeStatement* scope=NULL);
745 
747 ROSE_DLL_API void moveUpPreprocessingInfo (SgStatement* stmt_dst, SgStatement* stmt_src, PreprocessingInfo::RelativePositionType src_position=PreprocessingInfo::undef, PreprocessingInfo::RelativePositionType dst_position=PreprocessingInfo::undef, bool usePrepend= false);
748 
750 ROSE_DLL_API void movePreprocessingInfo (SgStatement* stmt_src, SgStatement* stmt_dst, PreprocessingInfo::RelativePositionType src_position=PreprocessingInfo::undef,
751  PreprocessingInfo::RelativePositionType dst_position=PreprocessingInfo::undef, bool usePrepend= false);
752 
753 
755 ROSE_DLL_API void cutPreprocessingInfo (SgLocatedNode* src_node, PreprocessingInfo::RelativePositionType pos, AttachedPreprocessingInfoType& save_buf);
756 
758 ROSE_DLL_API void pastePreprocessingInfo (SgLocatedNode* dst_node, PreprocessingInfo::RelativePositionType pos, AttachedPreprocessingInfoType& saved_buf);
759 
762  const std::string & text,
763  PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before);
764 
768 
771  SgSourceFile * source_file,
772  const std::string & content,
773  PreprocessingInfo::DirectiveType directive_type = PreprocessingInfo::C_StyleComment,
774  PreprocessingInfo::RelativePositionType position = PreprocessingInfo::before
775 );
776 
778  ROSE_DLL_API PreprocessingInfo* attachComment(SgLocatedNode* target, const std::string & content,
779  PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before,
780  PreprocessingInfo::DirectiveType dtype= PreprocessingInfo::CpreprocessorUnknownDeclaration);
781 
782 // DQ (7/20/2008): I am not clear were I should put this function, candidates include: SgLocatedNode or SgInterface
784  ROSE_DLL_API void addTextForUnparser ( SgNode* astNode, std::string s, AstUnparseAttribute::RelativePositionType inputlocation );
785 
790 void guardNode(SgLocatedNode * target, std::string guard);
791 
793 
794 
795 //------------------------------------------------------------------------
797 
801 // ************************************************************************
802 // Newer versions of now depricated functions
803 // ************************************************************************
804 
805 // DQ (5/1/2012): This function queries the SageBuilder::SourcePositionClassification mode (stored in the SageBuilder
806 // interface) and used the specified mode to initialize the source position data (Sg_File_Info objects). This
807 // function is the only function that should be called directly (though in a namespace we can't define permissions).
809  ROSE_DLL_API void setSourcePosition(SgNode* node);
810 
811 // A better name might be "setSourcePositionForSubTree"
813  ROSE_DLL_API void setSourcePositionAtRootAndAllChildren(SgNode *root);
814 
817 
818 // DQ (5/1/2012): Newly renamed function (previous name preserved for backward compatability).
820 
821 // ************************************************************************
822 
823 
824 
825 // ************************************************************************
826 // Older deprecated functions
827 // ************************************************************************
828  // Liao, 1/8/2007, set file info. for a whole subtree as transformation generated
830  ROSE_DLL_API void setOneSourcePositionForTransformation(SgNode *node);
831 
833  ROSE_DLL_API void setOneSourcePositionNull(SgNode *node);
834 
836  ROSE_DLL_API void setSourcePositionForTransformation (SgNode * root);
837 
839 // ROSE_DLL_API void setSourcePositionForTransformation_memoryPool();
840 
842  ROSE_DLL_API bool insideSystemHeader (SgLocatedNode* node);
843 
844 // DQ (2/27/2021): Adding support to detect if a SgLocatedNode is located in a header file.
846  ROSE_DLL_API bool insideHeader (SgLocatedNode* node);
847 
849 // ROSE_DLL_API void setSourcePosition (SgLocatedNode * locatedNode);
850 // ************************************************************************
851 
853 
854 
855 //------------------------------------------------------------------------
857 
861 // from src/midend/astInlining/typeTraits.h
862 // src/midend/astUtil/astInterface/AstInterface.h
863 
866 
867 
871 ROSE_DLL_API bool isStrictIntegerType(SgType* t);
873 ROSE_DLL_API SgType* getFirstVarType(SgVariableDeclaration* decl);
874 
876 ROSE_DLL_API bool isDefaultConstructible(SgType* type);
877 
879 ROSE_DLL_API bool isCopyConstructible(SgType* type);
880 
882 ROSE_DLL_API bool isAssignable(SgType* type);
883 
884 #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
885 ROSE_DLL_API bool isPureVirtualClass(SgType* type, const ClassHierarchyWrapper& classHierarchy);
889 #endif
890 
892 ROSE_DLL_API bool hasTrivialDestructor(SgType* t);
893 
895 ROSE_DLL_API bool isNonconstReference(SgType* t);
896 
898 ROSE_DLL_API bool isReferenceType(SgType* t);
899 
901 ROSE_DLL_API bool isPointerType(SgType* t);
902 
908 ROSE_DLL_API bool isPointerToNonConstType(SgType* type);
909 
911 /* const char* p = "aa"; is not treated as having a const type. It is a pointer to const char.
912  * Similarly, neither for const int b[10]; or const int & c =10;
913  * The standard says, "A compound type is not cv-qualified by the cv-qualifiers (if any) of
914 the types from which it is compounded. Any cv-qualifiers applied to an array type affect the array element type, not the array type".
915  */
916 ROSE_DLL_API bool isConstType(SgType* t);
917 
920 
922 ROSE_DLL_API bool isVolatileType(SgType* t);
923 
925 ROSE_DLL_API bool isRestrictType(SgType* t);
926 
928 
930 ROSE_DLL_API bool isScalarType(SgType* t);
931 
935 ROSE_DLL_API bool isStrictIntegerType(SgType* t);
936 
938 ROSE_DLL_API bool isStructType(SgType* t);
939 
941 ROSE_DLL_API std::string mangleType(SgType* type);
942 
944 ROSE_DLL_API std::string mangleScalarType(SgType* type);
945 
947 ROSE_DLL_API std::string mangleModifierType(SgModifierType* type);
948 
950 ROSE_DLL_API size_t getArrayElementCount(SgArrayType* t);
951 
953 ROSE_DLL_API int getDimensionCount(SgType* t);
954 
956 ROSE_DLL_API SgType* getArrayElementType(SgType* t);
957 
959 ROSE_DLL_API SgType* getElementType(SgType* t);
960 
961 
978 std::vector<SgExpression*>
979 get_C_array_dimensions(const SgArrayType& arrtype);
980 
1001 std::vector<SgExpression*>
1002 get_C_array_dimensions(const SgArrayType& arrtype, const SgVarRefExp& varref);
1003 
1007 std::vector<SgExpression*>
1008 get_C_array_dimensions(const SgArrayType& arrtype, SgInitializedName& initname);
1009 
1010 
1012 ROSE_DLL_API bool isArrayReference(SgExpression* ref, SgExpression** arrayNameExp=NULL, std::vector<SgExpression*>** subscripts=NULL);
1013 
1014 
1016 ROSE_DLL_API int collectVariableReferencesInArrayTypes (SgLocatedNode* root, Rose_STL_Container<SgNode*> & currentVarRefList);
1018 
1027 ROSE_DLL_API bool hasUpcSharedType(SgType* t, SgModifierType ** mod_type_out = NULL );
1028 
1030 
1033 ROSE_DLL_API bool isUpcSharedType(SgType* t, SgModifierType ** mod_type_out = NULL);
1034 
1036 ROSE_DLL_API bool isUpcSharedModifierType (SgModifierType* mod_type);
1037 
1039 ROSE_DLL_API bool isUpcSharedArrayType (SgArrayType* array_type);
1040 
1042 ROSE_DLL_API bool isUpcStrictSharedModifierType(SgModifierType* mode_type);
1043 
1045 ROSE_DLL_API size_t getUpcSharedBlockSize(SgModifierType* mod_type);
1046 
1048 ROSE_DLL_API size_t getUpcSharedBlockSize(SgType* t);
1049 
1051 ROSE_DLL_API bool isUpcPhaseLessSharedType (SgType* t);
1052 
1054 ROSE_DLL_API bool isUpcPrivateToSharedType(SgType* t);
1055 
1057 ROSE_DLL_API bool isUpcArrayWithThreads(SgArrayType* t);
1058 
1060 ROSE_DLL_API SgType* lookupNamedTypeInParentScopes(const std::string& type_name, SgScopeStatement* scope=NULL);
1061 
1062 // DQ (7/22/2014): Added support for comparing expression types in actual arguments with those expected from the formal function parameter types.
1064 ROSE_DLL_API SgType* getAssociatedTypeFromFunctionTypeList(SgExpression* actual_argument_expression);
1065 
1067 ROSE_DLL_API bool templateArgumentEquivalence(SgTemplateArgument * arg1, SgTemplateArgument * arg2);
1068 
1070 ROSE_DLL_API bool templateArgumentListEquivalence(const SgTemplateArgumentPtrList & list1, const SgTemplateArgumentPtrList & list2);
1071 
1073 ROSE_DLL_API bool isEquivalentType (const SgType* lhs, const SgType* rhs);
1074 
1076 ROSE_DLL_API SgFunctionType* findFunctionType (SgType* return_type, SgFunctionParameterTypeList* typeList);
1077 
1080 ROSE_DLL_API bool isEquivalentFunctionType (const SgFunctionType* lhs, const SgFunctionType* rhs);
1081 
1083 
1084 //------------------------------------------------------------------------
1086 
1090 // by Jeremiah
1099 ROSE_DLL_API void addStepToLoopBody(SgScopeStatement* loopStmt, SgStatement* step);
1100 
1102 ROSE_DLL_API void convertForToWhile(SgForStatement* f);
1103 ROSE_DLL_API void convertAllForsToWhiles(SgNode* top);
1105 ROSE_DLL_API void changeContinuesToGotos(SgStatement* stmt, SgLabelStatement* label);
1106 
1108 ROSE_DLL_API SgInitializedName* getLoopIndexVariable(SgNode* loop);
1109 
1112 ROSE_DLL_API bool isLoopIndexVariable(SgInitializedName* ivar, SgNode* subtree_root);
1113 
1115 
1119 ROSE_DLL_API bool hasMultipleInitStatmentsOrExpressions (SgForStatement* for_loop);
1120 
1122 ROSE_DLL_API SgStatement* getLoopBody(SgScopeStatement* loop);
1123 
1124 ROSE_DLL_API void setLoopBody(SgScopeStatement* loop, SgStatement* body);
1125 
1127 ROSE_DLL_API SgStatement* getLoopCondition(SgScopeStatement* loop);
1128 
1130 ROSE_DLL_API void setLoopCondition(SgScopeStatement* loop, SgStatement* cond);
1131 
1135 ROSE_DLL_API bool isCanonicalForLoop(SgNode* loop, SgInitializedName** ivar=NULL, SgExpression** lb=NULL, SgExpression** ub=NULL, SgExpression** step=NULL, SgStatement** body=NULL, bool *hasIncrementalIterationSpace = NULL, bool* isInclusiveUpperBound = NULL);
1136 
1138 ROSE_DLL_API bool isCanonicalDoLoop(SgFortranDo* loop,SgInitializedName** ivar/*=NULL*/, SgExpression** lb/*=NULL*/, SgExpression** ub/*=NULL*/, SgExpression** step/*=NULL*/, SgStatement** body/*=NULL*/, bool *hasIncrementalIterationSpace/*= NULL*/, bool* isInclusiveUpperBound/*=NULL*/);
1139 
1141 ROSE_DLL_API void setLoopLowerBound(SgNode* loop, SgExpression* lb);
1142 
1144 ROSE_DLL_API void setLoopUpperBound(SgNode* loop, SgExpression* ub);
1145 
1147 ROSE_DLL_API void setLoopStride(SgNode* loop, SgExpression* stride);
1148 
1149 
1151 ROSE_DLL_API bool normalizeForLoopInitDeclaration(SgForStatement* loop);
1152 
1154 ROSE_DLL_API bool unnormalizeForLoopInitDeclaration(SgForStatement* loop);
1155 
1167 ROSE_DLL_API bool forLoopNormalization(SgForStatement* loop, bool foldConstant = true);
1168 
1172 ROSE_DLL_API bool normalizeForLoopTest(SgForStatement* loop);
1173 ROSE_DLL_API bool normalizeForLoopIncrement(SgForStatement* loop);
1174 
1176 ROSE_DLL_API bool doLoopNormalization(SgFortranDo* loop);
1177 
1179 ROSE_DLL_API bool loopUnrolling(SgForStatement* loop, size_t unrolling_factor);
1180 
1182 ROSE_DLL_API bool loopInterchange(SgForStatement* loop, size_t depth, size_t lexicoOrder);
1183 
1185 ROSE_DLL_API bool loopTiling(SgForStatement* loopNest, size_t targetLevel, size_t tileSize);
1186 
1187 //Winnie Loop Collapsing
1188 SgExprListExp * loopCollapsing(SgForStatement* target_loop, size_t collapsing_factor);
1189 
1191  SgForStatement * for_loop,
1192  SgVariableSymbol * & iterator,
1193  SgExpression * & lower_bound,
1194  SgExpression * & upper_bound,
1195  SgExpression * & stride
1196 );
1197 
1199 
1200 //------------------------------------------------------------------------
1202 
1206 template <typename NodeType>
1208 std::vector<NodeType*> querySubTree(SgNode* top, VariantT variant = (VariantT)NodeType::static_variant)
1209  {
1210 #if 0
1211  printf ("Top of SageInterface::querySubTree() \n");
1212 #endif
1213 
1214  Rose_STL_Container<SgNode*> nodes = NodeQuery::querySubTree(top,variant);
1215  std::vector<NodeType*> result(nodes.size(), NULL);
1216  int count = 0;
1217 #if 0
1218  printf ("In SageInterface::querySubTree(): before initialization loop \n");
1219 #endif
1220 
1221  for (Rose_STL_Container<SgNode*>::const_iterator i = nodes.begin(); i != nodes.end(); ++i, ++count)
1222  {
1223 #if 0
1224  printf ("In SageInterface::querySubTree(): in loop: count = %d \n",count);
1225 #endif
1226  NodeType* node = dynamic_cast<NodeType*>(*i);
1227  ROSE_ASSERT (node);
1228  result[count] = node;
1229  }
1230 #if 0
1231  printf ("Leaving SageInterface::querySubTree(): after initialization loop \n");
1232 #endif
1233 
1234  return result;
1235  }
1240  std::vector < SgFile * >generateFileList ();
1241 
1246 ROSE_DLL_API SgProject * getProject();
1247 
1249  SgProject * getProject(const SgNode * node);
1250 
1252 template <typename NodeType>
1253 static std::vector<NodeType*> getSgNodeListFromMemoryPool()
1254 {
1255  // This function uses a memory pool traversal specific to the SgFile IR nodes
1256  class MyTraversal : public ROSE_VisitTraversal
1257  {
1258  public:
1259  std::vector<NodeType*> resultlist;
1260  void visit ( SgNode* node)
1261  {
1262  NodeType* result = dynamic_cast<NodeType* > (node);
1263  ROSE_ASSERT(result!= NULL);
1264  if (result!= NULL)
1265  {
1266  resultlist.push_back(result);
1267  }
1268  };
1269  virtual ~MyTraversal() {}
1270  };
1271 
1272  MyTraversal my_traversal;
1273  NodeType::traverseMemoryPoolNodes(my_traversal);
1274  return my_traversal.resultlist;
1275 }
1276 
1277 
1280 ROSE_DLL_API SgFunctionDeclaration* findMain(SgNode* currentNode);
1281 
1283 SgStatement* findLastDeclarationStatement(SgScopeStatement * scope, bool includePragma = false);
1284 
1285  //midend/programTransformation/partialRedundancyElimination/pre.h
1287 std::vector<SgVariableSymbol*> getSymbolsUsedInExpression(SgExpression* expr);
1288 
1290 
1295 std::vector<SgBreakStmt*> findBreakStmts(SgStatement* code, const std::string& fortranLabel = "");
1296 
1298 
1303 std::vector<SgContinueStmt*> findContinueStmts(SgStatement* code, const std::string& fortranLabel = "");
1304 std::vector<SgGotoStatement*> findGotoStmts(SgStatement* scope, SgLabelStatement* l);
1305 std::vector<SgStatement*> getSwitchCases(SgSwitchStatement* sw);
1306 
1308 void collectVarRefs(SgLocatedNode* root, std::vector<SgVarRefExp* >& result);
1309 
1311 template <typename T>
1312 T* findDeclarationStatement(SgNode* root, std::string name, SgScopeStatement* scope, bool isDefining)
1313  {
1314  bool found = false;
1315 
1316 #if 0
1317  printf ("In findDeclarationStatement(): root = %p \n",root);
1318  printf ("In findDeclarationStatement(): name = %s \n",name.c_str());
1319  printf ("In findDeclarationStatement(): scope = %p \n",scope);
1320  printf ("In findDeclarationStatement(): isDefining = %s \n",isDefining ? "true" : "false");
1321 #endif
1322 
1323  // Do we really want a NULL pointer to be acceptable input to this function?
1324  // Maybe we should have an assertion that it is non-null?
1325  if (!root) return NULL;
1326 
1327  T* decl = dynamic_cast<T*>(root);
1328 
1329 #if 0
1330  printf ("In findDeclarationStatement(): decl = %p \n",decl);
1331 #endif
1332 
1333  if (decl != NULL)
1334  {
1335  if (scope)
1336  {
1337  if ((decl->get_scope() == scope) && (decl->search_for_symbol_from_symbol_table()->get_name() == name))
1338  {
1339  found = true;
1340  }
1341  }
1342  else // Liao 2/9/2010. We should allow NULL scope
1343  {
1344 #if 0
1345  // DQ (12/6/2016): Include this into the debugging code to aboid compiler warning about unused variable.
1346  SgSymbol* symbol = decl->search_for_symbol_from_symbol_table();
1347  printf ("In findDeclarationStatement(): decl->search_for_symbol_from_symbol_table() = %p \n",symbol);
1348  printf ("In findDeclarationStatement(): decl->search_for_symbol_from_symbol_table()->get_name() = %s \n",symbol->get_name().str());
1349 #endif
1350  if (decl->search_for_symbol_from_symbol_table()->get_name() == name)
1351  {
1352  found = true;
1353  }
1354  }
1355  }
1356 
1357  if (found)
1358  {
1359  if (isDefining)
1360  {
1361 #if 0
1362  printf ("In findDeclarationStatement(): decl->get_firstNondefiningDeclaration() = %p \n",decl->get_firstNondefiningDeclaration());
1363  printf ("In findDeclarationStatement(): decl->get_definingDeclaration() = %p \n",decl->get_definingDeclaration());
1364 #endif
1365  ROSE_ASSERT (decl->get_definingDeclaration() != NULL);
1366 #if 0
1367  printf ("In findDeclarationStatement(): returing decl->get_definingDeclaration() = %p \n",decl->get_definingDeclaration());
1368 #endif
1369  return dynamic_cast<T*> (decl->get_definingDeclaration());
1370  }
1371  else
1372  {
1373 #if 0
1374  printf ("In findDeclarationStatement(): returing decl = %p \n",decl);
1375 #endif
1376  return decl;
1377  }
1378  }
1379 
1380  std::vector<SgNode*> children = root->get_traversalSuccessorContainer();
1381 
1382 #if 0
1383  printf ("In findDeclarationStatement(): children.size() = %zu \n",children.size());
1384 #endif
1385 
1386  // DQ (4/10/2016): Note that if we are searching for a function member that has it's defining
1387  // declaration defined outside of the class then it will not be found in the child list.
1388  for (std::vector<SgNode*>::const_iterator i = children.begin(); i != children.end(); ++i)
1389  {
1390  T* target = findDeclarationStatement<T> (*i,name,scope,isDefining);
1391 
1392  if (target)
1393  {
1394  return target;
1395  }
1396  }
1397 
1398  return NULL;
1399  }
1401  SgFunctionDeclaration* findFunctionDeclaration(SgNode* root, std::string name, SgScopeStatement* scope, bool isDefining);
1402 
1403 #if 0 //TODO
1404  // 1. preorder traversal from current SgNode till find next SgNode of type V_SgXXX
1405  // until reach the end node
1406  SgNode* getNextSgNode( const SgNode* astSourceNode, VariantT=V_SgNode, SgNode* astEndNode=NULL);
1407 
1408  // 2. return all nodes of type VariantT following the source node
1409  std::vector<SgNode*> getAllNextSgNode( const SgNode* astSourceNode, VariantT=V_SgNode, SgNode* astEndNode=NULL);
1410 #endif
1411 
1413 
1414 //------------------------------------------------------------------------
1416 
1419 // remember to put const to all arguments.
1420 
1421 
1436 template <typename NodeType>
1437 NodeType* getEnclosingNode(const SgNode* astNode, const bool includingSelf = false)
1438  {
1439 #define DEBUG_GET_ENCLOSING_NODE 0
1440 
1441 #if 1 /* TOP_LEVEL_IF */
1442  // DQ (12/31/2019): This version does not detect a cycle that Robb's version detects in processing Cxx11_tests/test2016_23.C.
1443  // This will have to be investigated seperately from the issue I am working on currently.
1444 
1445  // DQ (10/20/2012): This is the older version of this implementation. Until I am sure that
1446  // the newer version (below) is what we want to use I will resolve this conflict by keeping
1447  // the previous version in place.
1448 
1449  if (nullptr == astNode)
1450  {
1451  return nullptr;
1452  }
1453 
1454  if ( (includingSelf ) && (dynamic_cast<const NodeType*>(astNode)) )
1455  {
1456  return const_cast<NodeType*>(dynamic_cast<const NodeType*> (astNode));
1457  }
1458 
1459  // DQ (3/5/2012): Check for reference to self...
1460  ROSE_ASSERT(astNode->get_parent() != astNode);
1461 
1462  SgNode* parent = astNode->get_parent();
1463 
1464  // DQ (3/5/2012): Check for loops that will cause infinite loops.
1465  SgNode* previouslySeenParent = parent;
1466  bool foundCycle = false;
1467  int counter = 0;
1468 
1469 #if DEBUG_GET_ENCLOSING_NODE
1470  printf ("In getEnclosingNode(): previouslySeenParent = %p = %s \n",previouslySeenParent,previouslySeenParent->class_name().c_str());
1471 #endif
1472 
1473  while ( (foundCycle == false) && (parent != nullptr) && (!dynamic_cast<const NodeType*>(parent)) )
1474  {
1475  ROSE_ASSERT(parent->get_parent() != parent);
1476 
1477 #if DEBUG_GET_ENCLOSING_NODE
1478  printf (" --- parent = %p = %s \n",parent,parent->class_name().c_str());
1479  printf (" --- --- parent->get_parent() = %p = %s \n",parent->get_parent(),parent->get_parent()->class_name().c_str());
1480 #endif
1481 
1482 #if 1
1483  // DQ (1/8/2020): ROSE-82 (on RZ) This limit needs to be larger and increasing it to 500 was enough
1484  // for a specific code with a long chain of if-then-else nesting, So to make this sufficent for more
1485  // general code we have increased the lomit to 100,000. Note that 50 was not enough for real code,
1486  // but was enough for our regression tests.
1487  // DQ (12/30/2019): This is added to support detection of infinite loops over parent pointers.
1488  // if (counter >= 500)
1489  if (counter >= 100000)
1490  {
1491  printf ("Exiting: In getEnclosingNode(): loop limit exceeded: counter = %d \n",counter);
1492  ROSE_ABORT();
1493  }
1494 #endif
1495  parent = parent->get_parent();
1496 
1497  // DQ (3/5/2012): Check for loops that will cause infinite loops.
1498  // ROSE_ASSERT(parent != previouslySeenParent);
1499  if (parent == previouslySeenParent)
1500  {
1501  foundCycle = true;
1502  }
1503  counter++;
1504 
1505  }
1506 
1507 #if DEBUG_GET_ENCLOSING_NODE
1508  printf ("previouslySeenParent = %p = %s \n",previouslySeenParent,previouslySeenParent->class_name().c_str());
1509 #endif
1510 
1511  parent = previouslySeenParent;
1512 
1513  SgDeclarationStatement* declarationStatement = isSgDeclarationStatement(parent);
1514  if (declarationStatement != nullptr)
1515  {
1516 #if 0
1517  printf ("Found a SgDeclarationStatement \n");
1518 #endif
1519  SgDeclarationStatement* definingDeclaration = declarationStatement->get_definingDeclaration();
1520  SgDeclarationStatement* firstNondefiningDeclaration = declarationStatement->get_firstNondefiningDeclaration();
1521 
1522 #if 0
1523  printf (" --- declarationStatement = %p \n",declarationStatement);
1524  printf (" --- definingDeclaration = %p \n",definingDeclaration);
1525  if (definingDeclaration != NULL && definingDeclaration->get_parent() != NULL)
1526  printf (" --- definingDeclaration ->get_parent() = %p = %s \n",definingDeclaration->get_parent(),definingDeclaration->get_parent()->class_name().c_str());
1527  printf (" --- firstNondefiningDeclaration = %p \n",firstNondefiningDeclaration);
1528  if (firstNondefiningDeclaration != NULL && firstNondefiningDeclaration->get_parent() != NULL)
1529  printf (" --- firstNondefiningDeclaration ->get_parent() = %p = %s \n",firstNondefiningDeclaration->get_parent(),firstNondefiningDeclaration->get_parent()->class_name().c_str());
1530 #endif
1531  if (definingDeclaration != nullptr && declarationStatement != firstNondefiningDeclaration)
1532  {
1533 #if 0
1534  printf ("Found a nondefining declaration so use the non-defining declaration instead \n");
1535 #endif
1536  // DQ (10/19/2012): Use the defining declaration instead.
1537  // parent = firstNondefiningDeclaration;
1538  parent = definingDeclaration;
1539  }
1540  }
1541 
1542 #if 0
1543  printf ("reset: previouslySeenParent = %p = %s \n",previouslySeenParent,previouslySeenParent->class_name().c_str());
1544 #endif
1545 
1546  // DQ (10/19/2012): This branch is just to document the cycle that was previously detected, it is for
1547  // debugging only. Thus it ony make sense for it to be executed when "(foundCycle == true)". However,
1548  // this will have to be revisited later since it appears clear that it is a problem for the binary analysis
1549  // work when it is visited for this case. Since the cycle is detected, but there is no assertion on the
1550  // cycle, we don't exit when a cycle is identified (which is the point of the code below).
1551  // Note also that I have fixed the code (above and below) to only chase pointers through defining
1552  // declarations (where they exist), this is important since non-defining declarations can be almost
1553  // anywhere (and thus chasing them can make it appear that there are cycles where there are none
1554  // (I think); test2012_234.C demonstrates an example of this.
1555  // DQ (10/9/2012): Robb has suggested this change to fix the binary analysis work.
1556  // if (foundCycle == true)
1557  if (foundCycle == false)
1558  {
1559 
1560 
1561  while ( (parent != nullptr) && (!dynamic_cast<const NodeType*>(parent)) )
1562  {
1563  ROSE_ASSERT(parent->get_parent() != parent);
1564 #if 0
1565  printf ("In getEnclosingNode() (2nd try): parent = %p = %s \n",parent,parent->class_name().c_str());
1566  if (parent->get_file_info() != NULL)
1567  parent->get_file_info()->display("In getEnclosingNode() (2nd try): debug");
1568 #endif
1569  SgDeclarationStatement* declarationStatement = isSgDeclarationStatement(parent);
1570  if (declarationStatement != nullptr)
1571  {
1572 #if DEBUG_GET_ENCLOSING_NODE
1573  printf ("Found a SgDeclarationStatement \n");
1574 #endif
1575  SgDeclarationStatement* definingDeclaration = declarationStatement->get_definingDeclaration();
1576  SgDeclarationStatement* firstNondefiningDeclaration = declarationStatement->get_firstNondefiningDeclaration();
1577  if (definingDeclaration != nullptr && declarationStatement != firstNondefiningDeclaration)
1578  {
1579 #if 0
1580  printf ("Found a nondefining declaration so use the firstNondefining declaration instead \n");
1581 #endif
1582  // DQ (10/19/2012): Use the defining declaration instead.
1583  // parent = firstNondefiningDeclaration;
1584  parent = definingDeclaration;
1585  }
1586  }
1587 
1588  parent = parent->get_parent();
1589 
1590 #if 1
1591  // DQ (3/5/2012): Check for loops that will cause infinite loops.
1592  ROSE_ASSERT(parent != previouslySeenParent);
1593 #else
1594  printf ("WARNING::WARNING::WARNING commented out assertion for parent != previouslySeenParent \n");
1595  if (parent == previouslySeenParent)
1596  break;
1597 #endif
1598  }
1599  }
1600 
1601  return const_cast<NodeType*>(dynamic_cast<const NodeType*> (parent));
1602 #else /* TOP_LEVEL_IF */
1603  // DQ (10/20/2012): Using Robb's newer version with my modification to use the definingDeclaration rather than firstNondefiningDeclaration (below).
1604 
1605  // Find the parent of specified type, but watch out for cycles in the ancestry (which would cause an infinite loop).
1606  // Cast away const because isSg* functions aren't defined for const node pointers; and our return is not const.
1607  SgNode *node = const_cast<SgNode*>(!astNode || includingSelf ? astNode : astNode->get_parent());
1608  std::set<const SgNode*> seen; // nodes we've seen, in order to detect cycles
1609  while (node) {
1610  if (NodeType *found = dynamic_cast<NodeType*>(node))
1611  return found;
1612 
1613  // FIXME: Cycle detection could be moved elsewhere so we don't need to do it on every call. [RPM 2012-10-09]
1614  // DQ (12/30/2019): Provide more detail in error message.
1615  if (seen.insert(node).second == false)
1616  {
1617  printf ("Error: node is already in set and defines a cycle: node = %p = %s \n",node,node->class_name().c_str());
1618  std::set<const SgNode*>::const_iterator i = seen.begin();
1619  while (i != seen.end())
1620  {
1621  const SgNode* element = *i;
1622  printf (" --- seen element: element = %p = %s \n",element,element->class_name().c_str());
1623  i++;
1624  }
1625 
1626  printf ("Exiting after error! \n");
1627  ROSE_ABORT();
1628  }
1629  // ROSE_ASSERT(seen.insert(node).second);
1630 
1631  // Traverse to parent (declaration statements are a special case)
1632  if (SgDeclarationStatement *declarationStatement = isSgDeclarationStatement(node)) {
1633  SgDeclarationStatement *definingDeclaration = declarationStatement->get_definingDeclaration();
1634  SgDeclarationStatement *firstNondefiningDeclaration = declarationStatement->get_firstNondefiningDeclaration();
1635  if (definingDeclaration && firstNondefiningDeclaration && declarationStatement != firstNondefiningDeclaration) {
1636  // DQ (10/19/2012): Use the defining declaration instead.
1637  // node = firstNondefiningDeclaration;
1638  node = definingDeclaration;
1639  }
1640  } else {
1641  node = node->get_parent();
1642  }
1643  }
1644  return NULL;
1645 #endif /* TOP_LEVEL_IF */
1646  }
1647 
1649  ROSE_DLL_API SgSourceFile* getEnclosingSourceFile(SgNode* n, const bool includingSelf=false);
1650 
1652  ROSE_DLL_API SgScopeStatement* getScope(const SgNode* astNode);
1653 
1655  ROSE_DLL_API SgScopeStatement* getEnclosingScope(SgNode* n, const bool includingSelf=false);
1656 
1658  ROSE_DLL_API SgGlobal* getGlobalScope( const SgNode* astNode);
1659 
1660  // DQ (12/7/2020): This is supporting the recognition of functions in header files from two different AST.
1662  ROSE_DLL_API bool hasSameGlobalScope ( SgStatement* statement_1, SgStatement* statement_2 );
1663 
1665  ROSE_DLL_API SgFunctionDefinition* getEnclosingProcedure(SgNode* n, const bool includingSelf=false);
1666 
1667  ROSE_DLL_API SgFunctionDefinition* getEnclosingFunctionDefinition(SgNode* astNode, const bool includingSelf=false);
1668 
1670  ROSE_DLL_API SgStatement* getEnclosingStatement(SgNode* n);
1671 
1674 
1677 
1679  ROSE_DLL_API SgScopeStatement* findEnclosingLoop(SgStatement* s, const std::string& fortranLabel = "", bool stopOnSwitches = false);
1680 
1682  ROSE_DLL_API SgFunctionDeclaration * getEnclosingFunctionDeclaration (SgNode * astNode, const bool includingSelf=false);
1683  //roseSupport/utility_functions.h
1685  ROSE_DLL_API SgFile* getEnclosingFileNode (SgNode* astNode );
1686 
1689 
1691  ROSE_DLL_API SgClassDefinition* getEnclosingClassDefinition(SgNode* astnode, const bool includingSelf=false);
1692 
1694  ROSE_DLL_API SgClassDeclaration* getEnclosingClassDeclaration( SgNode* astNode );
1695 
1696  // DQ (2/7/2019): Adding support for name qualification of variable references associated with SgPointerMemberType function parameters.
1698  ROSE_DLL_API SgExprListExp* getEnclosingExprListExp(SgNode* astNode, const bool includingSelf = false);
1699 
1700  // DQ (2/7/2019): Need a function to return when an expression is in an expression subtree.
1701  // This is part of index evaluation ofr expressions in function argument lists, but likely usefule elsewhere as well.
1702  ROSE_DLL_API bool isInSubTree(SgExpression* subtree, SgExpression* exp);
1703 
1704  // DQ (2/7/2019): Need a function to return the SgFunctionDeclaration from a SgFunctionCallExp.
1705  ROSE_DLL_API SgFunctionDeclaration* getFunctionDeclaration ( SgFunctionCallExp* functionCallExp );
1706 
1707  // DQ (2/17/2019): Generalizing this support for SgVarRefExp and SgMemberFunctionRefExp nodes.
1708  // DQ (2/8/2019): Adding support for detecting when to use added name qualification for pointer-to-member expressions.
1709  ROSE_DLL_API bool isDataMemberReference(SgVarRefExp* varRefExp);
1710  // ROSE_DLL_API bool isAddressTaken(SgVarRefExp* varRefExp);
1711  ROSE_DLL_API bool isAddressTaken(SgExpression* refExp);
1712 
1713  // DQ (2/17/2019): Adding support for detecting when to use added name qualification for membr function references.
1714  ROSE_DLL_API bool isMemberFunctionMemberReference(SgMemberFunctionRefExp* memberFunctionRefExp);
1715 
1716  // DQ (2/15/2019): Adding support for detecting which class a member reference is being made from.
1717  // ROSE_DLL_API SgClassType* getClassTypeForDataMemberReference(SgVarRefExp* varRefExp);
1718  // ROSE_DLL_API std::list<SgClassType*> getClassTypeChainForDataMemberReference(SgVarRefExp* varRefExp);
1719  ROSE_DLL_API std::list<SgClassType*> getClassTypeChainForMemberReference(SgExpression* refExp);
1720 
1721  ROSE_DLL_API std::set<SgNode*> getFrontendSpecificNodes();
1722 
1723  // DQ (2/17/2019): Display the shared nodes in the AST for debugging.
1724  ROSE_DLL_API void outputSharedNodes( SgNode* node );
1725 
1726  // DQ (10/31/2020): Added function to help debug edits to statements in scopes.
1727  ROSE_DLL_API void displayScope(SgScopeStatement* scope);
1728 
1729 // TODO
1730 #if 0
1731  SgNode * getEnclosingSgNode(SgNode* source,VariantT, SgNode* endNode=NULL);
1732  std::vector<SgNode *> getAllEnclosingSgNode(SgNode* source,VariantT, SgNode* endNode=NULL);
1733  SgVariableDeclaration* findVariableDeclaratin( const string& varname)
1734 
1736 
1737  // e.g. for some expression, find its parent statement
1738  SgStatement* getEnclosingStatement(const SgNode* astNode);
1739 
1740  SgSwitchStatement* getEnclosingSwitch(SgStatement* s);
1741  SgModuleStatement* getEnclosingModuleStatement( const SgNode* astNode);
1742 
1743  // used to build a variable reference for compiler generated code in current scope
1744  SgSymbol * findReachingDefinition (SgScopeStatement* startScope, SgName &name);
1745 #endif
1746 
1747 
1748 //------------------------------------------------------------------------
1750 
1753  // Liao, 1/9/2008
1757  ROSE_DLL_API SgGlobal * getFirstGlobalScope(SgProject *project);
1758 
1762  ROSE_DLL_API SgStatement* getLastStatement(SgScopeStatement *scope);
1763 
1765  ROSE_DLL_API SgStatement* getFirstStatement(SgScopeStatement *scope,bool includingCompilerGenerated=false);
1768 
1770  ROSE_DLL_API SgStatement* getNextStatement(SgStatement * currentStmt);
1771 
1773  ROSE_DLL_API SgStatement* getPreviousStatement(SgStatement * currentStmt, bool climbOutScope = true);
1774 #if 0 //TODO
1775  // preorder traversal from current SgNode till find next SgNode of type V_SgXXX
1776  SgNode* getNextSgNode( const SgNode* currentNode, VariantT=V_SgNode);
1777 #endif
1778 
1779  // DQ (11/15/2018): Adding support for traversals over the include file tree.
1781  void listHeaderFiles ( SgIncludeFile* includeFile );
1782 
1783 
1785 
1786 //------------------------------------------------------------------------
1788 
1791  ROSE_DLL_API bool isEqualToIntConst(SgExpression* e, int value);
1793 
1795 
1798  ROSE_DLL_API bool isSameFunction(SgFunctionDeclaration* func1, SgFunctionDeclaration* func2);
1799 
1801  ROSE_DLL_API bool isLastStatement(SgStatement* stmt);
1802 
1804 
1805 //------------------------------------------------------------------------
1807 
1813 #if 1
1815  {
1816  // DQ (11/19/2020): We need to expand the use of this to cover deffered transformations of common SageInterface transformations (e.g. replaceStatement).
1817  // So I needed to move this out of being specific to the outliner and make it more generally data structure in the SageInterface.
1818 
1819  // DQ (11/15/2020): Need to add the concept of deffered transformation to cover replaceStatement operations.
1820 
1821  // DQ (8/7/2019): Store data required to support defering the transformation to insert the outlined function prototypes
1822  // into class declaration (when this is required to support the outlined function's access to protected or private data members).
1823  // This is part of an optimization to support the optimization of header file unparsing (limiting the overhead of supporting any
1824  // header file to just focus on the few (typically one) header file that would have to be unparsed.
1825 
1826  enum TransformationKind
1827  {
1828  // DQ (11/22/2020): Might need to also add SageInterface::addDefaultConstructorIfRequired() and SageStatement::insert_statment()
1829  // to support the processStatements.C transforamtions to pre-process the AST (return expressions and variable initializations).
1830  e_error,
1831  e_default,
1832  e_outliner,
1833  e_replaceStatement,
1834  e_removeStatement,
1835  e_replaceDefiningFunctionDeclarationWithFunctionPrototype,
1836  e_last
1837  };
1838 
1839  TransformationKind deferredTransformationKind;
1840 
1841  // DQ (12/12/2020): Adding a string label so that we can name the different kinds of transformations.
1842  // E.g. moving pattern matched function from header file to dynamic library, vs. replacing function
1843  // definitions in the dynamic library file with function prototypes.
1844  std::string transformationLabel;
1845 
1846  // Remove sets statementToRemove, replace sets statementToRemove and StatementToAdd.
1847  SgStatement* statementToRemove;
1848  SgStatement* statementToAdd;
1849 
1850  SgClassDefinition* class_definition;
1851  SgDeclarationStatement* target_class_member;
1852  SgDeclarationStatement* new_function_prototype;
1853 
1854  typedef std::set<SgClassDefinition *> ClassDefSet_t;
1855  ClassDefSet_t targetClasses;
1856 
1857  typedef std::vector<SgFunctionDeclaration *> FuncDeclList_t;
1858  FuncDeclList_t targetFriends;
1859 
1860  // DQ (2/28/2021): Adding support for outlining where it involves building up pre-transformations.
1861  // For example, in the code segregation, we build a conditiona around the interval of statements
1862  // that we are outlining. This conditional is used to overwrite the first statement in the interval
1863  // list. Because we don't want to transform the AST until after the outlining, we need so save the
1864  // whole interval so that we, after the outlining, remove the statements in the interval after that
1865  // first statement.
1866  typedef std::vector<SgStatement*> IntervalType;
1867  IntervalType statementInterval;
1868  SgStatement* locationToOverwriteWithTransformation;
1869  SgStatement* transformationToOverwriteFirstStatementInInterval;
1870  SgBasicBlock* blockOfStatementsToOutline;
1871 
1872  // DQ (12/5/2019): Added ROSE_DLL_API prefix for Windows support (too all of these functions).
1873  ROSE_DLL_API DeferredTransformation();
1874  ROSE_DLL_API DeferredTransformation(SgClassDefinition* class_definition, SgDeclarationStatement* target_class_member, SgDeclarationStatement* new_function_prototype);
1875  ROSE_DLL_API DeferredTransformation (const DeferredTransformation& X);
1876  ROSE_DLL_API ~DeferredTransformation (void);
1877 
1878  ROSE_DLL_API DeferredTransformation & operator= (const DeferredTransformation& X);
1879 
1880  // DQ (11/20/20): static function to generate specialized version of deferred transformation object.
1882  static ROSE_DLL_API DeferredTransformation replaceStatement(SgStatement* oldStmt, SgStatement* newStmt, bool movePreprocessinInfo = false);
1883 
1884  static ROSE_DLL_API std::string outputDeferredTransformationKind(const TransformationKind & kind);
1885  ROSE_DLL_API void display ( std::string label ) const;
1886 
1887  };
1888 #endif
1889 
1890 
1891 // DQ (2/24/2009): Simple function to delete an AST subtree (used in outlining).
1893 ROSE_DLL_API void deleteAST(SgNode* node);
1894 
1897 
1898 // DQ (2/25/2009): Added new function to support outliner.
1900 ROSE_DLL_API void moveStatementsBetweenBlocks ( SgBasicBlock* sourceBlock, SgBasicBlock* targetBlock );
1901 
1903 ROSE_DLL_API void moveStatementsBetweenBlocks ( SgNamespaceDefinitionStatement* sourceBlock, SgNamespaceDefinitionStatement* targetBlock );
1904 
1906 ROSE_DLL_API bool isLambdaFunction (SgFunctionDeclaration* func);
1907 
1909 ROSE_DLL_API bool isLambdaCapturedVariable (SgVarRefExp* varRef);
1910 
1912 ROSE_DLL_API void moveVariableDeclaration(SgVariableDeclaration* decl, SgScopeStatement* target_scope);
1914 ROSE_DLL_API void appendStatement(SgStatement *stmt, SgScopeStatement* scope=NULL);
1915 
1917 ROSE_DLL_API void appendStatement(SgStatement *stmt, SgForInitStatement* for_init_stmt);
1918 
1920 ROSE_DLL_API void appendStatementList(const std::vector<SgStatement*>& stmt, SgScopeStatement* scope=NULL);
1921 
1922 // DQ (2/6/2009): Added function to support outlining into separate file.
1924 ROSE_DLL_API void appendStatementWithDependentDeclaration( SgDeclarationStatement* decl, SgGlobal* scope, SgStatement* original_statement, bool excludeHeaderFiles );
1925 
1928 ROSE_DLL_API void prependStatement(SgStatement *stmt, SgScopeStatement* scope=NULL);
1929 
1931 ROSE_DLL_API void prependStatement(SgStatement *stmt, SgForInitStatement* for_init_stmt);
1932 
1935 ROSE_DLL_API void prependStatementList(const std::vector<SgStatement*>& stmt, SgScopeStatement* scope=NULL);
1936 
1940 ROSE_DLL_API bool hasSimpleChildrenList (SgScopeStatement* scope);
1941 
1943 ROSE_DLL_API void insertStatement(SgStatement *targetStmt, SgStatement* newStmt, bool insertBefore= true, bool autoMovePreprocessingInfo = true);
1944 
1946 //target's scope
1947 ROSE_DLL_API void insertStatementList(SgStatement *targetStmt, const std::vector<SgStatement*>& newStmts, bool insertBefore= true);
1948 
1950 ROSE_DLL_API void insertStatementBefore(SgStatement *targetStmt, SgStatement* newStmt, bool autoMovePreprocessingInfo = true);
1951 
1953 ROSE_DLL_API void insertStatementListBefore(SgStatement *targetStmt, const std::vector<SgStatement*>& newStmts);
1954 
1956 ROSE_DLL_API void insertStatementAfter(SgStatement *targetStmt, SgStatement* newStmt, bool autoMovePreprocessingInfo = true);
1957 
1959 ROSE_DLL_API void insertStatementListAfter(SgStatement *targetStmt, const std::vector<SgStatement*>& newStmt);
1960 
1962 ROSE_DLL_API void insertStatementAfterLastDeclaration(SgStatement* stmt, SgScopeStatement* scope);
1963 
1965 ROSE_DLL_API void insertStatementAfterLastDeclaration(std::vector<SgStatement*> stmt_list, SgScopeStatement* scope);
1966 
1968 // then the statement is inserted at the end of the scope.
1969 ROSE_DLL_API void insertStatementBeforeFirstNonDeclaration(SgStatement *newStmt, SgScopeStatement *scope,
1970  bool movePreprocessingInfo=true);
1971 
1973 //then the new statements are inserted at the end of the scope.
1974 ROSE_DLL_API void insertStatementListBeforeFirstNonDeclaration(const std::vector<SgStatement*> &newStmts, SgScopeStatement *scope);
1975 
1976 // DQ (11/21/2018): We need to sometimes insert something after the last statement of the collection from rose_edg_required_macros_and_functions.h.
1977 ROSE_DLL_API SgStatement* lastFrontEndSpecificStatement( SgGlobal* globalScope );
1978 
1980 ROSE_DLL_API void removeStatement(SgStatement* stmt, bool autoRelocatePreprocessingInfo = true);
1981 
1983 ROSE_DLL_API void deepDelete(SgNode* root);
1984 
1986 ROSE_DLL_API void replaceStatement(SgStatement* oldStmt, SgStatement* newStmt, bool movePreprocessinInfo = false);
1987 
1989 ROSE_DLL_API SgNode* replaceWithPattern (SgNode * anchor, SgNode* new_pattern);
1990 
1992 // Essentially replace variable a with b.
1993 ROSE_DLL_API void replaceVariableReferences(SgVariableSymbol* old_sym, SgVariableSymbol* new_sym, SgScopeStatement * scope );
1994 
1995 // DQ (11/12/2018): Adding test to avoid issues that we can't test for in the unparsing of header files using the token based unparsing.
1999 ROSE_DLL_API bool statementCanBeTransformed(SgStatement* stmt);
2000 
2001 
2012 std::pair<SgVariableDeclaration*, SgExpression* > createTempVariableForExpression(SgExpression* expression,
2013  SgScopeStatement* scope, bool initializeInDeclaration, SgAssignOp** reEvaluate = NULL);
2014 
2015 /* This function creates a temporary variable for a given expression in the given scope
2016  This is different from SageInterface::createTempVariableForExpression in that it does not
2017  try to be smart to create pointers to reference types and so on. The tempt is initialized to expression.
2018  The caller is responsible for setting the parent of SgVariableDeclaration since buildVariableDeclaration
2019  may not set_parent() when the scope stack is empty. See programTransformation/extractFunctionArgumentsNormalization/ExtractFunctionArguments.C for sample usage.
2020  @param expression Expression which will be replaced by a variable
2021  @param scope scope in which the temporary variable will be generated
2022 */
2023 
2024 std::pair<SgVariableDeclaration*, SgExpression*> createTempVariableAndReferenceForExpression
2025  (SgExpression* expression, SgScopeStatement* scope);
2026 
2028 
2035 
2037 ROSE_DLL_API void appendExpression(SgExprListExp *, SgExpression*);
2038 
2040 ROSE_DLL_API void appendExpressionList(SgExprListExp *, const std::vector<SgExpression*>&);
2041 
2043 template <class actualFunction>
2044 void setParameterList(actualFunction *func,SgFunctionParameterList *paralist) {
2045 
2046  // TODO consider the difference between C++ and Fortran
2047  // fixup the scope of arguments,no symbols for nondefining function declaration's arguments
2048 
2049  // DQ (11/25/2011): templated function so that we can handle both
2050  // SgFunctionDeclaration and SgTemplateFunctionDeclaration (and their associated member
2051  // function derived classes).
2052 
2053  ROSE_ASSERT(func != NULL);
2054  ROSE_ASSERT(paralist != NULL);
2055 
2056 #if 0
2057  // At this point we don't have cerr and endl defined, so comment this code out.
2058  // Warn to users if a paralist is being shared
2059  if (paralist->get_parent() !=NULL)
2060  {
2061  cerr << "Waring! Setting a used SgFunctionParameterList to function: "
2062  << (func->get_name()).getString()<<endl
2063  << " Sharing parameter lists can corrupt symbol tables!"<<endl
2064  << " Please use deepCopy() to get an exclusive parameter list for each function declaration!"<<endl;
2065  // ROSE_ASSERT(false);
2066  }
2067 #endif
2068 
2069  // Liao,2/5/2008 constructor of SgFunctionDeclaration will automatically generate SgFunctionParameterList, so be cautious when set new paralist!!
2070  if (func->get_parameterList() != NULL)
2071  {
2072  if (func->get_parameterList() != paralist)
2073  {
2074  delete func->get_parameterList();
2075  }
2076  }
2077 
2078  func->set_parameterList(paralist);
2079  paralist->set_parent(func);
2080 
2081  {
2082  // DQ (5/15/2012): Need to set the declptr in each SgInitializedName IR node.
2083  // This is needed to support the AST Copy mechanism (at least). The files: test2005_150.C,
2084  // test2012_81.C and testcode2012_82.C demonstrate this problem.
2085  SgInitializedNamePtrList & args = paralist->get_args();
2086  for (SgInitializedNamePtrList::iterator i = args.begin(); i != args.end(); i++)
2087  {
2088  (*i)->set_declptr(func);
2089  }
2090  }
2091  }
2092 
2094 ROSE_DLL_API void setPragma(SgPragmaDeclaration* decl, SgPragma *pragma);
2095 
2097 ROSE_DLL_API void replaceExpression(SgExpression* oldExp, SgExpression* newExp, bool keepOldExp=false);
2098 
2100 ROSE_DLL_API void replaceExpressionWithStatement(SgExpression* from,
2104 ROSE_DLL_API void replaceSubexpressionWithStatement(SgExpression* from,
2106 
2108 ROSE_DLL_API void setOperand(SgExpression* target, SgExpression* operand);
2109 
2111 ROSE_DLL_API void setLhsOperand(SgExpression* target, SgExpression* lhs);
2112 
2114 ROSE_DLL_API void setRhsOperand(SgExpression* target, SgExpression* rhs);
2115 
2117 ROSE_DLL_API void removeAllOriginalExpressionTrees(SgNode* top);
2118 
2119 // DQ (1/25/2010): Added support for directories
2121 ROSE_DLL_API void moveToSubdirectory ( std::string directoryName, SgFile* file );
2122 
2124 ROSE_DLL_API SgStatement* findSurroundingStatementFromSameFile(SgStatement* targetStmt, bool & surroundingStatementPreceedsTargetStatement);
2125 
2127 ROSE_DLL_API void moveCommentsToNewStatement(SgStatement* sourceStatement, const std::vector<int> & indexList, SgStatement* targetStatement, bool surroundingStatementPreceedsTargetStatement);
2128 
2129 // DQ (7/19/2015): This is required to support general unparsing of template instantations for the GNU g++
2130 // compiler which does not permit name qualification to be used to support the expression of the namespace
2131 // where a template instantiatoon would be places. Such name qualification would also sometimes require
2132 // global qualification which is also not allowed by the GNU g++ compiler. These issues appear to be
2133 // specific to the GNU compiler versions, at least versions 4.4 through 4.8.
2135 ROSE_DLL_API void moveDeclarationToAssociatedNamespace ( SgDeclarationStatement* declarationStatement );
2136 
2137 ROSE_DLL_API bool isTemplateInstantiationNode(SgNode* node);
2138 
2140 
2141 // DQ (12/1/2015): Adding support for fixup internal data struuctures that have references to statements (e.g. macro expansions).
2142 ROSE_DLL_API void resetInternalMapsForTargetStatement(SgStatement* sourceStatement);
2143 
2144 // DQ (6/7/2019): Add support for transforming function definitions to function prototypes in a subtree.
2145 // We might have to make this specific to a file (only traversing the functions in that file).
2154 
2155 // DQ (11/10/2019): Lower level support for convertFunctionDefinitionsToFunctionPrototypes().
2156 // DQ (10/27/2020): Need to return the generated function prototype (incase we want to mark it for output or template unparsing from the AST).
2157 // ROSE_DLL_API void replaceDefiningFunctionDeclarationWithFunctionPrototype ( SgFunctionDeclaration* functionDeclaration );
2158 // ROSE_DLL_API SgDeclarationStatement* replaceDefiningFunctionDeclarationWithFunctionPrototype ( SgFunctionDeclaration* functionDeclaration );
2160 ROSE_DLL_API std::vector<SgFunctionDeclaration*> generateFunctionDefinitionsList(SgNode* node);
2161 
2162 // DQ (10/29/2020): build a function prototype for all but member functions outside of the class (except for template instantiations).
2163 // The reason why member functions outside of the class are an exception is because they can not be used except in a class and there
2164 // would already be one present for the code to compile.
2165 ROSE_DLL_API SgFunctionDeclaration* buildFunctionPrototype ( SgFunctionDeclaration* functionDeclaration );
2166 
2167 
2169 //------------------------------------------------------------------------
2171 
2178 
2184 ROSE_DLL_API int fixVariableReferences(SgNode* root, bool cleanUnusedSymbol=true);
2185 
2187 
2191 ROSE_DLL_API void fixVariableDeclaration(SgVariableDeclaration* varDecl, SgScopeStatement* scope);
2192 
2194 ROSE_DLL_API void fixStructDeclaration(SgClassDeclaration* structDecl, SgScopeStatement* scope);
2196 ROSE_DLL_API void fixClassDeclaration(SgClassDeclaration* classDecl, SgScopeStatement* scope);
2197 
2199 ROSE_DLL_API void fixNamespaceDeclaration(SgNamespaceDeclarationStatement* structDecl, SgScopeStatement* scope);
2200 
2201 
2203 ROSE_DLL_API void fixLabelStatement(SgLabelStatement* label_stmt, SgScopeStatement* scope);
2204 
2206 ROSE_DLL_API void setFortranNumericLabel(SgStatement* stmt, int label_value,
2207  SgLabelSymbol::label_type_enum label_type=SgLabelSymbol::e_start_label_type,
2208  SgScopeStatement* label_scope=NULL);
2209 
2211 ROSE_DLL_API int suggestNextNumericLabel(SgFunctionDefinition* func_def);
2212 
2214 ROSE_DLL_API void fixFunctionDeclaration(SgFunctionDeclaration* stmt, SgScopeStatement* scope);
2215 
2217 ROSE_DLL_API void fixTemplateDeclaration(SgTemplateDeclaration* stmt, SgScopeStatement* scope);
2218 
2220 ROSE_DLL_API void fixStatement(SgStatement* stmt, SgScopeStatement* scope);
2221 
2222 // DQ (6/11/2015): This reports the statements that are marked as transformed (used to debug the token-based unparsing).
2224 ROSE_DLL_API std::set<SgStatement*> collectTransformedStatements( SgNode* node );
2225 
2227 ROSE_DLL_API std::set<SgStatement*> collectModifiedStatements( SgNode* node );
2228 
2230 ROSE_DLL_API std::set<SgLocatedNode*> collectModifiedLocatedNodes( SgNode* node );
2231 
2232 // DQ (6/5/2019): Use the previously constructed set (above) to reset the IR nodes to be marked as isModified.
2234 ROSE_DLL_API void resetModifiedLocatedNodes(const std::set<SgLocatedNode*> & modifiedNodeSet);
2235 
2236 
2237 // DQ (10/23/2018): Report nodes that are marked as modified.
2238 ROSE_DLL_API void reportModifiedStatements(const std::string & label, SgNode* node);
2239 
2240 // DQ (3/22/2019): Translate CPP directives from attached preprocessor information to CPP Directive Declaration IR nodes.
2241 ROSE_DLL_API void translateToUseCppDeclarations( SgNode* n );
2242 
2243 ROSE_DLL_API void translateScopeToUseCppDeclarations( SgScopeStatement* scope );
2244 
2245 ROSE_DLL_API std::vector<SgC_PreprocessorDirectiveStatement*> translateStatementToUseCppDeclarations( SgStatement* statement, SgScopeStatement* scope);
2246 ROSE_DLL_API void printOutComments ( SgLocatedNode* locatedNode );
2247 ROSE_DLL_API bool skipTranslateToUseCppDeclaration( PreprocessingInfo* currentPreprocessingInfo );
2248 
2249 // DQ (12/2/2019): Debugging support.
2250 ROSE_DLL_API void outputFileIds( SgNode* node );
2251 
2252 
2254 
2256 
2262 
2263 //------------------------------------------------------------------------
2265 
2269 ROSE_DLL_API bool
2271 collectReadWriteRefs(SgStatement* stmt, std::vector<SgNode*>& readRefs, std::vector<SgNode*>& writeRefs, bool useCachedDefUse=false);
2272 
2274 ROSE_DLL_API bool collectReadWriteVariables(SgStatement* stmt, std::set<SgInitializedName*>& readVars, std::set<SgInitializedName*>& writeVars, bool coarseGrain=true);
2275 
2277 ROSE_DLL_API void collectReadOnlyVariables(SgStatement* stmt, std::set<SgInitializedName*>& readOnlyVars, bool coarseGrain=true);
2278 
2280 ROSE_DLL_API void collectReadOnlySymbols(SgStatement* stmt, std::set<SgVariableSymbol*>& readOnlySymbols, bool coarseGrain=true);
2281 
2283 ROSE_DLL_API bool isUseByAddressVariableRef(SgVarRefExp* ref);
2284 
2286 ROSE_DLL_API void collectUseByAddressVariableRefs (const SgStatement* s, std::set<SgVarRefExp* >& varSetB);
2287 
2288 #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
2289 ROSE_DLL_API LivenessAnalysis * call_liveness_analysis(SgProject* project, bool debug=false);
2291 
2293 ROSE_DLL_API void getLiveVariables(LivenessAnalysis * liv, SgForStatement* loop, std::set<SgInitializedName*>& liveIns, std::set<SgInitializedName*> & liveOuts);
2294 #endif
2295 
2297 ROSE_DLL_API void ReductionRecognition(SgForStatement* loop, std::set< std::pair <SgInitializedName*, OmpSupport::omp_construct_enum> > & results);
2298 
2300 
2301 ROSE_DLL_API void constantFolding(SgNode* r);
2302 
2304 
2306 ROSE_DLL_API int instrumentEndOfFunction(SgFunctionDeclaration * func, SgStatement* s);
2307 
2309 ROSE_DLL_API void removeJumpsToNextStatement(SgNode*);
2310 
2312 ROSE_DLL_API void removeUnusedLabels(SgNode* top, bool keepChild =false);
2313 
2315 ROSE_DLL_API std::set<SgLabelStatement*> findUnusedLabels (SgNode* top);
2316 
2318 ROSE_DLL_API void removeConsecutiveLabels(SgNode* top);
2319 
2321 
2327 ROSE_DLL_API bool mergeDeclarationAndAssignment (SgVariableDeclaration* decl, SgExprStatement* assign_stmt, bool removeAssignStmt = true);
2328 
2329 
2331 ROSE_DLL_API bool mergeAssignmentWithDeclaration (SgExprStatement* assign_stmt, SgVariableDeclaration* decl, bool removeAssignStmt = true);
2332 
2334 
2337 ROSE_DLL_API bool mergeDeclarationWithAssignment (SgVariableDeclaration* decl, SgExprStatement* assign_stmt);
2338 
2340 
2345 
2347 ROSE_DLL_API int splitVariableDeclaration (SgScopeStatement* scope, bool topLevelOnly = true);
2348 
2350 
2357  ROSE_DLL_API SgAssignInitializer* splitExpression(SgExpression* from, std::string newName = "");
2358 
2360 ROSE_DLL_API void splitExpressionIntoBasicBlock(SgExpression* expr);
2361 
2363 ROSE_DLL_API void removeLabeledGotos(SgNode* top);
2364 
2366 ROSE_DLL_API void changeBreakStatementsToGotos(SgStatement* loopOrSwitch);
2367 
2370 
2373 
2376 
2379 
2382 
2385 
2388 
2391 
2393 ROSE_DLL_API SgBasicBlock* ensureBasicBlockAsFalseBodyOfIf(SgIfStmt* ifs, bool createEmptyBody = true);
2394 
2397 
2400 
2401 // DQ (1/18/2015): This is added to support better quality token-based unparsing.
2403 ROSE_DLL_API void cleanupNontransformedBasicBlockNode();
2404 
2405 // DQ (1/18/2015): This is added to support better quality token-based unparsing.
2407 ROSE_DLL_API void recordNormalizations(SgStatement* s);
2408 
2411 bool isBodyStatement (SgStatement* s);
2412 
2414 void changeAllBodiesToBlocks(SgNode* top, bool createEmptyBody = true);
2415 
2416 // The same as changeAllBodiesToBlocks(SgNode* top). Phased out.
2417 //void changeAllLoopBodiesToBlocks(SgNode* top);
2418 
2421 
2422 #if 0
2423 
2426 SgLocatedNode* ensureBasicBlockAsParent(SgStatement* s);
2427 #endif
2428 
2431 unsigned long long getIntegerConstantValue(SgValueExp* expr);
2432 
2434 std::vector<SgDeclarationStatement*> getDependentDeclarations (SgStatement* stmt );
2435 
2436 
2439 
2441 SgCommaOpExp *insertAfterUsingCommaOp (SgExpression* new_exp, SgExpression* anchor_exp, SgStatement** temp_decl = NULL, SgVarRefExp** temp_ref = NULL);
2442 
2443 
2473 std::pair<SgStatement*, SgInitializedName*>
2474 wrapFunction(SgFunctionDeclaration& definingDeclaration, SgName newName);
2475 
2481 template <class NameGen>
2482 std::pair<SgStatement*, SgInitializedName*>
2483 wrapFunction(SgFunctionDeclaration& definingDeclaration, NameGen nameGen)
2484 {
2485  return wrapFunction(definingDeclaration, nameGen(definingDeclaration.get_name()));
2486 }
2487 
2491 
2492 
2494 
2495 // DQ (6/7/2012): Unclear where this function should go...
2496  bool hasTemplateSyntax( const SgName & name );
2497 
2498 #if 0
2499 
2500 //------------------------AST dump, stringify-----------------------------
2501 //------------------------------------------------------------------------
2502  std::string buildOperatorString ( SgNode* astNode ); //transformationSupport.h
2503 
2504  // do we need these?
2505  std::string dump_node(const SgNode* astNode);
2506  std::string dump_tree(const SgNode* astNode);
2507 
2508  // or a friendly version of unparseToString(), as a memeber function
2509  std::string SgNode::toString(bool asSubTree=true); // dump node or subtree
2510 
2511 //----------------------------AST comparison------------------------------
2512 //------------------------------------------------------------------------
2513 // How to get generic functions for comparison?
2514  bool isNodeEqual(SgNode* node1, SgNode* node2); //?
2515  bool isTreeEqual(SgNode* tree1, SgNode* tree2);
2516 
2518  bool expressionTreeEqual(SgExpression*, SgExpression*);
2520  bool expressionTreeEqualStar(const SgExpressionPtrList&,
2521  const SgExpressionPtrList&);
2522 
2523 //----------------------AST verfication/repair----------------------------
2524 //------------------------------------------------------------------------
2525 // sanity check of AST subtree, any suggestions?
2526 // TODO
2527  verifySgNode(SgNode* node, bool subTree=true);
2528  //src/midend/astDiagnostics/AstConsistencyTests.h
2529  // AstTests::runAllTests(SgProject * )
2530 
2531  //src/midend/astUtil/astInterface/AstInterface.h.C
2532  //FixSgProject(SgProject &project)
2533  //FixSgTree(SgNode* r)
2534 
2535  //src/frontend/SageIII/astPostProcessing
2536  //AstPostProcessing(SgNode * node)
2537 
2538 //--------------------------AST modification------------------------------
2539 //------------------------------------------------------------------------
2540 // any operations changing AST tree, including
2541 // insert, copy, delete(remove), replace
2542 
2543  // insert before or after some point, argument list is consistent with LowLevelRewrite
2544  void insertAst(SgNode* targetPosition, SgNode* newNode, bool insertBefore=true);
2545 
2546  // previous examples
2547  //void myStatementInsert(SgStatement* target,...)
2548  // void AstInterfaceBase::InsertStmt(AstNodePtr const & orig, AstNodePtr const &n, bool insertbefore, bool extractfromBasicBlock)
2549 
2550  // copy
2551  // copy children of one basic block to another basic block
2552  //void appendStatementCopy (const SgBasicBlock* a, SgBasicBlock* b);
2553  void copyStatements (const SgBasicBlock* src, SgBasicBlock* dst);
2554 
2555  // delete (remove) a node or a whole subtree
2556  void removeSgNode(SgNode* targetNode); // need this?
2557  void removeSgNodeTree(SgNode* subtree); // need this?
2558 
2559  void removeStatement( SgStatement* targetStmt);
2560 
2561  //Move = delete + insert
2562  void moveAst (SgNode* src, SgNode* target); // need this?
2563  // similar to
2564  void moveStatements (SgBasicBlock* src, SgBasicBlock* target);
2565 
2566  // replace= delete old + insert new (via building or copying)
2567 
2568 // DQ (1/25/2010): This does not appear to exist as a definition anywhere in ROSE.
2569 // void replaceAst(SgNode* oldNode, SgNode* newNode);
2570 
2571  //void replaceChild(SgNode* parent, SgNode* from, SgNode* to);
2572  //bool AstInterface::ReplaceAst( const AstNodePtr& orig, const AstNodePtr& n)
2573 
2574 //--------------------------AST transformations---------------------------
2575 //------------------------------------------------------------------------
2576 // Advanced AST modifications through basic AST modifications
2577 // Might not be included in AST utitlity list, but listed here for the record.
2578 
2579  // extract statements/content from a scope
2580  void flattenBlocks(SgNode* n);
2581 
2582  //src/midend/astInlining/inlinerSupport.h
2583  void renameVariables(SgNode* n);
2584  void renameLabels(SgNode* n, SgFunctionDefinition* enclosingFunctionDefinition);
2585 
2586  void simpleCopyAndConstantPropagation(SgNode* top);
2587  void changeAllMembersToPublic(SgNode* n);
2588 
2589  void removeVariableDeclaration(SgInitializedName* initname);
2590 
2592  SgAssignOp* convertInitializerIntoAssignment(SgAssignInitializer* init);
2593 
2598  void pushTestIntoBody(LoopStatement* loopStmt);
2599 
2600  //programTransformation/finiteDifferencing/finiteDifferencing.h
2602  void moveForDeclaredVariables(SgNode* root);
2603 
2604 //------------------------ Is/Has functions ------------------------------
2605 //------------------------------------------------------------------------
2606 // misc. boolean functions
2607 // some of them could moved to SgXXX class as a member function
2608 
2609  bool isOverloaded (SgFunctionDeclaration * functionDeclaration);
2610 
2611  bool isSwitchCond (const SgStatement* s);
2612  bool isIfCond (const SgStatement* s);
2613  bool isWhileCond (const SgStatement* s);
2614  bool isStdNamespace (const SgScopeStatement* scope);
2615  bool isTemplateInst (const SgDeclarationStatement* decl);
2616 
2617 
2618  bool isCtor (const SgFunctionDeclaration* func);
2619  bool isDtor (const SgFunctionDeclaration* func);
2620 
2621  // src/midend/astInlining/typeTraits.h
2622  bool hasTrivialDestructor(SgType* t);
2623  ROSE_DLL_API bool isNonconstReference(SgType* t);
2624  ROSE_DLL_API bool isReferenceType(SgType* t);
2625 
2626  // generic ones, or move to the SgXXX class as a member function
2627 
2628  bool isConst(SgNode* node); // const type, variable, function, etc.
2629  // .... and more
2630 
2631  bool isConstType (const SgType* type);
2632  bool isConstFunction (const SgFunctionDeclaration* decl);
2633 
2634 
2635  bool isMemberVariable(const SgInitializedName & var);
2636  //bool isMemberVariable(const SgNode& in);
2637 
2638  bool isPrototypeInScope (SgScopeStatement * scope,
2639  SgFunctionDeclaration * functionDeclaration,
2640  SgDeclarationStatement * startingAtDeclaration);
2641 
2642  bool MayRedefined(SgExpression* expr, SgNode* root);
2643  // bool isPotentiallyModified(SgExpression* expr, SgNode* root); // inlinderSupport.h
2644  bool hasAddressTaken(SgExpression* expr, SgNode* root);
2645 
2646  //src/midend/astInlining/inlinerSupport.C
2647  // can also classified as topdown search
2648  bool containsVariableReference(SgNode* root, SgInitializedName* var);
2649 
2650  bool isDeclarationOf(SgVariableDeclaration* decl, SgInitializedName* var);
2651  bool isPotentiallyModifiedDuringLifeOf(SgBasicBlock* sc,
2652  SgInitializedName* toCheck,
2653  SgInitializedName* lifetime)
2654  //src/midend/programTransformation/partialRedundancyElimination/pre.h
2655  bool anyOfListPotentiallyModifiedIn(const std::vector<SgVariableSymbol*>& syms, SgNode* n);
2656 
2657 //------------------------ loop handling ---------------------------------
2658 //------------------------------------------------------------------------
2659  //get and set loop control expressions
2660  // 0: init expr, 1: condition expr, 2: stride expr
2661 
2662  SgExpression* getForLoopTripleValues(int valuetype,SgForStatement* forstmt );
2663  int setForLoopTripleValues(int valuetype,SgForStatement* forstmt, SgExpression* exp);
2664 
2665  bool isLoopIndexVarRef(SgForStatement* forstmt, SgVarRefExp *varref);
2666  SgInitializedName * getLoopIndexVar(SgForStatement* forstmt);
2667 
2668 //------------------------expressions-------------------------------------
2669 //------------------------------------------------------------------------
2670  //src/midend/programTransformation/partialRedundancyElimination/pre.h
2671  int countComputationsOfExpressionIn(SgExpression* expr, SgNode* root);
2672 
2673  //src/midend/astInlining/replaceExpressionWithStatement.h
2674  void replaceAssignmentStmtWithStatement(SgExprStatement* from, StatementGenerator* to);
2675 
2677  StatementGenerator* to);
2678  SgExpression* getRootOfExpression(SgExpression* n);
2679 
2680 //--------------------------preprocessing info. -------------------------
2681 //------------------------------------------------------------------------
2683  void cutPreprocInfo (SgBasicBlock* b,
2685  AttachedPreprocessingInfoType& save_buf);
2687  void pastePreprocInfoFront (AttachedPreprocessingInfoType& save_buf,
2688  SgStatement* s);
2690  void pastePreprocInfoBack (AttachedPreprocessingInfoType& save_buf,
2691  SgStatement* s);
2692 
2698  // a generic one for all
2700  void moveBeforePreprocInfo (SgStatement* src, SgStatement* dest);
2701  void moveInsidePreprocInfo (SgBasicBlock* src, SgBasicBlock* dest);
2702  void moveAfterPreprocInfo (SgStatement* src, SgStatement* dest);
2703 
2704 //--------------------------------operator--------------------------------
2705 //------------------------------------------------------------------------
2706  from transformationSupport.h, not sure if they should be included here
2707  /* return enum code for SAGE operators */
2708  operatorCodeType classifyOverloadedOperator(); // transformationSupport.h
2709 
2715  std::string stringifyOperator (std::string name);
2716 
2717 //--------------------------------macro ----------------------------------
2718 //------------------------------------------------------------------------
2719  std::string buildMacro ( std::string s ); //transformationSupport.h
2720 
2721 //--------------------------------access functions---------------------------
2722 //----------------------------------get/set sth.-----------------------------
2723 // several categories:
2724 * get/set a direct child/grandchild node or fields
2725 * get/set a property flag value
2726 * get a descendent child node using preorder searching
2727 * get an ancestor node using bottomup/reverse searching
2728 
2729  // SgName or string?
2730  std::string getFunctionName (SgFunctionCallExp* functionCallExp);
2731  std::string getFunctionTypeName ( SgFunctionCallExp* functionCallExpression );
2732 
2733  // do we need them anymore? or existing member functions are enought?
2734  // a generic one:
2735  std::string get_name (const SgNode* node);
2736  std::string get_name (const SgDeclarationStatement * declaration);
2737 
2738  // get/set some property: should moved to SgXXX as an inherent memeber function?
2739  // access modifier
2740  void setExtern (SgFunctionDeclartion*)
2741  void clearExtern()
2742 
2743  // similarly for other declarations and other properties
2745  void setPublic()
2746  void setPrivate()
2747 
2748 #endif
2749 
2750 // DQ (1/23/2013): Added support for generated a set of source sequence entries.
2751  std::set<unsigned int> collectSourceSequenceNumbers( SgNode* astNode );
2752 
2753 //--------------------------------Type Traits (C++)---------------------------
2754  bool HasNoThrowAssign(const SgType * const inputType);
2755  bool HasNoThrowCopy(const SgType * const inputType);
2756  bool HasNoThrowConstructor(const SgType * const inputType);
2757  bool HasTrivialAssign(const SgType * const inputType);
2758  bool HasTrivialCopy(const SgType * const inputType);
2759  bool HasTrivialConstructor(const SgType * const inputType);
2760  bool HasTrivialDestructor(const SgType * const inputType);
2761  bool HasVirtualDestructor(const SgType * const inputType);
2762  bool IsBaseOf(const SgType * const inputBaseType, const SgType * const inputDerivedType);
2763  bool IsAbstract(const SgType * const inputType);
2765  bool IsClass(const SgType * const inputType);
2766  bool IsEmpty(const SgType * const inputType);
2767  bool IsEnum(const SgType * const inputType);
2768  bool IsPod(const SgType * const inputType);
2769  bool IsPolymorphic(const SgType * const inputType);
2770  bool IsStandardLayout(const SgType * const inputType);
2771  bool IsLiteralType(const SgType * const inputType);
2772  bool IsTrivial(const SgType * const inputType);
2773  bool IsUnion(const SgType * const inputType);
2774  SgType * UnderlyingType(SgType *type);
2775 
2776 // DQ (3/2/2014): Added a new interface function (used in the snippet insertion support).
2777 // void supportForInitializedNameLists ( SgScopeStatement* scope, SgInitializedNamePtrList & variableList );
2778 
2779 // DQ (3/4/2014): Added support for testing two trees for equivalents using the AST iterators.
2780  bool isStructurallyEquivalentAST( SgNode* tree1, SgNode* tree2 );
2781 
2782 // JP (10/14/24): Moved code to evaluate a const integer expression (like in array size definitions) to SageInterface
2785  size_t value_;
2786  bool hasValue_;
2787  };
2790 
2791 // JP (9/17/14): Added function to test whether two SgType* are equivalent or not
2792  bool checkTypesAreEqual(SgType *typeA, SgType *typeB);
2793 
2794 
2795 // DQ (8/31/2016): Making this a template function so that we can have it work with user defined filters.
2797 
2803 template < class T >
2805  {
2806  // DQ (9/1/2016): This function is called in the Call graph generation to avoid filtering out EDG normalized
2807  // function template instnatiations (which come from normalized template functions and member functions).
2808  // Note that because of the EDG normailzation the membr function is moved outside of the class, and
2809  // thus marked as compiler generated. However the template instantiations are always marked as compiler
2810  // generated (if not specializations) and so we want to include a template instantiation that is marked
2811  // as compiler generated, but is from a template declaration that satisfyied a specific user defined filter.
2812  // The complexity of this detection is isolated here, but knowing that it must be called is more complex.
2813  // This function is call in the CG.C file of tests/nonsmoke/functional/roseTests/programAnalysisTests/testCallGraphAnalysis.
2814 
2815  bool retval = false;
2816 
2817 #define DEBUG_TEMPLATE_NORMALIZATION_DETECTION 0
2818 
2819 #if DEBUG_TEMPLATE_NORMALIZATION_DETECTION
2820  printf ("In isNormalizedTemplateInstantiation(): function = %p = %s = %s \n",function,function->class_name().c_str(),function->get_name().str());
2821 #endif
2822 
2823  // Test for this to be a template instantation (in which case it was marked as
2824  // compiler generated but we may want to allow it to be used in the call graph,
2825  // if it's template was a part was defined in the current directory).
2826  SgTemplateInstantiationFunctionDecl* templateInstantiationFunction = isSgTemplateInstantiationFunctionDecl(function);
2827  SgTemplateInstantiationMemberFunctionDecl* templateInstantiationMemberFunction = isSgTemplateInstantiationMemberFunctionDecl(function);
2828 
2829  if (templateInstantiationFunction != NULL)
2830  {
2831  // When the defining function has been normalized by EDG, only the non-defining declaration will have a source position.
2832  templateInstantiationFunction = isSgTemplateInstantiationFunctionDecl(templateInstantiationFunction->get_firstNondefiningDeclaration());
2833  SgTemplateFunctionDeclaration* templateFunctionDeclaration = templateInstantiationFunction->get_templateDeclaration();
2834  if (templateFunctionDeclaration != NULL)
2835  {
2836  retval = filter->operator()(templateFunctionDeclaration);
2837  }
2838  else
2839  {
2840  // Assume false.
2841  }
2842 
2843 #if DEBUG_TEMPLATE_NORMALIZATION_DETECTION
2844  printf (" --- case of templateInstantiationFunction: retval = %s \n",retval ? "true" : "false");
2845 #endif
2846  }
2847  else
2848  {
2849  if (templateInstantiationMemberFunction != NULL)
2850  {
2851  // When the defining function has been normalized by EDG, only the non-defining declaration will have a source position.
2852  templateInstantiationMemberFunction = isSgTemplateInstantiationMemberFunctionDecl(templateInstantiationMemberFunction->get_firstNondefiningDeclaration());
2853  SgTemplateMemberFunctionDeclaration* templateMemberFunctionDeclaration = templateInstantiationMemberFunction->get_templateDeclaration();
2854  if (templateMemberFunctionDeclaration != NULL)
2855  {
2856  retval = filter->operator()(templateMemberFunctionDeclaration);
2857  }
2858  else
2859  {
2860  // Assume false.
2861  }
2862 
2863 #if DEBUG_TEMPLATE_NORMALIZATION_DETECTION
2864  printf (" --- case of templateInstantiationMemberFunction: retval = %s \n",retval ? "true" : "false");
2865 #endif
2866  }
2867  }
2868 
2869  return retval;
2870  }
2871 
2872 void detectCycleInType(SgType * type, const std::string & from);
2873 
2874 // DQ (7/14/2020): Debugging support.
2875 void checkForInitializers( SgNode* node );
2876 
2877 void clearSharedGlobalScopes(SgProject * project);
2878 
2879 }// end of namespace
2880 
2881 #endif
2882 
SageInterface::getFunctionDeclaration
ROSE_DLL_API SgFunctionDeclaration * getFunctionDeclaration(SgFunctionCallExp *functionCallExp)
Find a node by type using upward traversal.
SgTemplateFunctionDeclaration
Definition: Cxx_Grammar.h:156666
SageInterface::isConstType
ROSE_DLL_API bool isConstType(SgType *t)
Is this a const type?
SageInterface::is_C99_language
ROSE_DLL_API bool is_C99_language()
Definition: sageInterface.h:653
SageInterface::attachComment
PreprocessingInfo * attachComment(SgSourceFile *source_file, const std::string &content, PreprocessingInfo::DirectiveType directive_type=PreprocessingInfo::C_StyleComment, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before)
Build and attach comment onto the global scope of a source file.
SageInterface::templateDefinitionIsInClass
ROSE_DLL_API bool templateDefinitionIsInClass(SgTemplateInstantiationMemberFunctionDecl *memberFunctionDeclaration)
Return true if template definition is in the class, false if outside of class.
SageInterface::getLiveVariables
ROSE_DLL_API void getLiveVariables(LivenessAnalysis *liv, SgForStatement *loop, std::set< SgInitializedName * > &liveIns, std::set< SgInitializedName * > &liveOuts)
get liveIn and liveOut variables for a for loop from liveness analysis result liv.
SgLocatedNode
This class represents the notion of an expression or statement which has a position within the source...
Definition: Cxx_Grammar.h:74391
SageInterface::getEnclosingClassDeclaration
ROSE_DLL_API SgClassDeclaration * getEnclosingClassDeclaration(SgNode *astNode)
Get the closest class declaration enclosing the specified AST node,.
SageInterface::lookupTemplateFunctionSymbolInParentScopes
ROSE_DLL_API SgFunctionSymbol * lookupTemplateFunctionSymbolInParentScopes(const SgName &functionName, SgFunctionType *ftype, SgTemplateParameterPtrList *tplparams, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::addMangledNameToCache
std::string addMangledNameToCache(SgNode *astNode, const std::string &mangledName)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::listHeaderFiles
void listHeaderFiles(SgIncludeFile *includeFile)
return path prefix for subtree of include files.
SgEnumSymbol
Definition: Cxx_Grammar.h:326958
SageInterface::evaluateConstIntegerExpression
struct const_int_expr_t evaluateConstIntegerExpression(SgExpression *expr)
The function tries to evaluate const integer expressions (such as are used in array dimension sizes)....
SageInterface::isAddressTaken
ROSE_DLL_API bool isAddressTaken(SgExpression *refExp)
Find a node by type using upward traversal.
SageInterface::is_Cuda_language
ROSE_DLL_API bool is_Cuda_language()
Definition: sageInterface.h:657
SageInterface::copyExpression
ROSE_DLL_API SgExpression * copyExpression(SgExpression *e)
Deep copy an expression.
SageInterface::OutputLocalSymbolTables
Definition: sageInterface.h:218
SageInterface::mangleScalarType
ROSE_DLL_API std::string mangleScalarType(SgType *type)
Generate mangled scalar type names according to Itanium C++ ABI, the input type should pass isScalarT...
SageInterface::generateUniqueName
std::string generateUniqueName(const SgNode *node, bool ignoreDifferenceBetweenDefiningAndNondefiningDeclarations)
Generate unique name from C and C++ constructs. The name may contain space.
SageInterface::reset_name_collision_map
void reset_name_collision_map()
Reset map variables used to support generateUniqueNameForUseAsIdentifier() function.
SageInterface::insertStatementListBeforeFirstNonDeclaration
ROSE_DLL_API void insertStatementListBeforeFirstNonDeclaration(const std::vector< SgStatement * > &newStmts, SgScopeStatement *scope)
Insert statements before the first non-declaration statement in a scope. If the scope has no non-decl...
SageInterface::translateToUseCppDeclarations
ROSE_DLL_API void translateToUseCppDeclarations(SgNode *n)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::printAST
void printAST(SgNode *node)
Pretty print AST horizontally, output to std output.
SageInterface::constantFolding
ROSE_DLL_API void constantFolding(SgNode *r)
Constant folding an AST subtree rooted at 'r' (replacing its children with their constant values,...
SageInterface::DeferredTransformation
Definition: sageInterface.h:1814
SageInterface::removeLabeledGotos
ROSE_DLL_API void removeLabeledGotos(SgNode *top)
Remove labeled goto statements.
SageInterface::isArrayReference
ROSE_DLL_API bool isArrayReference(SgExpression *ref, SgExpression **arrayNameExp=NULL, std::vector< SgExpression * > **subscripts=NULL)
Check if an expression is an array access (SgPntrArrRefExp). If so, return its name expression and su...
SgVariableSymbol
This class represents the concept of a variable name within the compiler (a shared container for the ...
Definition: Cxx_Grammar.h:321540
SageInterface::HasNoThrowConstructor
bool HasNoThrowConstructor(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::isInSubTree
ROSE_DLL_API bool isInSubTree(SgExpression *subtree, SgExpression *exp)
Find a node by type using upward traversal.
SageInterface::isEquivalentType
ROSE_DLL_API bool isEquivalentType(const SgType *lhs, const SgType *rhs)
Test for equivalence of types independent of access permissions (private or protected modes for membe...
SgNode::get_file_info
virtual Sg_File_Info * get_file_info(void) const
File information containing filename, line number, column number, and if the SgNode is a part of a ne...
Definition: Cxx_Grammar.h:7417
SageInterface::fixupReferencesToSymbols
void fixupReferencesToSymbols(const SgScopeStatement *this_scope, SgScopeStatement *copy_scope, SgCopyHelp &help)
All the symbol table references in the copied AST need to be reset after rebuilding the copied scope'...
SageInterface::isOmpStatement
ROSE_DLL_API bool isOmpStatement(SgNode *)
Check if a node is SgOmp*Statement.
SgFortranDo
Definition: Cxx_Grammar.h:132466
SageInterface::loopCollapsing
SgExprListExp * loopCollapsing(SgForStatement *target_loop, size_t collapsing_factor)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::getFirstVarSym
ROSE_DLL_API SgVariableSymbol * getFirstVarSym(SgVariableDeclaration *decl)
Get the variable symbol for the first initialized name of a declaration stmt.
SageInterface::setPragma
ROSE_DLL_API void setPragma(SgPragmaDeclaration *decl, SgPragma *pragma)
Set a pragma of a pragma declaration. handle memory release for preexisting pragma,...
SageInterface::getEnclosingStatement
ROSE_DLL_API SgStatement * getEnclosingStatement(SgNode *n)
Find the closest enclosing statement, including the given node.
SageInterface::is_mixed_Fortran_and_C_and_Cxx_language
ROSE_DLL_API bool is_mixed_Fortran_and_C_and_Cxx_language()
SageInterface::deepCopy
NodeType * deepCopy(const NodeType *subtree)
A template function for deep copying a subtree. It is also used to create deepcopy functions with spe...
Definition: sageInterface.h:523
SageInterface::prependArg
ROSE_DLL_API SgVariableSymbol * prependArg(SgFunctionParameterList *, SgInitializedName *)
Prepend an argument to SgFunctionParameterList.
SgCommaOpExp
Definition: Cxx_Grammar.h:248018
SageInterface::insertStatementList
ROSE_DLL_API void insertStatementList(SgStatement *targetStmt, const std::vector< SgStatement * > &newStmts, bool insertBefore=true)
Insert a list of statements before or after the target statement within the.
SageInterface::generateProjectName
ROSE_DLL_API std::string generateProjectName(const SgProject *project, bool supressSuffix=false)
Added mechanism to generate project name from list of file names.
SageInterface::ensureBasicBlockAsFalseBodyOfIf
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsFalseBodyOfIf(SgIfStmt *ifs, bool createEmptyBody=true)
Check if the false body of a 'if' statement is a SgBasicBlock, create one if not when the flag is tru...
SageInterface::createTempVariableAndReferenceForExpression
std::pair< SgVariableDeclaration *, SgExpression * > createTempVariableAndReferenceForExpression(SgExpression *expression, SgScopeStatement *scope)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::insertStatementBeforeFirstNonDeclaration
ROSE_DLL_API void insertStatementBeforeFirstNonDeclaration(SgStatement *newStmt, SgScopeStatement *scope, bool movePreprocessingInfo=true)
Insert a statement before the first non-declaration statement in a scope. If the scope has no non-dec...
SgNamespaceDeclarationStatement
This class represents the concept of a C++ namespace declaration.
Definition: Cxx_Grammar.h:145393
SageInterface::hasMultipleInitStatmentsOrExpressions
ROSE_DLL_API bool hasMultipleInitStatmentsOrExpressions(SgForStatement *for_loop)
Check if a for loop uses C99 style initialization statement with multiple expressions like for (int i...
SageInterface::mergeDeclarationAndAssignment
ROSE_DLL_API bool mergeDeclarationAndAssignment(SgVariableDeclaration *decl, SgExprStatement *assign_stmt, bool removeAssignStmt=true)
Merge a variable assignment statement into a matching variable declaration statement....
SgFunctionType
This class represents a type for all functions.
Definition: Cxx_Grammar.h:62210
SageInterface::insertStatementBefore
ROSE_DLL_API void insertStatementBefore(SgStatement *targetStmt, SgStatement *newStmt, bool autoMovePreprocessingInfo=true)
Insert a statement before a target statement.
SageInterface::hasTrivialDestructor
ROSE_DLL_API bool hasTrivialDestructor(SgType *t)
Does a type have a trivial (built-in) destructor?
SageInterface::getEnclosingFunctionDefinition
ROSE_DLL_API SgFunctionDefinition * getEnclosingFunctionDefinition(SgNode *astNode, const bool includingSelf=false)
Find a node by type using upward traversal.
SageInterface::removeConst
SgType * removeConst(SgType *t)
Remove const (if present) from a type. stripType() cannot do this because it removes all modifiers.
SageInterface::collectReadOnlyVariables
ROSE_DLL_API void collectReadOnlyVariables(SgStatement *stmt, std::set< SgInitializedName * > &readOnlyVars, bool coarseGrain=true)
Collect read only variables within a statement. The statement can be either of a function,...
SgCaseOptionStmt
This class represents the concept of a C and C++ case option (used within a switch statement).
Definition: Cxx_Grammar.h:174649
SageInterface::printAST2TextFile
void printAST2TextFile(SgNode *node, const char *filename, bool printType=true)
Pretty print AST horizontally, output to a specified text file. If printType is set to false,...
SageInterface::dumpInfo
ROSE_DLL_API void dumpInfo(SgNode *node, std::string desc="")
Dump information about a SgNode for debugging.
SageInterface::insertStatementListBefore
ROSE_DLL_API void insertStatementListBefore(SgStatement *targetStmt, const std::vector< SgStatement * > &newStmts)
Insert a list of statements before a target statement.
SageInterface::addTextForUnparser
ROSE_DLL_API void addTextForUnparser(SgNode *astNode, std::string s, AstUnparseAttribute::RelativePositionType inputlocation)
Add a string to be unparsed to support code generation for back-end specific tools or compilers.
SageInterface::deepCopyNode
ROSE_DLL_API SgNode * deepCopyNode(const SgNode *subtree)
Deep copy an arbitrary subtree.
SageInterface::clearScopeNumbers
void clearScopeNumbers(SgFunctionDefinition *functionDefinition)
Clears the cache of scope,integer pairs for the input function.
SageInterface::outputLocalSymbolTables
ROSE_DLL_API void outputLocalSymbolTables(SgNode *node)
Output the local symbol tables.
SageInterface::getArrayElementType
ROSE_DLL_API SgType * getArrayElementType(SgType *t)
Get the element type of an array. It recursively find the base type for multi-dimension array types.
SageInterface::HasVirtualDestructor
bool HasVirtualDestructor(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::isUpcStrictSharedModifierType
ROSE_DLL_API bool isUpcStrictSharedModifierType(SgModifierType *mode_type)
Check if a shared UPC type is strict memory consistency or not. Return false if it is relaxed....
SageInterface::HasTrivialCopy
bool HasTrivialCopy(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::addStepToLoopBody
ROSE_DLL_API void addStepToLoopBody(SgScopeStatement *loopStmt, SgStatement *step)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::isUpcPhaseLessSharedType
ROSE_DLL_API bool isUpcPhaseLessSharedType(SgType *t)
Is UPC phase-less shared type? Phase-less means block size of the first SgModifierType with UPC infor...
SgIfStmt
This class represents the concept of an "if" construct.
Definition: Cxx_Grammar.h:125431
SageInterface::moveToSubdirectory
ROSE_DLL_API void moveToSubdirectory(std::string directoryName, SgFile *file)
Move file to be generated in a subdirectory (will be generated by the unparser).
SageInterface::printOutComments
ROSE_DLL_API void printOutComments(SgLocatedNode *locatedNode)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::HasTrivialAssign
bool HasTrivialAssign(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::findFirstDefiningFunctionDecl
ROSE_DLL_API SgFunctionDeclaration * findFirstDefiningFunctionDecl(SgScopeStatement *scope)
Find the first defining function declaration statement in a scope.
SgClassDefinition
This class represents the concept of a class definition in C++.
Definition: Cxx_Grammar.h:127505
SageInterface::setLhsOperand
ROSE_DLL_API void setLhsOperand(SgExpression *target, SgExpression *lhs)
set left hand operand for binary expressions, transparently downcasting target expressions when neces...
SageInterface::lookupTemplateClassSymbolInParentScopes
ROSE_DLL_API SgTemplateClassSymbol * lookupTemplateClassSymbolInParentScopes(const SgName &name, SgTemplateParameterPtrList *templateParameterList, SgTemplateArgumentPtrList *templateArgumentList, SgScopeStatement *cscope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::setSourcePositionPointersToNull
void setSourcePositionPointersToNull(SgNode *node)
Set the source code positon for the current (input) node.
SageInterface::setSourcePositionAtRootAndAllChildren
ROSE_DLL_API void setSourcePositionAtRootAndAllChildren(SgNode *root)
Set the source code positon for the subtree (including the root).
SgDefaultOptionStmt
This class represents the concept of a C or C++ default case within a switch statement.
Definition: Cxx_Grammar.h:175666
SageInterface::fixStatement
ROSE_DLL_API void fixStatement(SgStatement *stmt, SgScopeStatement *scope)
A wrapper containing fixes (fixVariableDeclaration(),fixStructDeclaration(), fixLabelStatement(),...
SageInterface::initializeIfStmt
void initializeIfStmt(SgIfStmt *ifstmt, SgStatement *conditional, SgStatement *true_body, SgStatement *false_body)
Support function used for variable declarations in conditionals.
SgGlobal
This class represents the concept of a namespace definition.
Definition: Cxx_Grammar.h:124392
SageInterface::resetModifiedLocatedNodes
ROSE_DLL_API void resetModifiedLocatedNodes(const std::set< SgLocatedNode * > &modifiedNodeSet)
Use the set of IR nodes and set the isModified flag in each IR node to true.
SgDoWhileStmt
This class represents the concept of a do-while statement.
Definition: Cxx_Grammar.h:129505
SageInterface::extractPragmaKeyword
std::string extractPragmaKeyword(const SgPragmaDeclaration *)
Extract a SgPragmaDeclaration's leading keyword . For example "#pragma omp parallel" has a keyword of...
SageInterface::deleteExpressionTreeWithOriginalExpressionSubtrees
ROSE_DLL_API void deleteExpressionTreeWithOriginalExpressionSubtrees(SgNode *root)
Special purpose function for deleting AST expression tress containing valid original expression trees...
SageInterface::insertStatementAfter
ROSE_DLL_API void insertStatementAfter(SgStatement *targetStmt, SgStatement *newStmt, bool autoMovePreprocessingInfo=true)
Insert a statement after a target statement, Move around preprocessing info automatically by default.
SageInterface::insertStatementListAfter
ROSE_DLL_API void insertStatementListAfter(SgStatement *targetStmt, const std::vector< SgStatement * > &newStmt)
Insert a list of statements after a target statement.
SageInterface::HasTrivialDestructor
bool HasTrivialDestructor(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SgUpirBodyStatement
Definition: Cxx_Grammar.h:194181
SageInterface::ensureBasicBlockAsBodyOfSwitch
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfSwitch(SgSwitchStatement *ws)
Check if the body of a 'switch' statement is a SgBasicBlock, create one if not.
SageInterface::isTemplateInstantiationFromTemplateDeclarationSatisfyingFilter
bool isTemplateInstantiationFromTemplateDeclarationSatisfyingFilter(SgFunctionDeclaration *function, T *filter)
This function detects template instantiations that are relevant when filters are used.
Definition: sageInterface.h:2804
SageInterface::removeUnusedLabels
ROSE_DLL_API void removeUnusedLabels(SgNode *top, bool keepChild=false)
Remove labels which are not targets of any goto statements: its child statement is also removed by de...
SageInterface::setSourcePositionForTransformation
ROSE_DLL_API void setSourcePositionForTransformation(SgNode *root)
Recursively set source position info(Sg_File_Info) as transformation generated.
SageInterface::generateUniqueNameForUseAsIdentifier_support
std::string generateUniqueNameForUseAsIdentifier_support(SgDeclarationStatement *declaration)
Global map of name collisions to support generateUniqueNameForUseAsIdentifier() function.
SgClassDeclaration
This class represents the concept of a class declaration statement. It includes the concept of an ins...
Definition: Cxx_Grammar.h:151319
SgForStatement
This class represents the concept of a for loop.
Definition: Cxx_Grammar.h:125996
SageInterface::isOverloaded
bool isOverloaded(SgFunctionDeclaration *functionDeclaration)
Return true if function is overloaded.
SgNonrealSymbol
Definition: Cxx_Grammar.h:322438
SageInterface::cutPreprocessingInfo
ROSE_DLL_API void cutPreprocessingInfo(SgLocatedNode *src_node, PreprocessingInfo::RelativePositionType pos, AttachedPreprocessingInfoType &save_buf)
Cut preprocessing information from a source node and save it into a buffer. Used in combination of pa...
SageInterface::guardNode
void guardNode(SgLocatedNode *target, std::string guard)
Add preproccessor guard around a given node.
SageInterface::isCopyConstructible
ROSE_DLL_API bool isCopyConstructible(SgType *type)
Is a type copy constructible? This may not quite work properly.
SageInterface::isStructType
ROSE_DLL_API bool isStructType(SgType *t)
Check if a type is a struct type (a special SgClassType in ROSE). Typedef and modifier types are not ...
SageInterface::isPrefixOperator
bool isPrefixOperator(SgExpression *exp)
Is an overloaded operator a prefix operator (e.g. address operator X * operator&(),...
SageInterface::ensureBasicBlockAsBodyOfOmpBodyStmt
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfOmpBodyStmt(SgUpirBodyStatement *ompbodyStmt)
Check if the body of a SgUpirBodyStatement is a SgBasicBlock, create one if not.
ROSE_VisitTraversal
Definition: Cxx_Grammar.h:6673
AstAttribute
Base class for all IR node attribute values.
Definition: AstAttributeMechanism.h:35
SageInterface::isUpcSharedModifierType
ROSE_DLL_API bool isUpcSharedModifierType(SgModifierType *mod_type)
Check if a modifier type is a UPC shared type.
SageInterface::getIntegerConstantValue
unsigned long long getIntegerConstantValue(SgValueExp *expr)
Get the constant value from a constant integer expression; abort on everything else.
SageInterface::getDeclaredType
SgType * getDeclaredType(const SgDeclarationStatement *declaration)
Returns the type introduced by a declaration.
SageInterface::isConstantTrue
ROSE_DLL_API bool isConstantTrue(SgExpression *e)
Check if a bool or int constant expression evaluates to be a true value.
SgVarRefExp
This class represents the variable refernece in expressions.
Definition: Cxx_Grammar.h:272706
SgAssignInitializer
This class represents the rhs of a variable declaration which includes an optional assignment (e....
Definition: Cxx_Grammar.h:296780
SgNode::get_traversalSuccessorContainer
virtual std::vector< SgNode * > get_traversalSuccessorContainer()
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
SgExprListExp
This class represents the concept of a C and C++ expression list.
Definition: Cxx_Grammar.h:270871
SageInterface::isStatic
bool ROSE_DLL_API isStatic(SgDeclarationStatement *stmt)
Check if a declaration has a "static' modifier.
SageInterface::get_name
std::string get_name(const SgNode *node)
Generate a useful name to describe the SgNode.
SageInterface::ensureBasicBlockAsBodyOfDefaultOption
SgBasicBlock * ensureBasicBlockAsBodyOfDefaultOption(SgDefaultOptionStmt *cs)
Check if the body of a 'default option' statement is a SgBasicBlock, create one if not.
SageInterface::is_OpenMP_language
ROSE_DLL_API bool is_OpenMP_language()
Definition: sageInterface.h:650
SgNamespaceSymbol
This class represents the concept of a namespace name within the compiler.
Definition: Cxx_Grammar.h:329715
SgFile
This class represents a source file for a project (which may contian many source files and or directo...
Definition: Cxx_Grammar.h:21163
SageInterface::getInitializerOfExpression
ROSE_DLL_API SgInitializer * getInitializerOfExpression(SgExpression *n)
Get the initializer containing an expression if it is within an initializer.
SgCopyHelp
Supporting class from copy mechanism within ROSE.
Definition: Cxx_Grammar.h:6496
SageInterface::fixTemplateDeclaration
ROSE_DLL_API void fixTemplateDeclaration(SgTemplateDeclaration *stmt, SgScopeStatement *scope)
Fix the symbol table and set scope (only if scope in declaration is not already set).
SageInterface::setLoopCondition
ROSE_DLL_API void setLoopCondition(SgScopeStatement *loop, SgStatement *cond)
Set the condition statement of a loop, including While-loop, For-loop, and Do-While-loop.
SageInterface::getMangledNameFromCache
std::string getMangledNameFromCache(SgNode *astNode)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SgDeclarationStatement::get_definingDeclaration
SgDeclarationStatement * get_definingDeclaration() const
This is an access function for the SgDeclarationStatement::p_definingDeclaration data member (see tha...
SageInterface::getFrontendSpecificNodes
ROSE_DLL_API std::set< SgNode * > getFrontendSpecificNodes()
Find a node by type using upward traversal.
SageInterface::isEquivalentFunctionType
ROSE_DLL_API bool isEquivalentFunctionType(const SgFunctionType *lhs, const SgFunctionType *rhs)
Test if two types are equivalent SgFunctionType nodes.
SageInterface::isUpcArrayWithThreads
ROSE_DLL_API bool isUpcArrayWithThreads(SgArrayType *t)
Is a UPC array with dimension of X*THREADS.
SageInterface::ensureBasicBlockAsTrueBodyOfIf
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsTrueBodyOfIf(SgIfStmt *ifs)
Check if the true body of a 'if' statement is a SgBasicBlock, create one if not.
SageInterface::normalizeForLoopTest
ROSE_DLL_API bool normalizeForLoopTest(SgForStatement *loop)
Normalize a for loop's test expression i<x is normalized to i<= (x-1) and i>x is normalized to i>= (x...
SageInterface::is_UPC_language
ROSE_DLL_API bool is_UPC_language()
Definition: sageInterface.h:651
SgLocatedNodeSupport
Definition: Cxx_Grammar.h:75965
SageInterface::findBreakStmts
std::vector< SgBreakStmt * > findBreakStmts(SgStatement *code, const std::string &fortranLabel="")
Find break statements inside a particular statement, stopping at nested loops or switches.
SageInterface::checkTypesAreEqual
bool checkTypesAreEqual(SgType *typeA, SgType *typeB)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SgTemplateInstantiationFunctionDecl::get_templateDeclaration
SgTemplateFunctionDeclaration * get_templateDeclaration() const
Returns pointer to SgTemplateDeclaration from which instantiation is generated.
SageInterface::findFunctionDeclaration
SgFunctionDeclaration * findFunctionDeclaration(SgNode *root, std::string name, SgScopeStatement *scope, bool isDefining)
Topdown traverse a subtree from root to find the first function declaration matching the given name,...
SageInterface::is_language_case_insensitive
ROSE_DLL_API bool is_language_case_insensitive()
SageInterface::const_int_expr_t
Definition: sageInterface.h:2784
SgType
This class represents the base class for all types.
Definition: Cxx_Grammar.h:43961
SgPragma
Definition: Cxx_Grammar.h:18449
SageInterface::forallMaskExpression
SgExpression * forallMaskExpression(SgForAllStatement *stmt)
Get the mask expression from the header of a SgForAllStatement.
SgIncludeFile
Definition: Cxx_Grammar.h:42371
SageInterface::isBodyStatement
bool isBodyStatement(SgStatement *s)
Check if a statement is a (true or false) body of a container-like parent, such as For,...
SageInterface::findDeclarationStatement
T * findDeclarationStatement(SgNode *root, std::string name, SgScopeStatement *scope, bool isDefining)
Topdown traverse a subtree from root to find the first declaration given its name,...
Definition: sageInterface.h:1312
SgTemplateInstantiationMemberFunctionDecl::get_templateDeclaration
SgTemplateMemberFunctionDeclaration * get_templateDeclaration() const
Returns pointer to SgTemplateDeclaration from which instantiation is generated.
SageInterface::replaceExpressionWithStatement
ROSE_DLL_API void replaceExpressionWithStatement(SgExpression *from, SageInterface::StatementGenerator *to)
Replace a given expression with a list of statements produced by a generator.
SgFunctionCallExp
This class represents the concept of a C++ function call (which is an expression).
Definition: Cxx_Grammar.h:288304
SgAssignOp
Definition: Cxx_Grammar.h:250282
SageInterface::changeAllBodiesToBlocks
void changeAllBodiesToBlocks(SgNode *top, bool createEmptyBody=true)
Fix up ifs, loops, while, switch, Catch, UpirBodyStatement, etc. to have blocks as body components....
SageInterface::instrumentEndOfFunction
ROSE_DLL_API int instrumentEndOfFunction(SgFunctionDeclaration *func, SgStatement *s)
Instrument(Add a statement, often a function call) into a function right before the return points,...
SgWhileStmt
This class represents the concept of a do-while statement.
Definition: Cxx_Grammar.h:128984
SgSupport
This class represents the base class of a numbr of IR nodes that don't otherwise fit into the existin...
Definition: Cxx_Grammar.h:7690
SageInterface::isLoopIndexVariable
ROSE_DLL_API bool isLoopIndexVariable(SgInitializedName *ivar, SgNode *subtree_root)
Check if a SgInitializedName is used as a loop index within a AST subtree This function will use a bo...
SageInterface::isUseByAddressVariableRef
ROSE_DLL_API bool isUseByAddressVariableRef(SgVarRefExp *ref)
Check if a variable reference is used by its address: including &a expression and foo(a) when type2 f...
SgMemberFunctionRefExp
This class represents the member function being called and must be assembled in the SgFunctionCall wi...
Definition: Cxx_Grammar.h:274179
SageInterface::getDefaultConstructor
ROSE_DLL_API SgMemberFunctionDeclaration * getDefaultConstructor(SgClassDeclaration *classDeclaration)
Get the default constructor from the class declaration.
SageInterface::getFirstVarType
ROSE_DLL_API SgType * getFirstVarType(SgVariableDeclaration *decl)
Get the data type of the first initialized name of a declaration statement.
SgSwitchStatement
This class represents the concept of a switch.
Definition: Cxx_Grammar.h:129987
SageInterface::generateUniqueVariableName
std::string generateUniqueVariableName(SgScopeStatement *scope, std::string baseName="temp")
Generate a name like temp# that is unique in the current scope and any parent and children scopes.
SageInterface::DeclarationSets
Definition: sageInterface.h:80
SageInterface::isMemberFunctionMemberReference
ROSE_DLL_API bool isMemberFunctionMemberReference(SgMemberFunctionRefExp *memberFunctionRefExp)
Find a node by type using upward traversal.
SageInterface::getDefaultDestructor
ROSE_DLL_API SgMemberFunctionDeclaration * getDefaultDestructor(SgClassDeclaration *classDeclaration)
Get the default destructor from the class declaration.
SageInterface::replaceExpression
ROSE_DLL_API void replaceExpression(SgExpression *oldExp, SgExpression *newExp, bool keepOldExp=false)
Replace an expression with another, used for variable reference substitution and others....
SgNode::class_name
virtual std::string class_name() const
returns a string representing the class name
SageInterface::markNodeToBeUnparsed
void markNodeToBeUnparsed(SgNode *node, int physical_file_id)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::getDimensionCount
ROSE_DLL_API int getDimensionCount(SgType *t)
Get the number of dimensions of an array type.
SageInterface::isUpcSharedArrayType
ROSE_DLL_API bool isUpcSharedArrayType(SgArrayType *array_type)
Check if an array type is a UPC shared type. ROSE AST represents a UPC shared array as regular array ...
SageInterface::getNonInstantiatonDeclarationForClass
SgDeclarationStatement * getNonInstantiatonDeclarationForClass(SgTemplateInstantiationMemberFunctionDecl *memberFunctionInstantiation)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SgTemplateVariableSymbol
Definition: Cxx_Grammar.h:321993
SageInterface::saveToPDF
void saveToPDF(SgNode *node, std::string filename)
Save AST into a pdf file. Start from a node to find its enclosing file node. The entire file's AST wi...
SageInterface::makeSingleStatementBodyToBlock
SgBasicBlock * makeSingleStatementBodyToBlock(SgStatement *singleStmt)
Make a single statement body to be a basic block. Its parent is if, while, catch, or upc_forall etc.
SageInterface::loopInterchange
ROSE_DLL_API bool loopInterchange(SgForStatement *loop, size_t depth, size_t lexicoOrder)
Interchange/permutate a n-level perfectly-nested loop rooted at 'loop' using a lexicographical order ...
SageInterface::moveStatementsBetweenBlocks
ROSE_DLL_API void moveStatementsBetweenBlocks(SgBasicBlock *sourceBlock, SgBasicBlock *targetBlock)
Move statements in first block to the second block (preserves order and rebuilds the symbol table).
SageInterface::isExtern
ROSE_DLL_API bool isExtern(SgDeclarationStatement *stmt)
Check if a declaration has an "extern" modifier.
SageInterface::appendExpressionList
ROSE_DLL_API void appendExpressionList(SgExprListExp *, const std::vector< SgExpression * > &)
Append an expression list to a SgExprListExp, set the parent pointers also.
SageInterface::moveUpPreprocessingInfo
ROSE_DLL_API void moveUpPreprocessingInfo(SgStatement *stmt_dst, SgStatement *stmt_src, PreprocessingInfo::RelativePositionType src_position=PreprocessingInfo::undef, PreprocessingInfo::RelativePositionType dst_position=PreprocessingInfo::undef, bool usePrepend=false)
Identical to movePreprocessingInfo(), except for the stale name and confusing order of parameters....
Sg_File_Info::TRANSFORMATION_FILE_ID
@ TRANSFORMATION_FILE_ID
Definition: Cxx_Grammar.h:20642
SageInterface::convertRefToInitializedName
ROSE_DLL_API SgInitializedName * convertRefToInitializedName(SgNode *current, bool coarseGrain=true)
Variable references can be introduced by SgVarRef, SgPntrArrRefExp, SgInitializedName,...
SgBasicBlock
This class represents the concept of a block (not a basic block from control flow analysis).
Definition: Cxx_Grammar.h:124904
SageInterface::set_name
ROSE_DLL_API int set_name(SgInitializedName *initializedNameNode, SgName new_name)
set_name of symbol in symbol table.
SageInterface::doLoopNormalization
ROSE_DLL_API bool doLoopNormalization(SgFortranDo *loop)
Normalize a Fortran Do loop. Make the default increment expression (1) explicit.
SageInterface::setSourcePositionAsTransformation
void setSourcePositionAsTransformation(SgNode *node)
DQ (5/1/2012): New function with improved name.
SageInterface::is_UPC_dynamic_threads
ROSE_DLL_API bool is_UPC_dynamic_threads()
Definition: sageInterface.h:652
SageInterface::getLoopBody
ROSE_DLL_API SgStatement * getLoopBody(SgScopeStatement *loop)
Routines to get and set the body of a loop.
SageInterface::checkSymbolTables
void checkSymbolTables(SgNode *)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::findMain
ROSE_DLL_API SgFunctionDeclaration * findMain(SgNode *currentNode)
top-down traversal from current node to find the main() function declaration
SgTemplateFunctionSymbol
Definition: Cxx_Grammar.h:324246
SgSymbol::get_name
virtual SgName get_name() const =0
Access function for getting name from declarations or types internally.
SageInterface::isPointerType
ROSE_DLL_API bool isPointerType(SgType *t)
Is this type a pointer type? (Handles typedefs correctly)
SageInterface::getPreviousStatement
ROSE_DLL_API SgStatement * getPreviousStatement(SgStatement *currentStmt, bool climbOutScope=true)
Get previous statement of the current statement. It may return a previous statement of a parent scope...
SageInterface::isPureVirtualClass
ROSE_DLL_API bool isPureVirtualClass(SgType *type, const ClassHierarchyWrapper &classHierarchy)
Check if a class type is a pure virtual class.
SageInterface::hasSameGlobalScope
ROSE_DLL_API bool hasSameGlobalScope(SgStatement *statement_1, SgStatement *statement_2)
This is supporting the recognition of functions in header files from two different ASTs.
SageInterface::ReductionRecognition
ROSE_DLL_API void ReductionRecognition(SgForStatement *loop, std::set< std::pair< SgInitializedName *, OmpSupport::omp_construct_enum > > &results)
Recognize and collect reduction variables and operations within a C/C++ loop, following OpenMP 3....
SageInterface::HasNoThrowAssign
bool HasNoThrowAssign(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SgFunctionParameterList::get_args
const SgInitializedNamePtrList & get_args() const
Access function for p_args.
SageInterface::changeBreakStatementsToGotos
ROSE_DLL_API void changeBreakStatementsToGotos(SgStatement *loopOrSwitch)
If the given statement contains any break statements in its body, add a new label below the statement...
SageInterface::DeferredTransformation::~DeferredTransformation
ROSE_DLL_API ~DeferredTransformation(void)
Copy constructor.
SageInterface::DeferredTransformation::replaceDefiningFunctionDeclarationWithFunctionPrototype
static ROSE_DLL_API DeferredTransformation replaceDefiningFunctionDeclarationWithFunctionPrototype(SgFunctionDeclaration *functionDeclaration)
operator=()
SageInterface::reportModifiedStatements
ROSE_DLL_API void reportModifiedStatements(const std::string &label, SgNode *node)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::isAssignmentStatement
bool isAssignmentStatement(SgNode *_s, SgExpression **lhs=NULL, SgExpression **rhs=NULL, bool *readlhs=NULL)
Check if a SgNode _s is an assignment statement (any of =,+=,-=,&=,/=, ^=, etc)
SageInterface::insertAfterUsingCommaOp
SgCommaOpExp * insertAfterUsingCommaOp(SgExpression *new_exp, SgExpression *anchor_exp, SgStatement **temp_decl=NULL, SgVarRefExp **temp_ref=NULL)
Insert an expression (new_exp ) after another expression (anchor_exp) has possible side effects,...
SgFunctionParameterTypeList
Definition: Cxx_Grammar.h:31632
SgMemberFunctionDeclaration
This class represents the concept of a member function declaration statement.
Definition: Cxx_Grammar.h:157151
SageInterface::is_mixed_Fortran_and_Cxx_language
ROSE_DLL_API bool is_mixed_Fortran_and_Cxx_language()
SageInterface::StatementGenerator
Interface for creating a statement whose computation writes its answer into a given variable.
Definition: sageInterface.h:575
SageInterface::getSymbolsUsedInExpression
std::vector< SgVariableSymbol * > getSymbolsUsedInExpression(SgExpression *expr)
Find referenced symbols within an expression.
SgFunctionDeclaration
This class represents the concept of a function declaration statement.
Definition: Cxx_Grammar.h:155826
SageInterface::lookupSymbolInParentScopesIgnoringAliasSymbols
ROSE_DLL_API SgSymbol * lookupSymbolInParentScopesIgnoringAliasSymbols(const SgName &name, SgScopeStatement *currentScope=NULL, SgTemplateParameterPtrList *templateParameterList=NULL, SgTemplateArgumentPtrList *templateArgumentList=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::collectVariableReferencesInArrayTypes
ROSE_DLL_API int collectVariableReferencesInArrayTypes(SgLocatedNode *root, Rose_STL_Container< SgNode * > &currentVarRefList)
Collect variable references in array types. The default NodeQuery::querySubTree() will miss variables...
SageInterface::insertBeforeUsingCommaOp
SgCommaOpExp * insertBeforeUsingCommaOp(SgExpression *new_exp, SgExpression *anchor_exp)
Insert an expression (new_exp )before another expression (anchor_exp) has possible side effects,...
SageInterface::markSubtreeToBeUnparsed
void markSubtreeToBeUnparsed(SgNode *root, int physical_file_id)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::setLoopBody
ROSE_DLL_API void setLoopBody(SgScopeStatement *loop, SgStatement *body)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::getBoolType
SgType * getBoolType(SgNode *n)
Get the right bool type according to C or C++ language input.
SageInterface::getDependentDeclarations
std::vector< SgDeclarationStatement * > getDependentDeclarations(SgStatement *stmt)
Get a statement's dependent declarations which declares the types used in the statement....
SageInterface::convertFunctionDefinitionsToFunctionPrototypes
ROSE_DLL_API void convertFunctionDefinitionsToFunctionPrototypes(SgNode *node)
XXX This function operates on the new file used to support outlined function definitions....
SageInterface::fixStructDeclaration
ROSE_DLL_API void fixStructDeclaration(SgClassDeclaration *structDecl, SgScopeStatement *scope)
Fix symbols, parent and scope pointers. Used internally within appendStatment(), insertStatement() et...
SageInterface::collectTransformedStatements
ROSE_DLL_API std::set< SgStatement * > collectTransformedStatements(SgNode *node)
This collects the statements that are marked as transformed (useful in debugging).
SageInterface::getEnclosingSourceFile
ROSE_DLL_API SgSourceFile * getEnclosingSourceFile(SgNode *n, const bool includingSelf=false)
Find enclosing source file node.
SageInterface::setExtern
ROSE_DLL_API void setExtern(SgDeclarationStatement *stmt)
Set a declaration as extern.
SageInterface::collectReadOnlySymbols
ROSE_DLL_API void collectReadOnlySymbols(SgStatement *stmt, std::set< SgVariableSymbol * > &readOnlySymbols, bool coarseGrain=true)
Collect read only variable symbols within a statement. The statement can be either of a function,...
SgTypedefSymbol
Definition: Cxx_Grammar.h:327864
SageInterface::getEnclosingClassDefinition
ROSE_DLL_API SgClassDefinition * getEnclosingClassDefinition(SgNode *astnode, const bool includingSelf=false)
Get the closest class definition enclosing the specified AST node,.
Rose::is_C_language
bool is_C_language
Definition: sageInterface.h:649
SageInterface::findHeader
ROSE_DLL_API PreprocessingInfo * findHeader(SgSourceFile *source_file, const std::string &header_file_name, bool isSystemHeader)
Find the preprocessingInfo node representing #include <header.h> or #include "header....
SageInterface::lookupNonrealSymbolInParentScopes
ROSE_DLL_API SgNonrealSymbol * lookupNonrealSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL, SgTemplateParameterPtrList *templateParameterList=NULL, SgTemplateArgumentPtrList *templateArgumentList=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SgUpirFieldBodyStatement
Definition: Cxx_Grammar.h:195949
SageInterface::isStructurallyEquivalentAST
bool isStructurallyEquivalentAST(SgNode *tree1, SgNode *tree2)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::outputGlobalFunctionTypeSymbolTable
void outputGlobalFunctionTypeSymbolTable()
Output function type symbols in global function type symbol table.
SageInterface::insideSystemHeader
ROSE_DLL_API bool insideSystemHeader(SgLocatedNode *node)
Set source position info(Sg_File_Info) as transformation generated for all SgNodes in memory pool.
SageInterface::isLastStatement
ROSE_DLL_API bool isLastStatement(SgStatement *stmt)
Check if a statement is the last statement within its closed scope.
SageInterface::querySubTree
std::vector< NodeType * > querySubTree(SgNode *top, VariantT variant=(VariantT) NodeType::static_variant)
Query a subtree to get all nodes of a given type, with an appropriate downcast.
Definition: sageInterface.h:1208
SageInterface::mergeAssignmentWithDeclaration
ROSE_DLL_API bool mergeAssignmentWithDeclaration(SgExprStatement *assign_stmt, SgVariableDeclaration *decl, bool removeAssignStmt=true)
Merge an assignment into its upstream declaration statement. Callers should make sure the merge is se...
SageInterface::isMain
ROSE_DLL_API bool isMain(const SgNode *node)
Check if a SgNode is a main() function declaration.
SageInterface::ensureBasicBlockAsBodyOfWhile
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfWhile(SgWhileStmt *ws)
Check if the body of a 'while' statement is a SgBasicBlock, create one if not.
SageInterface::getSwitchCases
std::vector< SgStatement * > getSwitchCases(SgSwitchStatement *sw)
Query a subtree to get all nodes of a given type, with an appropriate downcast.
SageInterface::unnormalizeForLoopInitDeclaration
ROSE_DLL_API bool unnormalizeForLoopInitDeclaration(SgForStatement *loop)
Undo the normalization of for loop's C99 init declaration. Previous record of normalization is used t...
SageInterface::moveCommentsToNewStatement
ROSE_DLL_API void moveCommentsToNewStatement(SgStatement *sourceStatement, const std::vector< int > &indexList, SgStatement *targetStatement, bool surroundingStatementPreceedsTargetStatement)
Relocate comments and CPP directives from one statement to another.
SageInterface::lookupClassSymbolInParentScopes
ROSE_DLL_API SgClassSymbol * lookupClassSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL, SgTemplateArgumentPtrList *templateArgumentList=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::pastePreprocessingInfo
ROSE_DLL_API void pastePreprocessingInfo(SgLocatedNode *dst_node, PreprocessingInfo::RelativePositionType pos, AttachedPreprocessingInfoType &saved_buf)
Paste preprocessing information from a buffer to a destination node. Used in combination of cutPrepro...
SageInterface::IsPod
bool IsPod(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::clearUnusedVariableSymbols
void clearUnusedVariableSymbols(SgNode *root=NULL)
Clear those variable symbols with unknown type (together with initialized names) which are also not r...
SageInterface::setStatic
ROSE_DLL_API void setStatic(SgDeclarationStatement *stmt)
Set a declaration as static.
SageInterface::getLastStatement
ROSE_DLL_API SgStatement * getLastStatement(SgScopeStatement *scope)
get the last statement within a scope, return NULL if it does not exit
SageInterface::lastFrontEndSpecificStatement
ROSE_DLL_API SgStatement * lastFrontEndSpecificStatement(SgGlobal *globalScope)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::getSgNodeFromAbstractHandleString
ROSE_DLL_API SgNode * getSgNodeFromAbstractHandleString(const std::string &input_string)
Obtain a matching SgNode from an abstract handle string.
SageInterface::getGlobalScope
ROSE_DLL_API SgGlobal * getGlobalScope(const SgNode *astNode)
Traverse back through a node's parents to find the enclosing global scope.
SageInterface::get_C_array_dimensions
std::vector< SgExpression * > get_C_array_dimensions(const SgArrayType &arrtype)
returns the array dimensions in an array as defined for arrtype
SageInterface::collectSourceSequenceNumbers
std::set< unsigned int > collectSourceSequenceNumbers(SgNode *astNode)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::attachArbitraryText
ROSE_DLL_API PreprocessingInfo * attachArbitraryText(SgLocatedNode *target, const std::string &text, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before)
Attach an arbitrary string to a located node. A workaround to insert irregular statements or vendor-s...
SageInterface::resetInternalMapsForTargetStatement
ROSE_DLL_API void resetInternalMapsForTargetStatement(SgStatement *sourceStatement)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::setSourcePosition
ROSE_DLL_API void setSourcePosition(SgNode *node)
Set the source code positon for the current (input) node.
SageInterface::getLoopIndexVariable
ROSE_DLL_API SgInitializedName * getLoopIndexVariable(SgNode *loop)
Return the loop index variable for a for loop.
SageInterface::resetScopeNumbers
void resetScopeNumbers(SgFunctionDefinition *functionDeclaration)
Assigns unique numbers to each SgScopeStatement of a function.
SageInterface::generateFileList
std::vector< SgFile * > generateFileList()
Returns STL vector of SgFile IR node pointers.
SageInterface::buildForwardFunctionDeclaration
ROSE_DLL_API SgTemplateInstantiationMemberFunctionDecl * buildForwardFunctionDeclaration(SgTemplateInstantiationMemberFunctionDecl *memberFunctionInstantiation)
Generate a non-defining (forward) declaration from a defining function declaration.
SageInterface::isIndexOperator
bool isIndexOperator(SgExpression *exp)
Is an overloaded operator an index operator (also referred to as call or subscript operators)....
SgExpression
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
Definition: Cxx_Grammar.h:229045
SageInterface::isNonconstReference
ROSE_DLL_API bool isNonconstReference(SgType *t)
Is this type a non-constant reference type? (Handles typedefs correctly)
SageInterface::clearMangledNameCache
void clearMangledNameCache(SgGlobal *globalScope)
Support for faster mangled name generation (caching avoids recomputation).
SageInterface::splitExpression
ROSE_DLL_API SgAssignInitializer * splitExpression(SgExpression *from, std::string newName="")
Replace an expression with a temporary variable and an assignment statement.
SageInterface::whereAmI
void whereAmI(SgNode *node)
Diagnostic function for tracing back through the parent list to understand at runtime where in the AS...
SageInterface::annotateExpressionsWithUniqueNames
void annotateExpressionsWithUniqueNames(SgProject *project)
Generate unique names for expressions and attach the names as persistent attributes ("UniqueNameAttri...
SageInterface::prependStatementList
ROSE_DLL_API void prependStatementList(const std::vector< SgStatement * > &stmt, SgScopeStatement *scope=NULL)
prepend a list of statements to the beginning of the current scope, handling side effects as appropri...
SageInterface::getClassTypeChainForMemberReference
ROSE_DLL_API std::list< SgClassType * > getClassTypeChainForMemberReference(SgExpression *refExp)
Find a node by type using upward traversal.
SageInterface::detectCycleInType
void detectCycleInType(SgType *type, const std::string &from)
Collect all read and write references within stmt, which can be a function, a scope statement,...
PreprocessingInfo::RelativePositionType
RelativePositionType
MK: Enum type to store if the directive goes before or after the corresponding line of source code.
Definition: rose_attributes_list.h:133
SageInterface::checkAccessPermissions
void checkAccessPermissions(SgNode *)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SgToken
Definition: Cxx_Grammar.h:75138
SageInterface::local_name_to_node_map
std::map< std::string, SgNode * > local_name_to_node_map
Global map of name collisions to support generateUniqueNameForUseAsIdentifier() function.
SageInterface::convertAllForsToWhiles
ROSE_DLL_API void convertAllForsToWhiles(SgNode *top)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::isPrefixOperatorName
bool isPrefixOperatorName(const SgName &functionName)
Check for proper names of possible prefix operators (used in isPrefixOperator()).
SageInterface::OutputLocalSymbolTables::visit
void visit(SgNode *node)
this method is called at every traversed node.
SageInterface::findContinueStmts
std::vector< SgContinueStmt * > findContinueStmts(SgStatement *code, const std::string &fortranLabel="")
Find all continue statements inside a particular statement, stopping at nested loops.
SageInterface::moveVariableDeclaration
ROSE_DLL_API void moveVariableDeclaration(SgVariableDeclaration *decl, SgScopeStatement *target_scope)
Move a variable declaration to a new scope, handle symbol, special scopes like For loop,...
SageInterface::DeferredTransformation::operator=
ROSE_DLL_API DeferredTransformation & operator=(const DeferredTransformation &X)
Shallow; does not delete fields.
SageInterface::findGotoStmts
std::vector< SgGotoStatement * > findGotoStmts(SgStatement *scope, SgLabelStatement *l)
Query a subtree to get all nodes of a given type, with an appropriate downcast.
AbstractHandle::abstract_handle
to specify a construct using a specifier Can be used alone or with parent handles when relative speci...
Definition: abstract_handle.h:182
SageInterface::lookupNamespaceSymbolInParentScopes
ROSE_DLL_API SgNamespaceSymbol * lookupNamespaceSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::isSameFunction
ROSE_DLL_API bool isSameFunction(SgFunctionDeclaration *func1, SgFunctionDeclaration *func2)
Check if two function declarations refer to the same one. Two function declarations are the same when...
SageInterface::isUpcSharedType
ROSE_DLL_API bool isUpcSharedType(SgType *t, SgModifierType **mod_type_out=NULL)
Check if a type is a UPC shared type, including shared array, shared pointers etc....
SgTemplateInstantiationMemberFunctionDecl
This class represents the concept of an instantiation of member function template or a member functio...
Definition: Cxx_Grammar.h:158167
SageInterface::outputFileIds
ROSE_DLL_API void outputFileIds(SgNode *node)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::isStrictIntegerType
ROSE_DLL_API bool isStrictIntegerType(SgType *t)
Check if a type is an integral type, only allowing signed/unsigned short, int, long,...
SageInterface::isLambdaCapturedVariable
ROSE_DLL_API bool isLambdaCapturedVariable(SgVarRefExp *varRef)
check if a variable reference is this->a[i] inside of a lambda function
SageInterface::isReferenceType
ROSE_DLL_API bool isReferenceType(SgType *t)
Is this type a const or non-const reference type? (Handles typedefs correctly)
SageInterface
Functions that are useful when operating on the AST.
Definition: sageBuilder.h:25
SageInterface::getEnclosingExprListExp
ROSE_DLL_API SgExprListExp * getEnclosingExprListExp(SgNode *astNode, const bool includingSelf=false)
Get the enclosing SgExprListExp (used as part of function argument index evaluation in subexpressions...
SageInterface::findEnclosingLoop
ROSE_DLL_API SgScopeStatement * findEnclosingLoop(SgStatement *s, const std::string &fortranLabel="", bool stopOnSwitches=false)
Find the closest loop outside the given statement; if fortranLabel is not empty, the Fortran label of...
SageInterface::is_OpenCL_language
ROSE_DLL_API bool is_OpenCL_language()
Definition: sageInterface.h:658
SageInterface::checkForInitializers
void checkForInitializers(SgNode *node)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SgFunctionParameterList
This class represents the concept of a declaration list.
Definition: Cxx_Grammar.h:137786
SageInterface::replaceVariableReferences
ROSE_DLL_API void replaceVariableReferences(SgVariableSymbol *old_sym, SgVariableSymbol *new_sym, SgScopeStatement *scope)
Replace all variable references to an old symbol in a scope to being references to a new symbol.
SageInterface::ensureBasicBlockAsBodyOfUpcForAll
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfUpcForAll(SgUpcForAllStatement *fs)
Check if the body of a 'upc_forall' statement is a SgBasicBlock, create one if not.
SgTemplateArgument
This class represents template argument within the use of a template to build an instantiation.
Definition: Cxx_Grammar.h:29484
SgC_PreprocessorDirectiveStatement
Definition: Cxx_Grammar.h:161086
SageInterface::getAssociatedTypeFromFunctionTypeList
ROSE_DLL_API SgType * getAssociatedTypeFromFunctionTypeList(SgExpression *actual_argument_expression)
Get the type of the associated argument expression from the function type.
SageInterface::isPrototypeInScope
bool isPrototypeInScope(SgScopeStatement *scope, SgFunctionDeclaration *functionDeclaration, SgDeclarationStatement *startingAtDeclaration)
Assigns unique numbers to each SgScopeStatement of a function.
SageInterface::templateArgumentListEquivalence
ROSE_DLL_API bool templateArgumentListEquivalence(const SgTemplateArgumentPtrList &list1, const SgTemplateArgumentPtrList &list2)
Verify that 2 SgTemplateArgumentPtrList are equivalent.
SageInterface::isStructDeclaration
ROSE_DLL_API bool isStructDeclaration(SgNode *node)
Check if a SgNode is a declaration for a structure.
SageInterface::setBaseTypeDefiningDeclaration
void setBaseTypeDefiningDeclaration(SgVariableDeclaration *var_decl, SgDeclarationStatement *base_decl)
a better version for SgVariableDeclaration::set_baseTypeDefininingDeclaration(), handling all side ef...
sg::ancestor
AncestorNode * ancestor(SgNode *n)
finds an ancestor node with a given type
Definition: sageGeneric.h:988
SgDeclarationStatement::get_firstNondefiningDeclaration
SgDeclarationStatement * get_firstNondefiningDeclaration() const
This is an access function for the SgDeclarationStatement::p_firstNondefiningDeclaration data member ...
SageInterface::findEnclosingUpirFieldBodyStatement
ROSE_DLL_API SgUpirFieldBodyStatement * findEnclosingUpirFieldBodyStatement(SgStatement *s)
Find enclosing OpenMP clause body statement from s. If s is already one, return it directly.
SageInterface::ensureBasicBlockAsBodyOfFor
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfFor(SgForStatement *fs)
Check if the body of a 'for' statement is a SgBasicBlock, create one if not.
SageInterface::getEnclosingProcedure
ROSE_DLL_API SgFunctionDefinition * getEnclosingProcedure(SgNode *n, const bool includingSelf=false)
Find the function definition.
SageInterface::cleanupNontransformedBasicBlockNode
ROSE_DLL_API void cleanupNontransformedBasicBlockNode()
Remove unused basic block IR nodes added as part of normalization.
SageInterface::createTempVariableForExpression
std::pair< SgVariableDeclaration *, SgExpression * > createTempVariableForExpression(SgExpression *expression, SgScopeStatement *scope, bool initializeInDeclaration, SgAssignOp **reEvaluate=NULL)
Given an expression, generates a temporary variable whose initializer optionally evaluates that expre...
SageInterface::appendStatement
ROSE_DLL_API void appendStatement(SgStatement *stmt, SgScopeStatement *scope=NULL)
Append a statement to the end of the current scope, handle side effect of appending statements,...
SageInterface::dumpPreprocInfo
void dumpPreprocInfo(SgLocatedNode *locatedNode)
Dumps a located node's preprocessing information.
SgTemplateClassSymbol
Definition: Cxx_Grammar.h:326060
AstSimpleProcessing
Class for traversing the AST.
Definition: AstSimpleProcessing.h:59
SageInterface::generateFunctionDefinitionsList
ROSE_DLL_API std::vector< SgFunctionDeclaration * > generateFunctionDefinitionsList(SgNode *node)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::isVolatileType
ROSE_DLL_API bool isVolatileType(SgType *t)
Is this a volatile type?
SageInterface::clearSharedGlobalScopes
void clearSharedGlobalScopes(SgProject *project)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SgName
This class represents strings within the IR nodes.
Definition: Cxx_Grammar.h:16476
SageInterface::ensureBasicBlockAsBodyOfCaseOption
SgBasicBlock * ensureBasicBlockAsBodyOfCaseOption(SgCaseOptionStmt *cs)
Check if the body of a 'case option' statement is a SgBasicBlock, create one if not.
SageInterface::recordNormalizations
ROSE_DLL_API void recordNormalizations(SgStatement *s)
Record where normalization have been done so that we can preform denormalizations as required for the...
SgUpcForAllStatement
Definition: Cxx_Grammar.h:133943
SageInterface::replaceSubexpressionWithStatement
ROSE_DLL_API void replaceSubexpressionWithStatement(SgExpression *from, SageInterface::StatementGenerator *to)
Similar to replaceExpressionWithStatement, but with more restrictions.
SageInterface::initializeSwitchStatement
void initializeSwitchStatement(SgSwitchStatement *switchStatement, SgStatement *item_selector, SgStatement *body)
Support function used for variable declarations in conditionals.
SageInterface::appendExpression
ROSE_DLL_API void appendExpression(SgExprListExp *, SgExpression *)
Append an expression to a SgExprListExp, set the parent pointer also.
SageInterface::skipTranslateToUseCppDeclaration
ROSE_DLL_API bool skipTranslateToUseCppDeclaration(PreprocessingInfo *currentPreprocessingInfo)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::translateScopeToUseCppDeclarations
ROSE_DLL_API void translateScopeToUseCppDeclarations(SgScopeStatement *scope)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::statementCanBeTransformed
ROSE_DLL_API bool statementCanBeTransformed(SgStatement *stmt)
If header file unparsing and token-based unparsing are used, then some statements in header files use...
SageInterface::IsBaseOf
bool IsBaseOf(const SgType *const inputBaseType, const SgType *const inputDerivedType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::getFirstGlobalScope
ROSE_DLL_API SgGlobal * getFirstGlobalScope(SgProject *project)
return the first global scope under current project
SageInterface::isDefaultConstructible
ROSE_DLL_API bool isDefaultConstructible(SgType *type)
Is a type default constructible? This may not quite work properly.
SageInterface::lookupVariableSymbolInParentScopes
ROSE_DLL_API SgVariableSymbol * lookupVariableSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::removeStatement
ROSE_DLL_API void removeStatement(SgStatement *stmt, bool autoRelocatePreprocessingInfo=true)
Remove a statement from its attach point of the AST. Automatically keep its associated preprocessing ...
SageInterface::getInParameters
std::vector< SgInitializedName * > getInParameters(const SgInitializedNamePtrList &params)
Get a vector of Jovial input parameters from the function parameter list (may work for Fortran in the...
SageInterface::setOperand
ROSE_DLL_API void setOperand(SgExpression *target, SgExpression *operand)
Set operands for expressions with single operand, such as unary expressions. handle file info,...
SgDeclarationStatement
This class represents the concept of a declaration statement.
Definition: Cxx_Grammar.h:136861
SgLabelSymbol::label_type_enum
label_type_enum
Type of label used (fortran only)
Definition: Cxx_Grammar.h:328775
SageInterface::IsAbstract
bool IsAbstract(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::moveForStatementIncrementIntoBody
ROSE_DLL_API void moveForStatementIncrementIntoBody(SgForStatement *f)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::lastStatementOfScopeWithTokenInfo
SgStatement * lastStatementOfScopeWithTokenInfo(SgScopeStatement *scope, std::map< SgNode *, TokenStreamSequenceToNodeMapping * > &tokenStreamSequenceMap)
Used to support token unparsing (when the output the trailing token sequence).
SageInterface::collectReadWriteVariables
ROSE_DLL_API bool collectReadWriteVariables(SgStatement *stmt, std::set< SgInitializedName * > &readVars, std::set< SgInitializedName * > &writeVars, bool coarseGrain=true)
Collect unique variables which are read or written within a statement. Note that a variable can be bo...
SageInterface::addVarRefExpFromArrayDimInfo
void addVarRefExpFromArrayDimInfo(SgNode *astNode, Rose_STL_Container< SgNode * > &NodeList_t)
Find all SgPntrArrRefExp under astNode, then add SgVarRefExp (if any) of SgPntrArrRefExp's dim_info i...
SageInterface::getEnclosingNode
NodeType * getEnclosingNode(const SgNode *astNode, const bool includingSelf=false)
Find a node by type using upward traversal.
Definition: sageInterface.h:1437
SageInterface::fixClassDeclaration
ROSE_DLL_API void fixClassDeclaration(SgClassDeclaration *classDecl, SgScopeStatement *scope)
Fix symbols, parent and scope pointers. Used internally within appendStatment(), insertStatement() et...
SageInterface::lookupSymbolInParentScopes
ROSE_DLL_API SgSymbol * lookupSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL, SgTemplateParameterPtrList *templateParameterList=NULL, SgTemplateArgumentPtrList *templateArgumentList=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::IsTrivial
bool IsTrivial(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::IsClass
bool IsClass(const SgType *const inputType)
strip off typedef and modifer types, then check if a type is a class type, excluding union type.
SageInterface::hasSimpleChildrenList
ROSE_DLL_API bool hasSimpleChildrenList(SgScopeStatement *scope)
Check if a scope statement has a simple children statement list so insert additional statements under...
SageInterface::getArrayElementCount
ROSE_DLL_API size_t getArrayElementCount(SgArrayType *t)
Calculate the number of elements of an array type: dim1* dim2*... , assume element count is 1 for int...
SageInterface::replaceStatement
ROSE_DLL_API void replaceStatement(SgStatement *oldStmt, SgStatement *newStmt, bool movePreprocessinInfo=false)
Replace a statement with another. Move preprocessing information from oldStmt to newStmt if requested...
SgNamespaceDefinitionStatement
This class represents the concept of a namespace definition.
Definition: Cxx_Grammar.h:130989
SageInterface::findFunctionType
ROSE_DLL_API SgFunctionType * findFunctionType(SgType *return_type, SgFunctionParameterTypeList *typeList)
Find the function type matching a function signature plus a given return type.
SageInterface::displayScope
ROSE_DLL_API void displayScope(SgScopeStatement *scope)
Find a node by type using upward traversal.
SageInterface::resetMangledNameCache
void resetMangledNameCache(SgGlobal *globalScope)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::gensym_counter
ROSE_DLL_API int gensym_counter
An internal counter for generating unique SgName.
SgTemplateDeclaration
This class represents the concept of a template declaration.
Definition: Cxx_Grammar.h:143464
SageInterface::setLoopStride
ROSE_DLL_API void setLoopStride(SgNode *loop, SgExpression *stride)
Set the stride(step) of a loop 's incremental expression, regardless the expression types (i+=s; i= i...
SageInterface::isConstantFalse
ROSE_DLL_API bool isConstantFalse(SgExpression *e)
Check if a bool or int constant expression evaluates to be a false value.
SageInterface::IsEnum
bool IsEnum(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::suggestNextNumericLabel
ROSE_DLL_API int suggestNextNumericLabel(SgFunctionDefinition *func_def)
Suggest next usable (non-conflicting) numeric label value for a Fortran function definition scope.
SageInterface::IsStandardLayout
bool IsStandardLayout(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::getEnclosingFunctionDeclaration
ROSE_DLL_API SgFunctionDeclaration * getEnclosingFunctionDeclaration(SgNode *astNode, const bool includingSelf=false)
Find the enclosing function declaration, including its derived instances like isSgProcedureHeaderStat...
SgNode
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:6739
SgTemplateMemberFunctionSymbol
Definition: Cxx_Grammar.h:323801
SageInterface::findUnusedLabels
ROSE_DLL_API std::set< SgLabelStatement * > findUnusedLabels(SgNode *top)
Find unused labels which are not targets of any goto statements.
SageInterface::getFirstInitializedName
ROSE_DLL_API SgInitializedName * getFirstInitializedName(SgVariableDeclaration *decl)
Get the first initialized name of a declaration statement.
SageInterface::isEqualToIntConst
ROSE_DLL_API bool isEqualToIntConst(SgExpression *e, int value)
Check if a SgIntVal node has a given value.
SageInterface::getOutParameters
std::vector< SgInitializedName * > getOutParameters(const SgInitializedNamePtrList &params)
Get a vector of Jovial output parameters from the function parameter list (may work for Fortran in th...
SageInterface::local_name_collision_map
std::map< std::string, int > local_name_collision_map
Global map of name collisions to support generateUniqueNameForUseAsIdentifier() function.
SgClassSymbol
This class represents the concept of a class name within the compiler.
Definition: Cxx_Grammar.h:325607
SageInterface::getLoopCondition
ROSE_DLL_API SgStatement * getLoopCondition(SgScopeStatement *loop)
Routines to get the condition of a loop. It recognize While-loop, For-loop, and Do-While-loop.
SageInterface::lookupNamedTypeInParentScopes
ROSE_DLL_API SgType * lookupNamedTypeInParentScopes(const std::string &type_name, SgScopeStatement *scope=NULL)
Lookup a named type based on its name, bottomup searching from a specified scope. Note name collison ...
SageInterface::getFirstVariable
SgInitializedName & getFirstVariable(SgVariableDeclaration &vardecl)
convenience function that returns the first initialized name in a list of variable declarations.
SageInterface::fixFunctionDeclaration
ROSE_DLL_API void fixFunctionDeclaration(SgFunctionDeclaration *stmt, SgScopeStatement *scope)
Fix the symbol table and set scope (only if scope in declaration is not already set).
SageInterface::Transformation_Record
Definition: sageInterface.h:66
ClassHierarchyWrapper
Definition: ClassHierarchyGraph.h:8
SgTemplateInstantiationFunctionDecl
This class represents the concept of an instantiation of function template.
Definition: Cxx_Grammar.h:158680
SageInterface::astIntersection
ROSE_DLL_API std::vector< SgNode * > astIntersection(SgNode *original, SgNode *copy, SgCopyHelp *help=NULL)
Compute the intersection set for two ASTs.
SageInterface::fixVariableReferences
ROSE_DLL_API int fixVariableReferences(SgNode *root, bool cleanUnusedSymbol=true)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::isDataMemberReference
ROSE_DLL_API bool isDataMemberReference(SgVarRefExp *varRefExp)
Find a node by type using upward traversal.
SageInterface::insertHeader
ROSE_DLL_API PreprocessingInfo * insertHeader(SgSourceFile *source_file, const std::string &header_file_name, bool isSystemHeader, bool asLastHeader)
Insert #include "filename" or #include <filename> (system header) onto the global scope of a source f...
SageInterface::collectModifiedStatements
ROSE_DLL_API std::set< SgStatement * > collectModifiedStatements(SgNode *node)
This collects the statements that are marked as modified (a flag automatically set by all set_* gener...
SageInterface::copyStatement
ROSE_DLL_API SgStatement * copyStatement(SgStatement *s)
Deep copy a statement.
SageInterface::setFortranNumericLabel
ROSE_DLL_API void setFortranNumericLabel(SgStatement *stmt, int label_value, SgLabelSymbol::label_type_enum label_type=SgLabelSymbol::e_start_label_type, SgScopeStatement *label_scope=NULL)
Set a numerical label for a Fortran statement. The statement should have a enclosing function definit...
SageInterface::appendArg
ROSE_DLL_API SgVariableSymbol * appendArg(SgFunctionParameterList *, SgInitializedName *)
Append an argument to SgFunctionParameterList, transparently set parent,scope, and symbols for argume...
SageInterface::splitExpressionIntoBasicBlock
ROSE_DLL_API void splitExpressionIntoBasicBlock(SgExpression *expr)
Split long expressions into blocks of statements.
SgCatchOptionStmt
This class represents the concept of a catch within a try-catch construct used in C++ exception handl...
Definition: Cxx_Grammar.h:130494
SageInterface::mergeDeclarationWithAssignment
ROSE_DLL_API bool mergeDeclarationWithAssignment(SgVariableDeclaration *decl, SgExprStatement *assign_stmt)
Merge a declaration statement into a matching followed variable assignment. Callers should make sure ...
SgInitializedName
This class represents the notion of a declared variable.
Definition: Cxx_Grammar.h:76851
SageInterface::hasUpcSharedType
ROSE_DLL_API bool hasUpcSharedType(SgType *t, SgModifierType **mod_type_out=NULL)
Has a UPC shared type of any kinds (shared-to-shared, private-to-shared, shared-to-private,...
SageInterface::setRhsOperand
ROSE_DLL_API void setRhsOperand(SgExpression *target, SgExpression *rhs)
set left hand operand for binary expression
SageInterface::moveDeclarationToAssociatedNamespace
ROSE_DLL_API void moveDeclarationToAssociatedNamespace(SgDeclarationStatement *declarationStatement)
Relocate the declaration to be explicitly represented in its associated namespace (required for some ...
SageInterface::setOneSourcePositionForTransformation
ROSE_DLL_API void setOneSourcePositionForTransformation(SgNode *root)
Set current node's source position as transformation generated.
SageInterface::recursivePrintCurrentAndParent
void recursivePrintCurrentAndParent(SgNode *n)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SgLabelStatement
This class represents the concept of a C or C++ label statement.
Definition: Cxx_Grammar.h:174131
SageInterface::fixLabelStatement
ROSE_DLL_API void fixLabelStatement(SgLabelStatement *label_stmt, SgScopeStatement *scope)
Fix symbol table for SgLabelStatement. Used Internally when the label is built without knowing its ta...
SageInterface::buildFunctionPrototype
ROSE_DLL_API SgFunctionDeclaration * buildFunctionPrototype(SgFunctionDeclaration *functionDeclaration)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::isAssignable
ROSE_DLL_API bool isAssignable(SgType *type)
Is a type assignable? This may not quite work properly.
SageInterface::collectVarRefs
void collectVarRefs(SgLocatedNode *root, std::vector< SgVarRefExp * > &result)
Collect all variable references in a subtree.
SageInterface::translateStatementToUseCppDeclarations
ROSE_DLL_API std::vector< SgC_PreprocessorDirectiveStatement * > translateStatementToUseCppDeclarations(SgStatement *statement, SgScopeStatement *scope)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
SageInterface::templateArgumentEquivalence
ROSE_DLL_API bool templateArgumentEquivalence(SgTemplateArgument *arg1, SgTemplateArgument *arg2)
Verify that 2 SgTemplateArgument are equivalent (same type, same expression, or same template declara...
SageInterface::getScope
ROSE_DLL_API SgScopeStatement * getScope(const SgNode *astNode)
Get the closest scope from astNode. Return astNode if it is already a scope.
SageInterface::enclosingNamespaceScope
SgNamespaceDefinitionStatement * enclosingNamespaceScope(SgDeclarationStatement *declaration)
Find the enclosing namespace of a declaration.
SgModifierType
Definition: Cxx_Grammar.h:61411
SageInterface::functionCallExpressionPreceedsDeclarationWhichAssociatesScope
bool functionCallExpressionPreceedsDeclarationWhichAssociatesScope(SgFunctionCallExp *functionCall)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::lookupTemplateMemberFunctionSymbolInParentScopes
ROSE_DLL_API SgFunctionSymbol * lookupTemplateMemberFunctionSymbolInParentScopes(const SgName &functionName, SgFunctionType *ftype, SgTemplateParameterPtrList *tplparams, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SgArrayType
Definition: Cxx_Grammar.h:64255
SageInterface::insideHeader
ROSE_DLL_API bool insideHeader(SgLocatedNode *node)
Check if a node is from a header file.
SgModuleStatement
Definition: Cxx_Grammar.h:153453
SageInterface::fixVariableDeclaration
ROSE_DLL_API void fixVariableDeclaration(SgVariableDeclaration *varDecl, SgScopeStatement *scope)
Patch up symbol, scope, and parent information when a SgVariableDeclaration's scope is known.
SageInterface::outputSharedNodes
ROSE_DLL_API void outputSharedNodes(SgNode *node)
Find a node by type using upward traversal.
SageInterface::ensureBasicBlockAsBodyOfDoWhile
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfDoWhile(SgDoWhileStmt *ws)
Check if the body of a 'do .. while' statement is a SgBasicBlock, create one if not.
SageInterface::isUpcPrivateToSharedType
ROSE_DLL_API bool isUpcPrivateToSharedType(SgType *t)
Is a UPC private-to-shared pointer? SgPointerType comes first compared to SgModifierType with UPC inf...
SageInterface::UnderlyingType
SgType * UnderlyingType(SgType *type)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::isRestrictType
ROSE_DLL_API bool isRestrictType(SgType *t)
Is this a restrict type?
SgValueExp
This class represents the notion of an value (expression value).
Definition: Cxx_Grammar.h:274702
SageInterface::isPointerToNonConstType
ROSE_DLL_API bool isPointerToNonConstType(SgType *type)
Is this a pointer to a non-const type? Note that this function will return true for const pointers po...
SageInterface::is_Cxx_language
ROSE_DLL_API bool is_Cxx_language()
Definition: sageInterface.h:654
SageInterface::local_node_to_name_map
std::map< SgNode *, std::string > local_node_to_name_map
Global map of name collisions to support generateUniqueNameForUseAsIdentifier() function.
SageInterface::normalizeForLoopInitDeclaration
ROSE_DLL_API bool normalizeForLoopInitDeclaration(SgForStatement *loop)
Normalize loop init stmt by promoting the single variable declaration statement outside of the for lo...
SageInterface::isUnionDeclaration
ROSE_DLL_API bool isUnionDeclaration(SgNode *node)
Check if a SgNode is a declaration for a union.
SageInterface::appendStatementList
ROSE_DLL_API void appendStatementList(const std::vector< SgStatement * > &stmt, SgScopeStatement *scope=NULL)
Append a list of statements to the end of the current scope, handle side effect of appending statemen...
SgSourceFile
Definition: Cxx_Grammar.h:22972
SageInterface::rebuildSymbolTable
void rebuildSymbolTable(SgScopeStatement *scope)
Regenerate the symbol table.
SgNode::get_parent
SgNode * get_parent() const
Access function for parent node.
SageInterface::lookupEnumSymbolInParentScopes
ROSE_DLL_API SgEnumSymbol * lookupEnumSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::HasNoThrowCopy
bool HasNoThrowCopy(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::is_C_language
ROSE_DLL_API bool is_C_language()
Definition: sageInterface.h:649
SageInterface::addMessageStatement
void addMessageStatement(SgStatement *stmt, std::string message)
Function to add "C" style comment to statement.
SgNode::set_parent
void set_parent(SgNode *parent)
All nodes in the AST contain a reference to a parent node.
SageInterface::IsPolymorphic
bool IsPolymorphic(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::collectModifiedLocatedNodes
ROSE_DLL_API std::set< SgLocatedNode * > collectModifiedLocatedNodes(SgNode *node)
This collects the SgLocatedNodes that are marked as modified (a flag automatically set by all set_* g...
SageInterface::isCallToParticularFunction
ROSE_DLL_API bool isCallToParticularFunction(SgFunctionDeclaration *decl, SgExpression *e)
Recursively print current and parent nodes. used within gdb to probe the context of a node.
SageInterface::ensureBasicBlockAsBodyOfCatch
ROSE_DLL_API SgBasicBlock * ensureBasicBlockAsBodyOfCatch(SgCatchOptionStmt *cos)
Check if the body of a 'catch' statement is a SgBasicBlock, create one if not.
SageInterface::HasTrivialConstructor
bool HasTrivialConstructor(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::convertForToWhile
ROSE_DLL_API void convertForToWhile(SgForStatement *f)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::language_may_contain_nondeclarations_in_scope
ROSE_DLL_API bool language_may_contain_nondeclarations_in_scope()
SageInterface::loopUnrolling
ROSE_DLL_API bool loopUnrolling(SgForStatement *loop, size_t unrolling_factor)
Unroll a target loop with a specified unrolling factor. It handles steps larger than 1 and adds a fri...
SageInterface::movePreprocessingInfo
ROSE_DLL_API void movePreprocessingInfo(SgStatement *stmt_src, SgStatement *stmt_dst, PreprocessingInfo::RelativePositionType src_position=PreprocessingInfo::undef, PreprocessingInfo::RelativePositionType dst_position=PreprocessingInfo::undef, bool usePrepend=false)
Move preprocessing information of stmt_src to stmt_dst, Only move preprocessing information from the ...
SageInterface::IsEmpty
bool IsEmpty(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::UniqueNameAttribute
A persistent attribute to represent a unique name for an expression.
Definition: sageInterface.h:112
SgFunctionDefinition
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
Definition: Cxx_Grammar.h:126549
SageInterface::IsLiteralType
bool IsLiteralType(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::computeUniqueNameForUseAsIdentifier
void computeUniqueNameForUseAsIdentifier(SgNode *astNode)
Traversal to set the global map of names to node and node to names.collisions to support generateUniq...
SageInterface::isCanonicalForLoop
ROSE_DLL_API bool isCanonicalForLoop(SgNode *loop, SgInitializedName **ivar=NULL, SgExpression **lb=NULL, SgExpression **ub=NULL, SgExpression **step=NULL, SgStatement **body=NULL, bool *hasIncrementalIterationSpace=NULL, bool *isInclusiveUpperBound=NULL)
Check if a for-loop has a canonical form, return loop index, bounds, step, and body if requested.
SageInterface::isScalarType
ROSE_DLL_API bool isScalarType(SgType *t)
Is this a scalar type?
SageInterface::replaceMacroCallsWithExpandedStrings
ROSE_DLL_API void replaceMacroCallsWithExpandedStrings(SgPragmaDeclaration *target)
Check if a pragma declaration node has macro calls attached, if yes, replace macro calls within the p...
SgForAllStatement
Definition: Cxx_Grammar.h:133433
SageInterface::isTemplateInstantiationNode
ROSE_DLL_API bool isTemplateInstantiationNode(SgNode *node)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::initializeWhileStatement
void initializeWhileStatement(SgWhileStmt *whileStatement, SgStatement *condition, SgStatement *body, SgStatement *else_body)
Support function used for variable declarations in conditionals.
SageInterface::updateDefiningNondefiningLinks
ROSE_DLL_API void updateDefiningNondefiningLinks(SgFunctionDeclaration *func, SgScopeStatement *scope)
Update defining and nondefining links due to a newly introduced function declaration....
SageInterface::deepDelete
ROSE_DLL_API void deepDelete(SgNode *root)
Deep delete a sub AST tree. It uses postorder traversal to delete each child node....
SageInterface::replaceDefiningFunctionDeclarationWithFunctionPrototype
ROSE_DLL_API SgFunctionDeclaration * replaceDefiningFunctionDeclarationWithFunctionPrototype(SgFunctionDeclaration *functionDeclaration)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::removeConsecutiveLabels
ROSE_DLL_API void removeConsecutiveLabels(SgNode *top)
Remove consecutive labels.
SageInterface::hasTemplateSyntax
bool hasTemplateSyntax(const SgName &name)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::forLoopNormalization
ROSE_DLL_API bool forLoopNormalization(SgForStatement *loop, bool foldConstant=true)
Normalize a for loop, return true if successful.
SageInterface::is_mixed_C_and_Cxx_language
ROSE_DLL_API bool is_mixed_C_and_Cxx_language()
SgVariableDeclaration
This class represents the concept of a C or C++ variable declaration.
Definition: Cxx_Grammar.h:138274
SageInterface::normalizeForLoopIncrement
ROSE_DLL_API bool normalizeForLoopIncrement(SgForStatement *loop)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::is_mixed_Fortran_and_C_language
ROSE_DLL_API bool is_mixed_Fortran_and_C_language()
SageInterface::getUpcSharedBlockSize
ROSE_DLL_API size_t getUpcSharedBlockSize(SgModifierType *mod_type)
Get the block size of a UPC shared modifier type.
SageInterface::setParameterList
void setParameterList(actualFunction *func, SgFunctionParameterList *paralist)
Set parameter list for a function declaration, considering existing parameter list etc.
Definition: sageInterface.h:2044
SageInterface::prependStatement
ROSE_DLL_API void prependStatement(SgStatement *stmt, SgScopeStatement *scope=NULL)
Prepend a statement to the beginning of the current scope, handling side effects as appropriate.
SageInterface::deleteAST
ROSE_DLL_API void deleteAST(SgNode *node)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::is_CAF_language
ROSE_DLL_API bool is_CAF_language()
Definition: sageInterface.h:656
SgScopeStatement
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
Definition: Cxx_Grammar.h:123553
SageInterface::wrapFunction
std::pair< SgStatement *, SgInitializedName * > wrapFunction(SgFunctionDeclaration &definingDeclaration, SgName newName)
moves the body of a function f to a new function f; f's body is replaced with code that forwards the ...
SageInterface::getForLoopInformations
bool getForLoopInformations(SgForStatement *for_loop, SgVariableSymbol *&iterator, SgExpression *&lower_bound, SgExpression *&upper_bound, SgExpression *&stride)
Add a step statement to the end of a loop body Add a new label to the end of the loop,...
SageInterface::lookupFunctionSymbolInParentScopes
ROSE_DLL_API SgFunctionSymbol * lookupFunctionSymbolInParentScopes(const SgName &functionName, SgScopeStatement *currentScope=NULL)
look up the first matched function symbol in parent scopes given only a function name,...
SageInterface::findSurroundingStatementFromSameFile
ROSE_DLL_API SgStatement * findSurroundingStatementFromSameFile(SgStatement *targetStmt, bool &surroundingStatementPreceedsTargetStatement)
Supporting function to comment relocation in insertStatement() and removeStatement().
SgFunctionSymbol
Definition: Cxx_Grammar.h:322891
SageInterface::isCanonicalDoLoop
ROSE_DLL_API bool isCanonicalDoLoop(SgFortranDo *loop, SgInitializedName **ivar, SgExpression **lb, SgExpression **ub, SgExpression **step, SgStatement **body, bool *hasIncrementalIterationSpace, bool *isInclusiveUpperBound)
Check if a Fortran Do loop has a complete canonical form: Do I=1, 10, 1.
SageInterface::IsUnion
bool IsUnion(const SgType *const inputType)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::collectUseByAddressVariableRefs
ROSE_DLL_API void collectUseByAddressVariableRefs(const SgStatement *s, std::set< SgVarRefExp * > &varSetB)
Collect variable references involving use by address: including &a expression and foo(a) when type2 f...
SageInterface::myRemoveStatement
ROSE_DLL_API void myRemoveStatement(SgStatement *stmt)
A special purpose statement removal function, originally from inlinerSupport.h, Need Jeremiah's atten...
SageInterface::insertStatementAfterLastDeclaration
ROSE_DLL_API void insertStatementAfterLastDeclaration(SgStatement *stmt, SgScopeStatement *scope)
Insert a statement after the last declaration within a scope. The statement will be prepended to the ...
SageInterface::changeContinuesToGotos
ROSE_DLL_API void changeContinuesToGotos(SgStatement *stmt, SgLabelStatement *label)
Change continue statements in a given block of code to gotos to a label.
SageInterface::findLastDeclarationStatement
SgStatement * findLastDeclarationStatement(SgScopeStatement *scope, bool includePragma=false)
Find the last declaration statement within a scope (if any). This is often useful to decide where to ...
SageInterface::insertStatement
ROSE_DLL_API void insertStatement(SgStatement *targetStmt, SgStatement *newStmt, bool insertBefore=true, bool autoMovePreprocessingInfo=true)
Insert a statement before or after the target statement within the target's scope....
SageInterface::declarationPreceedsDefinition
bool declarationPreceedsDefinition(SgDeclarationStatement *nonDefiningDeclaration, SgDeclarationStatement *definingDeclaration)
Check if a defining declaration comes before of after the non-defining declaration.
SageInterface::getEnclosingFileNode
ROSE_DLL_API SgFile * getEnclosingFileNode(SgNode *astNode)
get the SgFile node from current node
SageInterface::wrapAllTemplateInstantiationsInAssociatedNamespaces
ROSE_DLL_API void wrapAllTemplateInstantiationsInAssociatedNamespaces(SgProject *root)
Function to delete AST subtree's nodes only, users must take care of any dangling pointers,...
SageInterface::generateUniqueNameForUseAsIdentifier
std::string generateUniqueNameForUseAsIdentifier(SgDeclarationStatement *declaration)
Generate a useful name to support construction of identifiers from declarations.
SageInterface::setLoopUpperBound
ROSE_DLL_API void setLoopUpperBound(SgNode *loop, SgExpression *ub)
Set the upper bound of a loop header,regardless the condition expression type. for (i=lb; i op up,...
SgProject
This class represents a source project, with a list of SgFile objects and global information about th...
Definition: Cxx_Grammar.h:24060
SageInterface::getNextStatement
ROSE_DLL_API SgStatement * getNextStatement(SgStatement *currentStmt)
Get next statement within the same scope of current statement.
SageInterface::isPostfixOperator
bool isPostfixOperator(SgExpression *exp)
Is an overloaded operator a postfix operator. (e.g. ).
SgStatement
This class represents the notion of a statement.
Definition: Cxx_Grammar.h:122747
SageInterface::is_Fortran_language
ROSE_DLL_API bool is_Fortran_language()
Definition: sageInterface.h:655
SageInterface::replaceWithPattern
ROSE_DLL_API SgNode * replaceWithPattern(SgNode *anchor, SgNode *new_pattern)
Replace an anchor node with a specified pattern subtree with optional SgVariantExpression....
SageInterface::setOneSourcePositionNull
ROSE_DLL_API void setOneSourcePositionNull(SgNode *node)
Set current node's source position as NULL.
SageInterface::removeAllOriginalExpressionTrees
ROSE_DLL_API void removeAllOriginalExpressionTrees(SgNode *top)
Set original expression trees to NULL for SgValueExp or SgCastExp expressions, so you can change the ...
SageInterface::lookupTypedefSymbolInParentScopes
ROSE_DLL_API SgTypedefSymbol * lookupTypedefSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SageInterface::setLoopLowerBound
ROSE_DLL_API void setLoopLowerBound(SgNode *loop, SgExpression *lb)
Set the lower bound of a loop header for (i=lb; ...)
SageInterface::splitVariableDeclaration
ROSE_DLL_API SgExprStatement * splitVariableDeclaration(SgVariableDeclaration *decl)
Split a variable declaration with an rhs assignment into two statements: a declaration and an assignm...
SageInterface::buildAbstractHandle
ROSE_DLL_API AbstractHandle::abstract_handle * buildAbstractHandle(SgNode *)
Build an abstract handle from an AST node, reuse previously built handle when possible.
SgTemplateSymbol
Definition: Cxx_Grammar.h:326505
PreprocessingInfo
For preprocessing information including source comments, #include , #if, #define, etc.
Definition: rose_attributes_list.h:127
SageInterface::isAncestor
bool ROSE_DLL_API isAncestor(SgNode *node1, SgNode *node2)
check if node1 is a strict ancestor of node 2. (a node is not considered its own ancestor)
SageInterface::loopTiling
ROSE_DLL_API bool loopTiling(SgForStatement *loopNest, size_t targetLevel, size_t tileSize)
Tile the n-level (starting from 1) loop of a perfectly nested loop nest using tiling size s.
SgInitializer
This class represents the notion of an initializer for a variable declaration or expression in a func...
Definition: Cxx_Grammar.h:294701
SgTemplateMemberFunctionDeclaration
Definition: Cxx_Grammar.h:157682
SageInterface::isLambdaFunction
ROSE_DLL_API bool isLambdaFunction(SgFunctionDeclaration *func)
Check if a function declaration is a C++11 lambda function.
SageInterface::lookupTemplateVariableSymbolInParentScopes
ROSE_DLL_API SgTemplateVariableSymbol * lookupTemplateVariableSymbolInParentScopes(const SgName &name, SgTemplateParameterPtrList *tplparams, SgTemplateArgumentPtrList *tplargs, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
SgClassType
Definition: Cxx_Grammar.h:59461
SgExprStatement
This class represents the concept of a C or C++ statement which contains a expression.
Definition: Cxx_Grammar.h:173661
SageInterface::getFirstStatement
ROSE_DLL_API SgStatement * getFirstStatement(SgScopeStatement *scope, bool includingCompilerGenerated=false)
Get the first statement within a scope, return NULL if it does not exist. Skip compiler-generated sta...
SageInterface::getProject
ROSE_DLL_API SgProject * getProject()
Get the current SgProject IR Node.
SageInterface::declarationPositionString
std::string declarationPositionString(const SgDeclarationStatement *declaration)
Generate a unique string from the source file position information.
SgForInitStatement
This class represents the variable declaration or variable initialization withn a for loop.
Definition: Cxx_Grammar.h:179356
SageInterface::isMutable
bool ROSE_DLL_API isMutable(SgInitializedName *name)
True if an SgInitializedName is "mutable' (has storage modifier set)
SageInterface::removeJumpsToNextStatement
ROSE_DLL_API void removeJumpsToNextStatement(SgNode *)
Remove jumps whose label is immediately after the jump. Used to clean up inlined code fragments.
SgSymbol
This class represents the concept of a name within the compiler.
Definition: Cxx_Grammar.h:321018
SgPragmaDeclaration
This class represents the concept of a C Assembler statement (untested).
Definition: Cxx_Grammar.h:150372
SageInterface::collectReadWriteRefs
ROSE_DLL_API bool collectReadWriteRefs(SgStatement *stmt, std::vector< SgNode * > &readRefs, std::vector< SgNode * > &writeRefs, bool useCachedDefUse=false)
Collect all read and write references within stmt, which can be a function, a scope statement,...
SageInterface::sortSgNodeListBasedOnAppearanceOrderInSource
ROSE_DLL_API std::vector< SgDeclarationStatement * > sortSgNodeListBasedOnAppearanceOrderInSource(const std::vector< SgDeclarationStatement * > &nodevec)
Reorder a list of declaration statements based on their appearance order in source files.
SageInterface::getEnclosingScope
ROSE_DLL_API SgScopeStatement * getEnclosingScope(SgNode *n, const bool includingSelf=false)
Get the enclosing scope from a node n.
SageInterface::mangleModifierType
ROSE_DLL_API std::string mangleModifierType(SgModifierType *type)
Generated mangled modifier types, include const, volatile,according to Itanium C++ ABI,...
SageInterface::call_liveness_analysis
ROSE_DLL_API LivenessAnalysis * call_liveness_analysis(SgProject *project, bool debug=false)
Call liveness analysis on an entire project.
SageInterface::getDeclarationOfNamedFunction
SgFunctionDeclaration * getDeclarationOfNamedFunction(SgExpression *func)
Given a SgExpression that represents a named function (or bound member function), return the mentione...
SageInterface::mangleType
ROSE_DLL_API std::string mangleType(SgType *type)
Generate a mangled string for a given type based on Itanium C++ ABI.
SageInterface::findEnclosingSwitch
ROSE_DLL_API SgSwitchStatement * findEnclosingSwitch(SgStatement *s)
Find the closest switch outside a given statement (normally used for case and default statements)
SageInterface::fixNamespaceDeclaration
ROSE_DLL_API void fixNamespaceDeclaration(SgNamespaceDeclarationStatement *structDecl, SgScopeStatement *scope)
Fix symbols, parent and scope pointers. Used internally within appendStatment(), insertStatement() et...
SageInterface::addDefaultConstructorIfRequired
ROSE_DLL_API bool addDefaultConstructorIfRequired(SgClassType *classType, int physical_file_id=Sg_File_Info::TRANSFORMATION_FILE_ID)
Get the default destructor from the class declaration.
SageInterface::getElementType
ROSE_DLL_API SgType * getElementType(SgType *t)
Get the element type of an array, pointer or string, or NULL if not applicable. This function only ch...
SageInterface::appendStatementWithDependentDeclaration
ROSE_DLL_API void appendStatementWithDependentDeclaration(SgDeclarationStatement *decl, SgGlobal *scope, SgStatement *original_statement, bool excludeHeaderFiles)
Append a copy ('decl') of a function ('original_statement') into a 'scope', include any referenced de...