ROSE  0.11.96.11
transformationSupport.h
1 #ifndef ROSE_TRANSFORMATION_SUPPORT
2 #define ROSE_TRANSFORMATION_SUPPORT
3 
4 // #include "transformationOptions.h"
5 
6 #include "optionDeclaration.h"
7 
8 // Access to Query Libraries
9 #include "roseQueryLib.h"
10 
11 // include "nodeQuery.h"
12 // include "nameQuery.h"
13 // include "numberQuery.h"
14 
24 class ROSE_DLL_API TransformationSupport
25  {
26  public:
27 
38  {
40  FUNCTION_CALL_OPERATOR_CODE = 0,
41 
42  // binary operators
43  ADD_OPERATOR_CODE = 1,
44  SUBT_OPERATOR_CODE = 2,
45  MULT_OPERATOR_CODE = 3,
46  DIV_OPERATOR_CODE = 4,
47  INTEGER_DIV_OPERATOR_CODE = 5,
48  MOD_OPERATOR_CODE = 6,
49  AND_OPERATOR_CODE = 7,
50  OR_OPERATOR_CODE = 8,
51  BITXOR_OPERATOR_CODE = 9,
52  BITAND_OPERATOR_CODE = 10,
53  BITOR_OPERATOR_CODE = 11,
54  EQ_OPERATOR_CODE = 12,
55  LT_OPERATOR_CODE = 13,
56  GT_OPERATOR_CODE = 14,
57  NE_OPERATOR_CODE = 15,
58  LE_OPERATOR_CODE = 16,
59  GE_OPERATOR_CODE = 17,
60  ASSIGN_OPERATOR_CODE = 18,
61  PLUS_ASSIGN_OPERATOR_CODE = 19,
62  MINUS_ASSIGN_OPERATOR_CODE = 20,
63  AND_ASSIGN_OPERATOR_CODE = 21,
64  IOR_ASSIGN_OPERATOR_CODE = 22,
65  MULT_ASSIGN_OPERATOR_CODE = 23,
66  DIV_ASSIGN_OPERATOR_CODE = 24,
67  MOD_ASSIGN_OPERATOR_CODE = 25,
68  XOR_ASSIGN_OPERATOR_CODE = 26,
69 
70  // operator() and operator[]
71  PARENTHESIS_OPERATOR_CODE = 27,
72  BRACKET_OPERATOR_CODE = 28,
73 
74  // unary operators
75  NOT_OPERATOR_CODE = 29,
76  DEREFERENCE_OPERATOR_CODE = 30,
77  ADDRESS_OPERATOR_CODE = 31,
78  LSHIFT_OPERATOR_CODE = 32,
79  RSHIFT_OPERATOR_CODE = 33,
80  LSHIFT_ASSIGN_OPERATOR_CODE = 34,
81  RSHIFT_ASSIGN_OPERATOR_CODE = 35,
82  PREFIX_PLUSPLUS_OPERATOR_CODE = 36,
83  POSTFIX_PLUSPLUS_OPERATOR_CODE = 37,
84  PREFIX_MINUSMINUS_OPERATOR_CODE = 38,
85  POSTFIX_MINUSMINUS_OPERATOR_CODE = 39,
86 
87  // End of list tag
88  OPERATOR_CODE_LAST_TAG = 99
89  };
90 
97  static std::string stringifyOperator (std::string name);
98 
108  static operatorCodeType classifyOverloadedOperator (
109  std::string name,
110  int numberOfParameters = 0,
111  bool prefixOperator = false);
112 
119  static std::string buildOperatorString ( SgNode* astNode );
120 
122  static std::string getFunctionName ( SgFunctionCallExp* functionCallExp );
123 
125  static std::string getTypeName ( SgType* type );
126 
133  static std::string getFunctionTypeName ( SgFunctionCallExp* functionCallExpression );
134 
141  static std::string buildMacro ( std::string s );
142 
160  static void getTransformationOptions (
161  SgNode* astNode,
162  std::list<OptionDeclaration> & variableNameList,
163  std::string identifingTypeName );
164 
172  static void getTransformationOptions (
173  SgNode* astNode,
174  std::list<int> & variableNameList,
175  std::string identifingTypeName );
176 
181  static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
182  SgVariableDeclaration* variableDeclaration,
183  std::list<int> & returnList );
184 
189  static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
190  SgVariableDeclaration* variableDeclaration,
191  std::list<OptionDeclaration> & returnList );
202  static std::string internalSupportingGlobalDeclarations( SgNode* astNode, std::string prefixString );
203 
204  // DQ (9/26/03) Added here to eliminate ProjectQueryLibrary
205  // (which as mostly an experiment with the reverse traversal)
206  static SgProject* getProject( const SgNode* astNode);
207  static SgDirectory* getDirectory( const SgNode* astNode);
208  static SgFile* getFile( const SgNode* astNode);
209  static SgSourceFile* getSourceFile( const SgNode* astNode);
210  static SgGlobal* getGlobalScope( const SgNode* astNode);
211  static SgStatement* getStatement(const SgNode* astNode);
212  static SgFunctionDeclaration* getFunctionDeclaration( const SgNode* astNode);
213  static SgFunctionDefinition* getFunctionDefinition( const SgNode* astNode);
214  static SgClassDefinition* getClassDefinition( const SgNode* astNode);
215  static SgModuleStatement* getModuleStatement( const SgNode* astNode);
216 
217  // DQ (7/25/2012): Modified to reflect new template design using different types of template IR nodes.
218  // static SgTemplateDeclaration* getTemplateDeclaration( const SgNode* astNode);
219  static SgDeclarationStatement* getTemplateDeclaration( const SgNode* astNode);
220 
221  // DQ (8/19/2014): Iterate back through the parents and scopes to find the SgType that the current node is embedded into.
226  static SgType* getAssociatedType( const SgNode* astNode );
227 
228  // DQ (5/11/2011): This function was moved to SgTemplateArgument a long time ago and is not longer available.
229  // DQ (6/9/2007): This function traverses through the parents to the first scope (used for name qualification support of template arguments)
230  // static SgScopeStatement* getScope(const SgNode* astNode);
231 
232  // static SgValueExp* getValueExpr(const SgNode* astNode);
233  };
234 
235 // endif for ROSE_TRANSFORMATION_SUPPORT
236 #endif
237 
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 
256 
TransformationSupport
This class simplifies the development of queries on the AST resulting in a list of AST nodes.
Definition: transformationSupport.h:24
SgClassDefinition
This class represents the concept of a class definition in C++.
Definition: Cxx_Grammar.h:127505
SgGlobal
This class represents the concept of a namespace definition.
Definition: Cxx_Grammar.h:124392
SgFile
This class represents a source file for a project (which may contian many source files and or directo...
Definition: Cxx_Grammar.h:21163
SgType
This class represents the base class for all types.
Definition: Cxx_Grammar.h:43961
SgFunctionCallExp
This class represents the concept of a C++ function call (which is an expression).
Definition: Cxx_Grammar.h:288304
SgFunctionDeclaration
This class represents the concept of a function declaration statement.
Definition: Cxx_Grammar.h:155826
SgDirectory
This class represents a directory within a projects file structure of files and directories.
Definition: Cxx_Grammar.h:30143
TransformationSupport::operatorCodeType
operatorCodeType
Definition: transformationSupport.h:37
SgDeclarationStatement
This class represents the concept of a declaration statement.
Definition: Cxx_Grammar.h:136861
SgNode
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:6739
SgModuleStatement
Definition: Cxx_Grammar.h:153453
SgSourceFile
Definition: Cxx_Grammar.h:22972
SgFunctionDefinition
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
Definition: Cxx_Grammar.h:126549
SgVariableDeclaration
This class represents the concept of a C or C++ variable declaration.
Definition: Cxx_Grammar.h:138274
SgProject
This class represents a source project, with a list of SgFile objects and global information about th...
Definition: Cxx_Grammar.h:24060
SgStatement
This class represents the notion of a statement.
Definition: Cxx_Grammar.h:122747