ROSE  0.9.9.109
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 );
124  static std::string getTypeName ( SgType* type );
125 
132  static std::string getFunctionTypeName ( SgFunctionCallExp* functionCallExpression );
133 
140  static std::string buildMacro ( std::string s );
141 
159  static void getTransformationOptions (
160  SgNode* astNode,
161  std::list<OptionDeclaration> & variableNameList,
162  std::string identifingTypeName );
163 
171  static void getTransformationOptions (
172  SgNode* astNode,
173  std::list<int> & variableNameList,
174  std::string identifingTypeName );
175 
180  static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
181  SgVariableDeclaration* variableDeclaration,
182  std::list<int> & returnList );
183 
188  static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
189  SgVariableDeclaration* variableDeclaration,
190  std::list<OptionDeclaration> & returnList );
201  static std::string internalSupportingGlobalDeclarations( SgNode* astNode, std::string prefixString );
202 
203  // DQ (9/26/03) Added here to eliminate ProjectQueryLibrary
204  // (which as mostly an experiment with the reverse traversal)
205  static SgProject* getProject( const SgNode* astNode);
206  static SgDirectory* getDirectory( const SgNode* astNode);
207  static SgFile* getFile( const SgNode* astNode);
208  static SgSourceFile* getSourceFile( const SgNode* astNode);
209  static SgBinaryComposite* getBinaryFile( 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 
This class represents a source file for a project (which may contian many source files and or directo...
This class represents the base class for all types.
This class simplifies the development of queries on the AST resulting in a list of AST nodes...
This class represents the concept of a function declaration statement.
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.).
This class represents a directory within a projects file structure of files and directories.
This class represents the concept of a class definition in C++.
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:8322
This class represents the notion of a statement.
This class represents the concept of a namespace definition.
This class represents a source project, with a list of SgFile objects and global information about th...
This class represents the concept of a C or C++ variable declaration.
This class represents the concept of a C++ function call (which is an expression).
This class represents the concept of a declaration statement.