ROSE  0.9.11.56
sageGeneric.h
Go to the documentation of this file.
1 #ifndef _SAGEGENERIC_H
2 
3 #define _SAGEGENERIC_H
4 
11 
12 // note: the comments are right aligned to support code-blocks doxygen 1.3.X :)
13 
14 #include <stdexcept>
15 
16 #if !defined(NDEBUG)
17 #include <typeinfo>
18 #include <iostream>
19 #include <sstream>
20 #endif /* NDEBUG */
21 
22 
23 #define WITH_BINARY_ANALYSIS 0
24 
25 // #include "Cxx_Grammar.h"
26 
27 // DQ (10/5/2014): We can't include this here.
28 // #include "rose.h"
29 
30 
31 namespace sg
32 {
33  //
34  // non sage specific utilities
35 
38  template <class T>
39  static inline
40  void unused(const T&) {}
41 
43  template <class T>
44  T& deref(T* ptr)
45  {
46  assert(ptr);
47  return *ptr;
48  }
49 
51  template <class T1, class T2>
52  struct ConstLike
53  {
54  typedef T2 type;
55  };
56 
57  template <class T1, class T2>
58  struct ConstLike<const T1, T2>
59  {
60  typedef const T2 type;
61  };
62 
63  //
64  // error reporting
65 
66 #define SG_UNEXPECTED_NODE(X) (sg::unexpected_node(X, __FILE__, __LINE__))
67 
68  static inline
69  void report_error(std::string desc)
70  {
71  throw std::logic_error(desc);
72  }
73 
74  static inline
75  void report_error_if(bool iserror, std::string desc)
76  {
77  if (!iserror) return;
78 
79  report_error(desc);
80  }
81 
82 #if !defined(NDEBUG)
83  template <class T, class E>
85  static inline
86  T conv(const E& el)
87  {
88  std::stringstream s;
89  T res;
90 
91  s << el;
92  s >> res;
93  return res;
94  }
95 #endif
96 
97  static inline
98  void unexpected_node(const SgNode& n, const char* file = 0, size_t ln = 0)
99  {
100  sg::unused(n), sg::unused(file), sg::unused(ln);
101 
102  std::string msg = "unexpected node-type: ";
103 
104 #if !defined(NDEBUG)
105  msg = msg + typeid(n).name();
106 
107  if (file)
108  {
109  const std::string at(" at ");
110  const std::string sep(" : ");
111  const std::string num(conv<std::string>(ln));
112 
113  msg = msg + at + file + sep + num;
114  }
115 
116  std::cerr << msg << std::endl;
117 #endif
118 
119  report_error(msg);
120  }
121 
122  //
123  // Convenience class
124 
125  template <class _ReturnType>
127  {
128  typedef _ReturnType ReturnType;
130 
132  : res()
133  {}
134 
135  explicit
136  DispatchHandler(const ReturnType& defaultval)
137  : res(defaultval)
138  {}
139 
140  operator ReturnType() const { return res; }
141 
142  protected:
143  ReturnType res;
144  };
145 
146 
147  //
148  // Sage query functions
149 
151  template <class SageNode>
152  static inline
153  SageNode& assume_sage_type(SgNode& n)
154  {
155  return static_cast<SageNode&>(n);
156  }
157 
160  template <class SageNode>
161  static inline
162  const SageNode& assume_sage_type(const SgNode& n)
163  {
164  return static_cast<const SageNode&>(n);
165  }
166 
167 #define GEN_VISIT(X) \
168  void visit(X * n) { rv.handle(*n); }
169 
170  template <class RoseVisitor>
172  {
173  explicit
174  VisitDispatcher(const RoseVisitor& rosevisitor)
175  : rv(rosevisitor)
176  {}
177 
178  GEN_VISIT(SgNode)
179 
180  GEN_VISIT(SgName)
181  GEN_VISIT(SgSymbolTable)
182  GEN_VISIT(SgPragma)
183  GEN_VISIT(SgModifierNodes)
184  GEN_VISIT(SgConstVolatileModifier)
185  GEN_VISIT(SgStorageModifier)
186  GEN_VISIT(SgAccessModifier)
187  GEN_VISIT(SgFunctionModifier)
188  GEN_VISIT(SgUPC_AccessModifier)
189  GEN_VISIT(SgLinkageModifier)
190  GEN_VISIT(SgSpecialFunctionModifier)
191  GEN_VISIT(SgTypeModifier)
192  GEN_VISIT(SgElaboratedTypeModifier)
193  GEN_VISIT(SgBaseClassModifier)
194  GEN_VISIT(SgDeclarationModifier)
195  GEN_VISIT(SgOpenclAccessModeModifier)
196  GEN_VISIT(SgModifier)
197  GEN_VISIT(Sg_File_Info)
198  GEN_VISIT(SgSourceFile)
199 
200  GEN_VISIT(SgUnknownFile)
201  GEN_VISIT(SgFile)
202  GEN_VISIT(SgFileList)
203  GEN_VISIT(SgDirectory)
204  GEN_VISIT(SgDirectoryList)
205  GEN_VISIT(SgProject)
206  GEN_VISIT(SgOptions)
207  GEN_VISIT(SgUnparse_Info)
208  GEN_VISIT(SgFuncDecl_attr)
209  GEN_VISIT(SgClassDecl_attr)
210  GEN_VISIT(SgTypedefSeq)
211  GEN_VISIT(SgFunctionParameterTypeList)
212  GEN_VISIT(SgTemplateParameter)
213  GEN_VISIT(SgTemplateArgument)
214  GEN_VISIT(SgTemplateParameterList)
215  GEN_VISIT(SgTemplateArgumentList)
220  GEN_VISIT(SgTemplateParameterVal)
221  GEN_VISIT(SgTemplateFunctionRefExp)
223  GEN_VISIT(SgTypeTraitBuiltinOperator)
224  GEN_VISIT(SgBitAttribute)
225  GEN_VISIT(SgAttribute)
226  GEN_VISIT(SgBaseClass)
227  GEN_VISIT(SgUndirectedGraphEdge)
228  GEN_VISIT(SgDirectedGraphEdge)
229  GEN_VISIT(SgGraphNode)
230  GEN_VISIT(SgGraphEdge)
233  GEN_VISIT(SgBidirectionalGraph)
234  GEN_VISIT(SgIncidenceDirectedGraph)
235  GEN_VISIT(SgIncidenceUndirectedGraph)
236  GEN_VISIT(SgGraph)
237  GEN_VISIT(SgGraphNodeList)
238  GEN_VISIT(SgGraphEdgeList)
239  GEN_VISIT(SgQualifiedName)
240  GEN_VISIT(SgNameGroup)
241  GEN_VISIT(SgCommonBlockObject)
242  GEN_VISIT(SgDimensionObject)
243  GEN_VISIT(SgDataStatementGroup)
244  GEN_VISIT(SgDataStatementObject)
245  GEN_VISIT(SgDataStatementValue)
246  GEN_VISIT(SgFormatItem)
247  GEN_VISIT(SgFormatItemList)
248  GEN_VISIT(SgTypeTable)
249  GEN_VISIT(SgSupport)
250  GEN_VISIT(SgForStatement)
251  GEN_VISIT(SgMatlabForStatement)
252  GEN_VISIT(SgForInitStatement)
253  GEN_VISIT(SgCatchStatementSeq)
254  GEN_VISIT(SgFunctionParameterList)
255  GEN_VISIT(SgCtorInitializerList)
256  GEN_VISIT(SgBasicBlock)
257  GEN_VISIT(SgGlobal)
258  GEN_VISIT(SgIfStmt)
259  GEN_VISIT(SgFunctionDefinition)
260  GEN_VISIT(SgWhileStmt)
261  GEN_VISIT(SgDoWhileStmt)
262  GEN_VISIT(SgSwitchStatement)
263  GEN_VISIT(SgCatchOptionStmt)
264  GEN_VISIT(SgVariableDeclaration)
265  GEN_VISIT(SgVariableDefinition)
266  GEN_VISIT(SgEnumDeclaration)
267  GEN_VISIT(SgAsmStmt)
268  GEN_VISIT(SgTypedefDeclaration)
269  GEN_VISIT(SgFunctionTypeTable)
270  GEN_VISIT(SgExprStatement)
271  GEN_VISIT(SgLabelStatement)
272  GEN_VISIT(SgCaseOptionStmt)
273  GEN_VISIT(SgTryStmt)
274  GEN_VISIT(SgDefaultOptionStmt)
275  GEN_VISIT(SgBreakStmt)
276  GEN_VISIT(SgContinueStmt)
277  GEN_VISIT(SgReturnStmt)
278  GEN_VISIT(SgGotoStatement)
279  GEN_VISIT(SgSpawnStmt)
280  GEN_VISIT(SgNullStatement)
281  GEN_VISIT(SgVariantStatement)
282  GEN_VISIT(SgPragmaDeclaration)
283  GEN_VISIT(SgTemplateDeclaration)
284  GEN_VISIT(SgTemplateInstantiationDecl)
285  GEN_VISIT(SgTemplateInstantiationDefn)
286  GEN_VISIT(SgTemplateClassDeclaration)
287  GEN_VISIT(SgTemplateClassDefinition)
290  GEN_VISIT(SgProgramHeaderStatement)
291  GEN_VISIT(SgProcedureHeaderStatement)
292  GEN_VISIT(SgEntryStatement)
293  GEN_VISIT(SgFortranNonblockedDo)
294  GEN_VISIT(SgInterfaceStatement)
295  GEN_VISIT(SgParameterStatement)
296  GEN_VISIT(SgCommonBlock)
297  GEN_VISIT(SgModuleStatement)
298  GEN_VISIT(SgUseStatement)
299  GEN_VISIT(SgStopOrPauseStatement)
300  GEN_VISIT(SgPrintStatement)
301  GEN_VISIT(SgReadStatement)
302  GEN_VISIT(SgWriteStatement)
303  GEN_VISIT(SgOpenStatement)
304  GEN_VISIT(SgCloseStatement)
305  GEN_VISIT(SgInquireStatement)
306  GEN_VISIT(SgFlushStatement)
307  GEN_VISIT(SgBackspaceStatement)
308  GEN_VISIT(SgRewindStatement)
309  GEN_VISIT(SgEndfileStatement)
310  GEN_VISIT(SgWaitStatement)
311  GEN_VISIT(SgCAFWithTeamStatement)
312  GEN_VISIT(SgFormatStatement)
313  GEN_VISIT(SgFortranDo)
314  GEN_VISIT(SgForAllStatement)
315  GEN_VISIT(SgIOStatement)
316  GEN_VISIT(SgUpcNotifyStatement)
317  GEN_VISIT(SgUpcWaitStatement)
318  GEN_VISIT(SgUpcBarrierStatement)
319  GEN_VISIT(SgUpcFenceStatement)
320  GEN_VISIT(SgUpcForAllStatement)
321  GEN_VISIT(SgOmpParallelStatement)
322  GEN_VISIT(SgOmpSingleStatement)
323  GEN_VISIT(SgOmpSimdStatement)
324  GEN_VISIT(SgOmpTaskStatement)
325  GEN_VISIT(SgOmpForStatement)
326  GEN_VISIT(SgOmpForSimdStatement)
327  GEN_VISIT(SgOmpDoStatement)
328  GEN_VISIT(SgOmpSectionsStatement)
329  GEN_VISIT(SgOmpClauseBodyStatement)
330  GEN_VISIT(SgOmpAtomicStatement)
331  GEN_VISIT(SgOmpMasterStatement)
332  GEN_VISIT(SgOmpSectionStatement)
333  GEN_VISIT(SgOmpOrderedStatement)
334  GEN_VISIT(SgOmpWorkshareStatement)
335  GEN_VISIT(SgOmpCriticalStatement)
336  GEN_VISIT(SgOmpBodyStatement)
337  GEN_VISIT(SgBlockDataStatement)
338  GEN_VISIT(SgImplicitStatement)
340  GEN_VISIT(SgWhereStatement)
341  GEN_VISIT(SgNullifyStatement)
342  GEN_VISIT(SgEquivalenceStatement)
343  GEN_VISIT(SgDerivedTypeStatement)
345  GEN_VISIT(SgAllocateStatement)
346  GEN_VISIT(SgDeallocateStatement)
347  GEN_VISIT(SgContainsStatement)
348  GEN_VISIT(SgSequenceStatement)
349  GEN_VISIT(SgElseWhereStatement)
350  GEN_VISIT(SgArithmeticIfStatement)
351  GEN_VISIT(SgAssignStatement)
352  GEN_VISIT(SgComputedGotoStatement)
353  GEN_VISIT(SgAssignedGotoStatement)
354  GEN_VISIT(SgNamelistStatement)
355  GEN_VISIT(SgImportStatement)
356  GEN_VISIT(SgAssociateStatement)
357  GEN_VISIT(SgFortranIncludeLine)
361  GEN_VISIT(SgUsingDeclarationStatement)
362  GEN_VISIT(SgUsingDirectiveStatement)
364  GEN_VISIT(SgClassDeclaration)
365  GEN_VISIT(SgClassDefinition)
366  GEN_VISIT(SgScopeStatement)
367  GEN_VISIT(SgMemberFunctionDeclaration)
368  GEN_VISIT(SgFunctionDeclaration)
369  GEN_VISIT(SgIncludeDirectiveStatement)
370  GEN_VISIT(SgDefineDirectiveStatement)
371  GEN_VISIT(SgUndefDirectiveStatement)
372  GEN_VISIT(SgIfdefDirectiveStatement)
373  GEN_VISIT(SgIfndefDirectiveStatement)
374  GEN_VISIT(SgIfDirectiveStatement)
375  GEN_VISIT(SgDeadIfDirectiveStatement)
376  GEN_VISIT(SgElseDirectiveStatement)
377  GEN_VISIT(SgElseifDirectiveStatement)
378  GEN_VISIT(SgEndifDirectiveStatement)
379  GEN_VISIT(SgLineDirectiveStatement)
380  GEN_VISIT(SgWarningDirectiveStatement)
381  GEN_VISIT(SgErrorDirectiveStatement)
382  GEN_VISIT(SgEmptyDirectiveStatement)
384  GEN_VISIT(SgIdentDirectiveStatement)
387  GEN_VISIT(SgClinkageStartStatement)
388  GEN_VISIT(SgClinkageEndStatement)
390  GEN_VISIT(SgOmpFlushStatement)
391  GEN_VISIT(SgOmpDeclareSimdStatement)
392  GEN_VISIT(SgOmpBarrierStatement)
393  GEN_VISIT(SgOmpTaskwaitStatement)
394  GEN_VISIT(SgOmpThreadprivateStatement)
395  GEN_VISIT(SgDeclarationStatement)
396  GEN_VISIT(SgExprListExp)
397  GEN_VISIT(SgVarRefExp)
398  GEN_VISIT(SgLabelRefExp)
399  GEN_VISIT(SgClassNameRefExp)
400  GEN_VISIT(SgFunctionRefExp)
401  GEN_VISIT(SgMemberFunctionRefExp)
402  GEN_VISIT(SgFunctionCallExp)
403  GEN_VISIT(SgSizeOfOp)
404  GEN_VISIT(SgUpcLocalsizeofExpression)
405  GEN_VISIT(SgUpcBlocksizeofExpression)
406  GEN_VISIT(SgUpcElemsizeofExpression)
407  GEN_VISIT(SgVarArgStartOp)
408  GEN_VISIT(SgVarArgStartOneOperandOp)
409  GEN_VISIT(SgVarArgOp)
410  GEN_VISIT(SgVarArgEndOp)
411  GEN_VISIT(SgVarArgCopyOp)
412  GEN_VISIT(SgTypeIdOp)
413  GEN_VISIT(SgConditionalExp)
414  GEN_VISIT(SgNewExp)
415  GEN_VISIT(SgDeleteExp)
416  GEN_VISIT(SgThisExp)
417  GEN_VISIT(SgRefExp)
418  GEN_VISIT(SgAggregateInitializer)
419  GEN_VISIT(SgConstructorInitializer)
420  GEN_VISIT(SgAssignInitializer)
421  GEN_VISIT(SgExpressionRoot)
422  GEN_VISIT(SgMinusOp)
423  GEN_VISIT(SgUnaryAddOp)
424  GEN_VISIT(SgNotOp)
425  GEN_VISIT(SgPointerDerefExp)
426  GEN_VISIT(SgAddressOfOp)
427  GEN_VISIT(SgMinusMinusOp)
428  GEN_VISIT(SgPlusPlusOp)
429  GEN_VISIT(SgBitComplementOp)
430  GEN_VISIT(SgRealPartOp)
431  GEN_VISIT(SgImagPartOp)
432  GEN_VISIT(SgConjugateOp)
433  GEN_VISIT(SgCastExp)
434  GEN_VISIT(SgThrowOp)
435  GEN_VISIT(SgArrowExp)
436  GEN_VISIT(SgDotExp)
437  GEN_VISIT(SgDotStarOp)
438  GEN_VISIT(SgArrowStarOp)
439  GEN_VISIT(SgEqualityOp)
440  GEN_VISIT(SgLessThanOp)
441  GEN_VISIT(SgGreaterThanOp)
442  GEN_VISIT(SgNotEqualOp)
443  GEN_VISIT(SgLessOrEqualOp)
444  GEN_VISIT(SgGreaterOrEqualOp)
445  GEN_VISIT(SgAddOp)
446  GEN_VISIT(SgSubtractOp)
447  GEN_VISIT(SgMultiplyOp)
448  GEN_VISIT(SgDivideOp)
449  GEN_VISIT(SgIntegerDivideOp)
450  GEN_VISIT(SgModOp)
451  GEN_VISIT(SgAndOp)
452  GEN_VISIT(SgOrOp)
453  GEN_VISIT(SgBitXorOp)
454  GEN_VISIT(SgBitAndOp)
455  GEN_VISIT(SgBitOrOp)
456  GEN_VISIT(SgCommaOpExp)
457  GEN_VISIT(SgLshiftOp)
458  GEN_VISIT(SgRshiftOp)
459  GEN_VISIT(SgPntrArrRefExp)
460  GEN_VISIT(SgScopeOp)
461  GEN_VISIT(SgAssignOp)
462  GEN_VISIT(SgPlusAssignOp)
463  GEN_VISIT(SgMinusAssignOp)
464  GEN_VISIT(SgAndAssignOp)
465  GEN_VISIT(SgIorAssignOp)
466  GEN_VISIT(SgMultAssignOp)
467  GEN_VISIT(SgDivAssignOp)
468  GEN_VISIT(SgModAssignOp)
469  GEN_VISIT(SgXorAssignOp)
470  GEN_VISIT(SgLshiftAssignOp)
471  GEN_VISIT(SgRshiftAssignOp)
472  GEN_VISIT(SgConcatenationOp)
473  GEN_VISIT(SgBoolValExp)
474  GEN_VISIT(SgStringVal)
475  GEN_VISIT(SgShortVal)
476  GEN_VISIT(SgCharVal)
477  GEN_VISIT(SgUnsignedCharVal)
478  GEN_VISIT(SgWcharVal)
479  GEN_VISIT(SgUnsignedShortVal)
480  GEN_VISIT(SgIntVal)
481  GEN_VISIT(SgEnumVal)
482  GEN_VISIT(SgUnsignedIntVal)
483  GEN_VISIT(SgLongIntVal)
484  GEN_VISIT(SgLongLongIntVal)
485  GEN_VISIT(SgUnsignedLongLongIntVal)
486  GEN_VISIT(SgUnsignedLongVal)
487  GEN_VISIT(SgFloatVal)
488  GEN_VISIT(SgDoubleVal)
489  GEN_VISIT(SgLongDoubleVal)
490  GEN_VISIT(SgUpcThreads)
491  GEN_VISIT(SgUpcMythread)
492  GEN_VISIT(SgComplexVal)
493  GEN_VISIT(SgNullExpression)
494  GEN_VISIT(SgVariantExpression)
495  GEN_VISIT(SgStatementExpression)
496  GEN_VISIT(SgAsmOp)
497  GEN_VISIT(SgCudaKernelExecConfig)
498  GEN_VISIT(SgCudaKernelCallExp)
499  GEN_VISIT(SgSubscriptExpression)
500  GEN_VISIT(SgColonShapeExp)
501  GEN_VISIT(SgAsteriskShapeExp)
502  GEN_VISIT(SgIOItemExpression)
503  GEN_VISIT(SgImpliedDo)
504  GEN_VISIT(SgExponentiationOp)
506  GEN_VISIT(SgActualArgumentExpression)
507  GEN_VISIT(SgUserDefinedBinaryOp)
508  GEN_VISIT(SgPointerAssignOp)
509  GEN_VISIT(SgCAFCoExpression)
510  GEN_VISIT(SgDesignatedInitializer)
511  GEN_VISIT(SgInitializer)
512  GEN_VISIT(SgUserDefinedUnaryOp)
513  GEN_VISIT(SgPseudoDestructorRefExp)
514  GEN_VISIT(SgUnaryOp)
515  GEN_VISIT(SgBinaryOp)
516  GEN_VISIT(SgValueExp)
517  GEN_VISIT(SgRangeExp)
518  GEN_VISIT(SgMatrixTransposeOp)
519  GEN_VISIT(SgVariableSymbol)
520  GEN_VISIT(SgFunctionTypeSymbol)
521  GEN_VISIT(SgClassSymbol)
522  GEN_VISIT(SgTemplateSymbol)
523  GEN_VISIT(SgEnumSymbol)
524  GEN_VISIT(SgEnumFieldSymbol)
525  GEN_VISIT(SgTypedefSymbol)
526  GEN_VISIT(SgMemberFunctionSymbol)
527  GEN_VISIT(SgLabelSymbol)
528  GEN_VISIT(SgDefaultSymbol)
529  GEN_VISIT(SgNamespaceSymbol)
530  GEN_VISIT(SgIntrinsicSymbol)
531  GEN_VISIT(SgModuleSymbol)
532  GEN_VISIT(SgInterfaceSymbol)
533  GEN_VISIT(SgCommonSymbol)
534  GEN_VISIT(SgRenameSymbol)
535  GEN_VISIT(SgFunctionSymbol)
536  GEN_VISIT(SgAsmBinaryAddressSymbol)
537  GEN_VISIT(SgAsmBinaryDataSymbol)
538  GEN_VISIT(SgAliasSymbol)
539  GEN_VISIT(SgSymbol)
540 
541 #if WITH_BINARY_ANALYSIS
542  GEN_VISIT(SgBinaryComposite)
543  GEN_VISIT(SgAsmBlock)
544  GEN_VISIT(SgAsmOperandList)
545  GEN_VISIT(SgAsmArmInstruction)
546  GEN_VISIT(SgAsmX86Instruction)
547  GEN_VISIT(SgAsmPowerpcInstruction)
548  GEN_VISIT(SgAsmInstruction)
549  GEN_VISIT(SgAsmStatement)
550  GEN_VISIT(SgAsmBinaryAdd)
551  GEN_VISIT(SgAsmBinarySubtract)
552  GEN_VISIT(SgAsmBinaryMultiply)
553  GEN_VISIT(SgAsmBinaryDivide)
554  GEN_VISIT(SgAsmBinaryMod)
555  GEN_VISIT(SgAsmBinaryAddPreupdate)
557  GEN_VISIT(SgAsmBinaryAddPostupdate)
559  GEN_VISIT(SgAsmBinaryLsl)
560  GEN_VISIT(SgAsmBinaryLsr)
561  GEN_VISIT(SgAsmBinaryAsr)
562  GEN_VISIT(SgAsmBinaryRor)
563  GEN_VISIT(SgAsmBinaryExpression)
564  GEN_VISIT(SgAsmUnaryPlus)
565  GEN_VISIT(SgAsmUnaryMinus)
566  GEN_VISIT(SgAsmUnaryRrx)
568  GEN_VISIT(SgAsmUnaryExpression)
570  GEN_VISIT(SgAsmControlFlagsExpression)
571  GEN_VISIT(SgAsmCommonSubExpression)
574  GEN_VISIT(SgAsmIntegerValueExpression)
575  GEN_VISIT(SgAsmFloatValueExpression)
576  GEN_VISIT(SgAsmValueExpression)
577  GEN_VISIT(SgAsmExprListExp)
578  GEN_VISIT(SgAsmExpression)
579  GEN_VISIT(SgAsmIntegerType)
580  GEN_VISIT(SgAsmFloatType)
581  GEN_VISIT(SgAsmScalarType)
582  GEN_VISIT(SgAsmVectorType)
583  GEN_VISIT(SgAsmType)
584  GEN_VISIT(SgAsmGenericDLL)
585  GEN_VISIT(SgAsmPEImportItemList)
586  GEN_VISIT(SgAsmPEImportDirectoryList)
587  GEN_VISIT(SgAsmGenericFormat)
588  GEN_VISIT(SgAsmGenericFile)
589  GEN_VISIT(SgAsmElfFileHeader)
590  GEN_VISIT(SgAsmPEFileHeader)
591  GEN_VISIT(SgAsmNEFileHeader)
592  GEN_VISIT(SgAsmLEFileHeader)
593  GEN_VISIT(SgAsmDOSFileHeader)
594  GEN_VISIT(SgAsmGenericHeader)
595  GEN_VISIT(SgAsmElfRelocSection)
596  GEN_VISIT(SgAsmElfDynamicSection)
597  GEN_VISIT(SgAsmElfSymbolSection)
598  GEN_VISIT(SgAsmElfStringSection)
599  GEN_VISIT(SgAsmElfEHFrameSection)
600  GEN_VISIT(SgAsmElfNoteSection)
601  GEN_VISIT(SgAsmElfSymverSection)
603  GEN_VISIT(SgAsmElfSymverNeededSection)
604  GEN_VISIT(SgAsmElfStrtab)
605  GEN_VISIT(SgAsmCoffStrtab)
606  GEN_VISIT(SgAsmGenericStrtab)
607  GEN_VISIT(SgAsmElfSection)
608  GEN_VISIT(SgAsmElfSectionTable)
609  GEN_VISIT(SgAsmElfSegmentTable)
610  GEN_VISIT(SgAsmPEImportSection)
611  GEN_VISIT(SgAsmPEExportSection)
612  GEN_VISIT(SgAsmPEStringSection)
613  GEN_VISIT(SgAsmPESection)
614  GEN_VISIT(SgAsmPESectionTable)
615  GEN_VISIT(SgAsmCoffSymbolTable)
616  GEN_VISIT(SgAsmDOSExtendedHeader)
617  GEN_VISIT(SgAsmNESection)
618  GEN_VISIT(SgAsmNESectionTable)
619  GEN_VISIT(SgAsmNENameTable)
620  GEN_VISIT(SgAsmNEModuleTable)
621  GEN_VISIT(SgAsmNEStringTable)
622  GEN_VISIT(SgAsmNEEntryTable)
623  GEN_VISIT(SgAsmNERelocTable)
624  GEN_VISIT(SgAsmLESection)
625  GEN_VISIT(SgAsmLESectionTable)
626  GEN_VISIT(SgAsmLENameTable)
627  GEN_VISIT(SgAsmLEPageTable)
628  GEN_VISIT(SgAsmLEEntryTable)
629  GEN_VISIT(SgAsmLERelocTable)
630  GEN_VISIT(SgAsmGenericSection)
631  GEN_VISIT(SgAsmCoffSymbol)
632  GEN_VISIT(SgAsmElfSymbol)
633  GEN_VISIT(SgAsmGenericSymbol)
634  GEN_VISIT(SgAsmElfSectionTableEntry)
635  GEN_VISIT(SgAsmElfSegmentTableEntry)
637  GEN_VISIT(SgAsmElfRelocEntry)
638  GEN_VISIT(SgAsmElfRelocEntryList)
639  GEN_VISIT(SgAsmElfDynamicEntry)
640  GEN_VISIT(SgAsmElfDynamicEntryList)
641  GEN_VISIT(SgAsmElfEHFrameEntryCI)
642  GEN_VISIT(SgAsmElfEHFrameEntryCIList)
643  GEN_VISIT(SgAsmElfEHFrameEntryFD)
644  GEN_VISIT(SgAsmElfEHFrameEntryFDList)
645  GEN_VISIT(SgAsmElfNoteEntry)
646  GEN_VISIT(SgAsmElfNoteEntryList)
647  GEN_VISIT(SgAsmElfSymverEntry)
648  GEN_VISIT(SgAsmElfSymverEntryList)
649  GEN_VISIT(SgAsmElfSymverDefinedEntry)
651  GEN_VISIT(SgAsmElfSymverDefinedAux)
653  GEN_VISIT(SgAsmElfSymverNeededEntry)
655  GEN_VISIT(SgAsmElfSymverNeededAux)
656  GEN_VISIT(SgAsmElfSymverNeededAuxList)
657  GEN_VISIT(SgAsmPERVASizePair)
658  GEN_VISIT(SgAsmPEExportDirectory)
659  GEN_VISIT(SgAsmPEExportEntry)
660  GEN_VISIT(SgAsmPEImportDirectory)
661  GEN_VISIT(SgAsmPEImportItem)
662  GEN_VISIT(SgAsmPESectionTableEntry)
663  GEN_VISIT(SgAsmNEEntryPoint)
664  GEN_VISIT(SgAsmNERelocEntry)
665  GEN_VISIT(SgAsmNESectionTableEntry)
666  GEN_VISIT(SgAsmLEPageTableEntry)
667  GEN_VISIT(SgAsmLEEntryPoint)
668  GEN_VISIT(SgAsmLESectionTableEntry)
669  GEN_VISIT(SgAsmGenericSectionList)
670  GEN_VISIT(SgAsmGenericHeaderList)
671  GEN_VISIT(SgAsmGenericSymbolList)
672  GEN_VISIT(SgAsmElfSymbolList)
673  GEN_VISIT(SgAsmCoffSymbolList)
674  GEN_VISIT(SgAsmGenericDLLList)
675  GEN_VISIT(SgAsmPERVASizePairList)
676  GEN_VISIT(SgAsmPEExportEntryList)
677  GEN_VISIT(SgAsmBasicString)
678  GEN_VISIT(SgAsmStoredString)
679  GEN_VISIT(SgAsmGenericString)
680  GEN_VISIT(SgAsmStringStorage)
681  GEN_VISIT(SgAsmDwarfMacro)
682  GEN_VISIT(SgAsmDwarfLine)
683  GEN_VISIT(SgAsmDwarfMacroList)
684  GEN_VISIT(SgAsmDwarfLineList)
685  GEN_VISIT(SgAsmDwarfArrayType)
686  GEN_VISIT(SgAsmDwarfClassType)
687  GEN_VISIT(SgAsmDwarfEntryPoint)
688  GEN_VISIT(SgAsmDwarfEnumerationType)
689  GEN_VISIT(SgAsmDwarfFormalParameter)
691  GEN_VISIT(SgAsmDwarfLabel)
692  GEN_VISIT(SgAsmDwarfLexicalBlock)
693  GEN_VISIT(SgAsmDwarfMember)
694  GEN_VISIT(SgAsmDwarfPointerType)
695  GEN_VISIT(SgAsmDwarfReferenceType)
696  GEN_VISIT(SgAsmDwarfCompilationUnit)
697  GEN_VISIT(SgAsmDwarfStringType)
698  GEN_VISIT(SgAsmDwarfStructureType)
699  GEN_VISIT(SgAsmDwarfSubroutineType)
700  GEN_VISIT(SgAsmDwarfTypedef)
701  GEN_VISIT(SgAsmDwarfUnionType)
703  GEN_VISIT(SgAsmDwarfVariant)
704  GEN_VISIT(SgAsmDwarfCommonBlock)
705  GEN_VISIT(SgAsmDwarfCommonInclusion)
706  GEN_VISIT(SgAsmDwarfInheritance)
707  GEN_VISIT(SgAsmDwarfInlinedSubroutine)
708  GEN_VISIT(SgAsmDwarfModule)
709  GEN_VISIT(SgAsmDwarfPtrToMemberType)
710  GEN_VISIT(SgAsmDwarfSetType)
711  GEN_VISIT(SgAsmDwarfSubrangeType)
712  GEN_VISIT(SgAsmDwarfWithStmt)
713  GEN_VISIT(SgAsmDwarfAccessDeclaration)
714  GEN_VISIT(SgAsmDwarfBaseType)
715  GEN_VISIT(SgAsmDwarfCatchBlock)
716  GEN_VISIT(SgAsmDwarfConstType)
717  GEN_VISIT(SgAsmDwarfConstant)
718  GEN_VISIT(SgAsmDwarfEnumerator)
719  GEN_VISIT(SgAsmDwarfFileType)
720  GEN_VISIT(SgAsmDwarfFriend)
721  GEN_VISIT(SgAsmDwarfNamelist)
722  GEN_VISIT(SgAsmDwarfNamelistItem)
723  GEN_VISIT(SgAsmDwarfPackedType)
724  GEN_VISIT(SgAsmDwarfSubprogram)
727  GEN_VISIT(SgAsmDwarfThrownType)
728  GEN_VISIT(SgAsmDwarfTryBlock)
729  GEN_VISIT(SgAsmDwarfVariantPart)
730  GEN_VISIT(SgAsmDwarfVariable)
731  GEN_VISIT(SgAsmDwarfVolatileType)
732  GEN_VISIT(SgAsmDwarfDwarfProcedure)
733  GEN_VISIT(SgAsmDwarfRestrictType)
734  GEN_VISIT(SgAsmDwarfInterfaceType)
735  GEN_VISIT(SgAsmDwarfNamespace)
736  GEN_VISIT(SgAsmDwarfImportedModule)
737  GEN_VISIT(SgAsmDwarfUnspecifiedType)
738  GEN_VISIT(SgAsmDwarfPartialUnit)
739  GEN_VISIT(SgAsmDwarfImportedUnit)
740  GEN_VISIT(SgAsmDwarfMutableType)
741  GEN_VISIT(SgAsmDwarfCondition)
742  GEN_VISIT(SgAsmDwarfSharedType)
743  GEN_VISIT(SgAsmDwarfFormatLabel)
744  GEN_VISIT(SgAsmDwarfFunctionTemplate)
745  GEN_VISIT(SgAsmDwarfClassTemplate)
746  GEN_VISIT(SgAsmDwarfUpcSharedType)
747  GEN_VISIT(SgAsmDwarfUpcStrictType)
748  GEN_VISIT(SgAsmDwarfUpcRelaxedType)
749  GEN_VISIT(SgAsmDwarfUnknownConstruct)
750  GEN_VISIT(SgAsmDwarfConstruct)
751  GEN_VISIT(SgAsmDwarfConstructList)
753  GEN_VISIT(SgAsmDwarfInformation)
754  GEN_VISIT(SgAsmExecutableFileFormat)
755  GEN_VISIT(SgAsmInterpretation)
756  GEN_VISIT(SgAsmInterpretationList)
757  GEN_VISIT(SgAsmGenericFileList)
758  GEN_VISIT(SgAsmNode)
759 #endif /* WITH_BINARY_ANALYSIS */
760 
761  GEN_VISIT(SgInitializedName)
762  GEN_VISIT(SgOmpOrderedClause)
763  GEN_VISIT(SgOmpNowaitClause)
764  GEN_VISIT(SgOmpUntiedClause)
765  GEN_VISIT(SgOmpMergeableClause)
766  GEN_VISIT(SgOmpDefaultClause)
767  GEN_VISIT(SgOmpCollapseClause)
768  GEN_VISIT(SgOmpIfClause)
769  GEN_VISIT(SgOmpFinalClause)
770  GEN_VISIT(SgOmpPriorityClause)
771  GEN_VISIT(SgOmpNumThreadsClause)
772  GEN_VISIT(SgOmpExpressionClause)
773  GEN_VISIT(SgOmpCopyprivateClause)
774  GEN_VISIT(SgOmpPrivateClause)
775  GEN_VISIT(SgOmpFirstprivateClause)
776  GEN_VISIT(SgOmpSharedClause)
777  GEN_VISIT(SgOmpCopyinClause)
778  GEN_VISIT(SgOmpLastprivateClause)
779  GEN_VISIT(SgOmpReductionClause)
780  GEN_VISIT(SgOmpVariablesClause)
781  GEN_VISIT(SgOmpScheduleClause)
782  GEN_VISIT(SgOmpDependClause)
783  GEN_VISIT(SgOmpClause)
784  GEN_VISIT(SgRenamePair)
785  GEN_VISIT(SgInterfaceBody)
786  GEN_VISIT(SgLocatedNodeSupport)
787  GEN_VISIT(SgToken)
788 
789  //
790  // Types
791  GEN_VISIT(SgTypeUnknown)
792  GEN_VISIT(SgTypeChar)
793  GEN_VISIT(SgTypeSignedChar)
794  GEN_VISIT(SgTypeUnsignedChar)
795  GEN_VISIT(SgTypeShort)
796  GEN_VISIT(SgTypeSignedShort)
797  GEN_VISIT(SgTypeUnsignedShort)
798  GEN_VISIT(SgTypeInt)
799  GEN_VISIT(SgTypeSignedInt)
800  GEN_VISIT(SgTypeUnsignedInt)
801  GEN_VISIT(SgTypeLong)
802  GEN_VISIT(SgTypeSignedLong)
803  GEN_VISIT(SgTypeUnsignedLong)
804  GEN_VISIT(SgTypeVoid)
805  GEN_VISIT(SgTypeGlobalVoid)
806  GEN_VISIT(SgTypeWchar)
807  GEN_VISIT(SgTypeFloat)
808  GEN_VISIT(SgTypeDouble)
809  GEN_VISIT(SgTypeLongLong)
810  GEN_VISIT(SgTypeSignedLongLong)
811  GEN_VISIT(SgTypeUnsignedLongLong)
812  GEN_VISIT(SgTypeLongDouble)
813  GEN_VISIT(SgTypeString)
814  GEN_VISIT(SgTypeBool)
815  GEN_VISIT(SgTypeComplex)
816  GEN_VISIT(SgTypeImaginary)
817  GEN_VISIT(SgTypeDefault)
818  GEN_VISIT(SgPointerMemberType)
819  GEN_VISIT(SgReferenceType)
820  GEN_VISIT(SgTypeCAFTeam)
821  GEN_VISIT(SgClassType)
822  GEN_VISIT(SgTemplateType)
823  GEN_VISIT(SgEnumType)
824  GEN_VISIT(SgTypedefType)
825  GEN_VISIT(SgModifierType)
827  GEN_VISIT(SgArrayType)
828  GEN_VISIT(SgTypeEllipse)
829  GEN_VISIT(SgTypeCrayPointer)
830  GEN_VISIT(SgPartialFunctionType)
831  GEN_VISIT(SgMemberFunctionType)
832  GEN_VISIT(SgFunctionType)
833  GEN_VISIT(SgPointerType)
834  GEN_VISIT(SgNamedType)
835  GEN_VISIT(SgQualifiedNameType)
836  // DQ (4/5/2017): Added this case that shows up using GNU 6.1 and Boost 1.51 (or Boost 1.52).
837  GEN_VISIT(SgDeclType)
838 
839  RoseVisitor rv;
840  };
841 
842 #undef GEN_VISIT
843 
844  template <class RoseVisitor>
845  inline
846  RoseVisitor
847  _dispatch(const RoseVisitor& rv, SgNode* n)
848  {
849  ROSE_ASSERT(n);
850 
852 
853  n->accept(vis);
854  return vis.rv;
855  }
856 
918  template <class RoseVisitor>
919  inline
920  RoseVisitor
921  dispatch(const RoseVisitor& rv, SgNode* n)
922  {
923  return _dispatch(rv, n);
924  }
925 
927  template <class RoseVisitor>
928  inline
929  RoseVisitor
930  dispatch(const RoseVisitor& rv, const SgNode* n)
931  {
932  return _dispatch(rv, const_cast<SgNode*>(n));
933  }
934 
935  template <class SageNode>
937  {
938  void handle(SageNode&) {}
939  };
940 
948  template <class AncestorNode, class QualSgNode>
949  struct AncestorTypeFinder : DefaultHandler<const SgProject>
950  {
952  typedef std::pair<AncestorNode*, QualSgNode*> Pair;
953 
954  Pair res;
955 
957  : Base(), res(NULL, NULL)
958  {}
959 
960  // handling of const SgProject is outsourced to DefaultHandler
961  // thus, AncestorNode = const SgProject does not cause conflicts
962  using Base::handle;
963 
964  void handle(QualSgNode& n) { res.second = n.get_parent(); }
965  void handle(AncestorNode& n) { res.first = &n; }
966 
967  operator Pair() const { return res; }
968  };
969 
972  template <class AncestorNode, class QualSgNode>
973  AncestorNode* _ancestor(QualSgNode& n)
974  {
975  typedef AncestorTypeFinder<AncestorNode, QualSgNode> AncestorFinder;
976 
977  typename AncestorFinder::Pair res(NULL, n.get_parent());
978 
979  while (res.second != NULL)
980  {
981  res = (typename AncestorFinder::Pair) sg::dispatch(AncestorFinder(), res.second);
982  }
983 
984  return res.first;
985  }
986 
998  template <class AncestorNode>
999  AncestorNode* ancestor(SgNode* n)
1000  {
1001  if (n == NULL) return NULL;
1002 
1003  return _ancestor<AncestorNode>(*n);
1004  }
1005 
1007  template <class AncestorNode>
1008  const AncestorNode* ancestor(const SgNode* n)
1009  {
1010  if (n == NULL) return NULL;
1011 
1012  return _ancestor<const AncestorNode>(*n);
1013  }
1014 
1016  template <class AncestorNode>
1017  AncestorNode& ancestor(SgNode& n)
1018  {
1019  AncestorNode* res = _ancestor<AncestorNode>(n);
1020 
1021  ROSE_ASSERT(res);
1022  return *res;
1023  }
1024 
1026  template <class AncestorNode>
1027  const AncestorNode& ancestor(const SgNode& n)
1028  {
1029  const AncestorNode* res = _ancestor<const AncestorNode>(n);
1030 
1031  ROSE_ASSERT(res);
1032  return *res;
1033  }
1034 
1036  template <class SageNode>
1037  struct TypeRecoveryHandler
1038  {
1039  typedef typename ConstLike<SageNode, SgNode>::type SgBaseNode;
1040 
1041  SageNode* res;
1042 
1043  TypeRecoveryHandler()
1044  : res(NULL), loc(NULL), loc_ln(0)
1045  {}
1046 
1047  TypeRecoveryHandler(const char* f, size_t ln)
1048  : res(NULL), loc(f), loc_ln(ln)
1049  {}
1050 
1051  void handle(SgBaseNode& n) { unexpected_node(n, loc, loc_ln); }
1052  void handle(SageNode& n) { res = &n; }
1053 
1054  operator SageNode* () { return res; }
1055 
1056  const char* loc;
1057  size_t loc_ln;
1058  };
1059 
1060 #define SG_ASSERT_TYPE(SAGENODE, N) (sg::assert_sage_type<SAGENODE>(N, __FILE__, __LINE__))
1061 
1069  template <class SageNode>
1070  SageNode* assert_sage_type(SgNode* n, const char* f = 0, size_t ln = 0)
1071  {
1072  return sg::dispatch(TypeRecoveryHandler<SageNode>(f, ln), n);
1073  }
1074 
1076  template <class SageNode>
1077  const SageNode* assert_sage_type(const SgNode* n, const char* f = 0, size_t ln = 0)
1078  {
1079  return sg::dispatch(TypeRecoveryHandler<const SageNode>(f, ln), n);
1080  }
1081 
1084  static inline
1085  void swap_parent(SgNode* lhs, SgNode* rhs)
1086  {
1087  SgNode* tmp = lhs->get_parent();
1088 
1089  lhs->set_parent(rhs->get_parent());
1090  rhs->set_parent(tmp);
1091  }
1092 
1096  static inline
1097  void swap_parent(void*, void*) {}
1098 
1106  template <class SageNode, class SageChild>
1107  void swap_child(SageNode& lhs, SageNode& rhs, SageChild* (SageNode::*getter) () const, void (SageNode::*setter) (SageChild*))
1108  {
1109  SageChild* lhs_child = (lhs.*getter)();
1110  SageChild* rhs_child = (rhs.*getter)();
1111  ROSE_ASSERT(lhs_child && rhs_child);
1112 
1113  (lhs.*setter)(rhs_child);
1114  (rhs.*setter)(lhs_child);
1115 
1116  swap_parent(lhs_child, rhs_child);
1117  }
1118 
1119 
1122  template <class SageNode>
1124  {
1125  typedef void (*TransformHandlerFn)(SageNode*);
1126 
1127  explicit
1128  TraversalFunction(TransformHandlerFn fun)
1129  : fn(fun)
1130  {}
1131 
1132  void handle(SgNode&) { /* ignore */ }
1133  void handle(SageNode& n) { fn(&n); }
1134 
1135  TransformHandlerFn fn;
1136  };
1137 
1140  template <class SageNode>
1141  static inline
1143  createTraversalFunction(void (* fn)(SageNode*))
1144  {
1145  return TraversalFunction<SageNode>(fn);
1146  }
1147 
1148  //
1149  // function type extractor
1150  // see https://stackoverflow.com/questions/28033251/can-you-extract-types-from-template-parameter-function-signature
1151 
1152 
1153  template <class GVisitor>
1155  {
1156  explicit
1157  TraversalClass(GVisitor gv)
1158  : gvisitor(gv)
1159  //~ : gvisitor(std::move(gv))
1160  {}
1161 
1162  void visit(SgNode* n)
1163  {
1164  gvisitor = sg::dispatch(gvisitor, n);
1165  }
1166 
1167  // GVisitor&& visitor() { return std::move(gvisitor); }
1168  GVisitor visitor() { return gvisitor; }
1169 
1170  GVisitor gvisitor;
1171  };
1172 
1173 
1174 
1181  template <class F>
1182  static inline
1183  F
1184  forAllNodes(F fn, SgNode* root, AstSimpleProcessing::Order order = postorder)
1185  {
1186  ROSE_ASSERT(root);
1187 
1188  TraversalClass<F> tt(fn);
1189  //~ TraversalClass<F> tt(std::move(fn));
1190 
1191  tt.traverse(root, order);
1192  return tt.visitor();
1193  }
1194 
1195  template <class SageNode>
1196  static inline
1197  void
1198  forAllNodes(void (*fn)(SageNode*), SgNode* root, AstSimpleProcessing::Order order = postorder)
1199  {
1200  forAllNodes(createTransformExecutor(fn), root, order);
1201  }
1202 
1203 #if !defined(NDEBUG)
1204  static inline
1205  std::string nodeType(const SgNode& n)
1206  {
1207  return typeid(n).name();
1208  }
1209 
1210  static inline
1211  std::string nodeType(const SgNode* n)
1212  {
1213  if (n == NULL) return "<null>";
1214 
1215  return nodeType(*n);
1216  }
1217 #endif
1218 
1219  template <class GVisitor>
1221  {
1222  explicit
1223  DispatchHelper(GVisitor gv, SgNode* p)
1224  //~ : gvisitor(std::move(gv)), parent(p), cnt(0)
1225  : gvisitor(gv), parent(p), cnt(0)
1226  {}
1227 
1228  void operator()(SgNode* n)
1229  {
1230  ++cnt;
1231 
1232 #if !defined(NDEBUG)
1233  if (n == NULL)
1234  {
1235  std::cerr << "succ(" << nodeType(parent) << ", " << cnt << ") is null" << std::endl;
1236  return;
1237  }
1238 #endif
1239 
1240  if (n != NULL) gvisitor = sg::dispatch(gvisitor, n);
1241  }
1242 
1243  operator GVisitor() { return gvisitor; }
1244  //~ operator GVisitor() { return std::move(gvisitor); }
1245 
1246  GVisitor gvisitor;
1247  SgNode* parent;
1248  size_t cnt;
1249  };
1250 
1251 
1252  template <class GVisitor>
1253  static inline
1255  dispatchHelper(GVisitor gv, SgNode* parent = NULL)
1256  {
1257  return DispatchHelper<GVisitor>(gv, parent);
1258  //~ return DispatchHelper<GVisitor>(std::move(gv), parent);
1259  }
1260 
1261 
1262  template <class GVisitor>
1263  static inline
1264  GVisitor traverseChildren(GVisitor gv, SgNode& n)
1265  {
1266  std::vector<SgNode*> successors = n.get_traversalSuccessorContainer();
1267 
1268  return std::for_each(successors.begin(), successors.end(), dispatchHelper(gv, &n));
1269  }
1270 
1271 
1272  template <class GVisitor>
1273  static inline
1274  GVisitor traverseChildren(GVisitor gv, SgNode* n)
1275  {
1276  return traverseChildren(gv, sg::deref(n));
1277  //~ return traverseChildren(sg::deref(n), std::move(gv));
1278  }
1279 }
1280 #endif /* _SAGEGENERIC_H */
This class represents modifiers for SgDeclaration (declaration statements).
List of pointers to file sections.
This class represents the notion of an initializer for a variable declaration or expression in a func...
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.).
The GNU symbol version definitions.
This class represents the concept of a C++ template instantiation directive.
This class represents the concept of an instantiation of member function template or a member functio...
This class represents the concept of a class declaration statement. It includes the concept of an ins...
This class represents the concept of a declaration list.
This class represents a boolean value (expression value).
One entry of the ELF symbol version needed table.
This class represents a OLD concept of the structure require for qualified names when they were in th...
String associated with a binary file.
Expression that adds two operands.
This class represents the concept of an instantiated class template.
This class represents the notion of an value (expression value).
List of dynamic linking section entries.
This class represents the concept of a C or C++ goto statement.
Contiguous region of a file.
This class represents the concept of a C or C++ statement which contains a expression.
Expression that performs a post-increment operation.
Expression representing a (no-op) unary plus operation.
This class represents the notion of a binary operator. It is derived from a SgExpression because oper...
Expression that performs a right rotate.
Auxiliary info for needed symbol version.
Instruction basic block.
Base class for all binary analysis IR nodes.
This class represents a source file for a project (which may contian many source files and or directo...
List of entries for the ELF symbol version definition table.
This class represents the variable declaration or variable initialization withn a for loop...
One entry of an ELF relocation table.
This class represents the concept of a C++ sequence of catch statements.
This class represents the notion of a unary operator. It is derived from a SgExpression because opera...
Represents the file header of an ELF binary container.
This class represents the GNU extension "statement expression" (thus is non-standard C and C++)...
Class for traversing the AST.
This class represents the C++ throw expression (handled as a unary operator).
Expression that performs a post-decrement operation.
This class represents the rhs of a variable declaration which includes an optional assignment (e...
Portable Executable Import Section.
This class represents the concept of a C++ using directive.
List of generic file headers.
List of binary interpretations.
Base class for machine instructions.
This class represents the concept of a do-while statement.
This class represents a Fortran pointer assignment. It is not some weird compound assignment operator...
Section table entry.
This class represents the concept of a class name within the compiler.
This class represents the location of the code associated with the IR node in the original source cod...
This class represents the concept of an enum declaration.
Base class for scalar types.
List of expression nodes.
This class represents the "this" operator (can be applied to any member data).
Expression that performs an arithmetic, sign-bit preserving right shift.
void set_parent(SgNode *parent)
All nodes in the AST contain a reference to a parent node.
This class represents a string type used for SgStringVal IR node.
Expression that performs a logical, sign-bit non-preserving right shift.
This class represents the concept of a C style extern "C" declaration. But such information (linkage)...
This class represents the notion of a declared variable.
Strings stored in an ELF or PE container.
This class represents the concept of a member function declaration statement.
Expression that returns the remainder when dividing the first operand by the second.
This class represents the concept of a C and C++ case option (used within a switch statement)...
This class represents the concept of a function declaration statement.
Node to hold a list of symbol node pointers.
Base class for ELF file sections.
This class represents the concept of a C Assembler statement (untested).
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.).
Base class for PE sections.
This class represents the concept of a C and C++ expression list.
This class represents the "sizeof()" operator (applied to any type).
Expression that divides the first operand by the second.
Hods a list of symbol version aux entries.
COFF symbol string table.
Basic information about an executable container.
This class represents the concept of a C++ namespace alias declaration statement. ...
This class is not used in ROSE, but is intended to represent a list of SgModifierTypes (similar to th...
This class represents the base class of a numbr of IR nodes that don't otherwise fit into the existin...
Definition: Cxx_Grammar.h:9889
Entry in an ELF symbol version table.
This class represents a directory within a projects file structure of files and directories.
This class represents the notion of an value (expression value).
ELF error handling frame entry frame description entry.
This class represents the concept of a C trinary conditional expression (e.g. "test ...
Represents an ELF relocation section.
One import directory per library.
void visit(SgNode *n)
this method is called at every traversed node.
Definition: sageGeneric.h:1162
GNU symbol version requirements table.
List of ELF relocation entries.
This class represents the notion of a break statement (typically used in a switch statment)...
List of AST file node pointers.
This class represents the concept of a name within the compiler.
ELF section containing dynamic linking information.
executes a functor for a specific node type
Definition: sageGeneric.h:1123
Represents the file header for DOS executables.
List of ELF EH frame CI entries.
Represents an ELF EH frame section.
One entry of an ELF notes table.
ELF string table section.
This class represents the concept of a class definition in C++.
This class represents strings within the IR nodes.
Reference to memory locations.
projects the constness of T1 on T2
Definition: sageGeneric.h:52
This class represents the concept of a contructor initializer list (used in constructor (member funct...
Base class for container file headers.
Expression represting negation.
List of pointers to other AST nodes.
Expression representing a machine register.
Base class for integer values.
This class represents the concept of a namespace name within the compiler.
This class represents the notion of a typedef declaration.
ELF file section containing symbols.
This class represents the notion of an value (expression value).
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:8908
List of operands for an instruction.
This class represents the concept of a catch within a try-catch construct used in C++ exception handl...
Base class for dynamically linked library information.
This class represents the notion of an value (expression value).
This class represents the concept of a variable name within the compiler (a shared container for the ...
This class represents the concept of an instantiation of function template.
Expression that performs a pre-decrement operation.
Expression that performs a pre-increment operation.
This class represents the "&" operator (applied to any lvalue).
A single imported object.
Represents one PowerPC machine instruction.
One entry from an ELF symbol version definition table.
Represents a single ELF symbol.
This class represents the base class of a number of IR nodes define modifiers within the C++ grammar...
This class represents the concept of a block (not a basic block from control flow analysis)...
This class represents the concept of a C++ namespace declaration.
Base class for strings related to binary specimens.
This class represents the concept of a namespace definition.
This class represents the concept of a for loop.
DOS exteded header.
List of COFF symbols.
Base class for unary expressions.
Base class for many binary analysis nodes.
Represents one Intel x86 machine instruction.
This class represents the concept of a C++ using declaration.
This class represents a C99 complex type.
Base class for statement-like subclasses.
This class represents a type for all functions.
This class represents the concept of a namespace definition.
This class represents the numeric negation of a value. Not to be confused with SgSubtractOp.
This class represents the concept of a C Assembler statement (untested).
Represents one entry of a segment table.
This class represents the concept of a C or C++ default case within a switch statement.
Base class for expressions.
This class represents a default type used for some IR nodes (see below).
This class represents the concept of an "if" construct.
virtual std::vector< SgNode * > get_traversalSuccessorContainer()
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
This class represents the concept of a template declaration.
Expression that performs a logical left shift operation.
List of pointers to other nodes.
Expression that multiplies two operands.
This class represents template argument within the use of a template to build an instantiation.
This class represents the variable refernece in expressions.
Represents one ARM machine instruction.
Node to hold list of ELF note entries.
This class represents the concept of a do-while statement.
This class represents a OLD concept of the structure require for qualified names when they were in th...
List of entries from a symbol version table.
List of SgAsmPERVASizePair AST nodes.
Base class for binary types.
This class represents the definition (initialization) of a variable.
This class represents the concept of a class definition in C++.
This class represents the concept of a C++ call to the delete operator.
Export file section.
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
helper class for _ancestor
Definition: sageGeneric.h:949
Registers accessed indirectly.
This class represents the concept of a C++ call to the new operator.
This class represents the concept of a C or C++ continue statement.
This class represents an object used to initialize the unparsing.
Base class for values.
Floating-point value.
This class represents the member function being called and must be assembled in the SgFunctionCall wi...
Windows PE file header.
This class represents modifiers specific to storage.
This class represents the symbol tables used in both SgScopeStatement and the SgFunctionTypeSymbolTab...
Expression that subtracts the second operand from the first.
SgNode * get_parent() const
Access function for parent node.
This class represents the function being called and must be assembled in the SgFunctionCall with the ...
This class represents the concept of try statement within the try-catch support for exception handlin...
This class represents the concept of a C Assembler statement.
This class represents the concept of a name and a type. It may be renamed in the future to SgTypeSymb...
This class represents a list of associated typedefs for the SgType IR nodes which reference this list...
One entry from the dynamic linking table.
This class represents a source project, with a list of SgFile objects and global information about th...
This class represents the function type table (stores all function types so that they can be shared i...
Integer types.
This class represents a C99 complex type.
This class represents the concept of a C or C++ variable declaration.
This class represents the notion of an initializer for a variable declaration or expression in a func...
The ELF symbol version table.
Represents one entry in an ELF section table.
Represents an ELF segment table.
Strings stored in an ELF or PE container.
Represents an ELF section table.
ELF string table.
A list of imported items.
Represents an interpretation of a binary container.
This class represents the concept of a C or C++ label statement.
List of symbol version needed entries.
Floating point types.
This class is part of the older CC++ concept. It is not a part of C or C++ (this IR node is not used ...
This class represents the concept of a C++ function call (which is an expression).
Base class for binary files.
Base class for binary expressions.
Base class for vector types.
This class was part of CC++ support from a long time ago.
List of symbol version aux entries.
This class represents the concept of a declaration statement.
This class represents the concept of a switch.
This class represents the concept of a C++ expression built from a class name.
A list of PE Import Directories.
ELF error handling frame entry, common information entry.
COFF symbol table.