ROSE 0.11.145.380
SgNode.h
1
2#ifndef ROSE_SgNode_H
3#define ROSE_SgNode_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6
7
8
9/* #line 1 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
10
11// WARNING -- GENERATED CODE -- DO NOT MODIFY THIS CODE -- WARNING!
12// This code is automatically generated for each
13// terminal and non-terminal within the defined
14// grammar. There is a simple way to change the
15// code to fix bugs etc. See the ROSE README file
16// for directions.
17
18// tps: (02/22/2010): Adding DLL export requirements
19#include "rosedll.h"
20
21// predeclarations for SgNode
22
23/* #line 24 "../../../src/frontend/SageIII//SgNode.h" */
24/* #line 2 "/workspace/src/ROSETTA/Grammar/Node.code" */
25
26
27#include <ROSE_DEPRECATED.h>
28#include <semaphore.h>
29#include <rosePublicConfig.h>
30#include "setup.h"
31#include <sageContainer.h>
32#include <boost/format.hpp>
33
34#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
35#include <boost/serialization/access.hpp>
36#include <boost/serialization/base_object.hpp>
37#include <boost/serialization/map.hpp>
38#include <boost/serialization/set.hpp>
39#include <boost/serialization/vector.hpp>
40#include <boost/serialization/version.hpp>
41#endif
42
43#include <Sawyer/CommandLine.h>
44#include <Sawyer/Interval.h>
45#include <Sawyer/IntervalSet.h>
46
47#include "processSupport.h"
48#define __builtin_constant_p(exp) (0)
49
50#ifdef ROSE_ENABLE_BINARY_ANALYSIS
51#include <Rose/BinaryAnalysis/AddressSet.h>
52#include <Rose/BinaryAnalysis/RelativeVirtualAddress.h>
53#include <Rose/BinaryAnalysis/AddressInterval.h>
54#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
55#include <rose_extent.h> // deprecated
56#include <Rose/BinaryAnalysis/RegisterDescriptor.h>
57#include <Rose/BinaryAnalysis/InstructionMap.h>
58#include <ROSE_NELMTS.h>
59#endif
60
61#include <Rose/Constants.h>
62#include <sageHash.h>
63#include <sageTraversal.h>
64#include <sageRti.h>
65#include <sageCopy.h>
66#include <sageMemory.h>
67#include <Cxx_GrammarVariants.h>
68#include <Cxx_GrammarStorageClasses.h>
69#include <virtualCFG.h>
70
71namespace Rose { namespace Traits { namespace generated { template <typename NodeT> struct describe_node_t; } } }
72namespace Rose { namespace Traits { namespace generated { template <typename NodeT, typename FieldT, FieldT NodeT::* fld_ptr> struct describe_field_t; } } }
73
74#ifdef ROSE_ENABLE_BINARY_ANALYSIS
75// Version numbers for SgAsm* nodes. Used for backward compatibility. */
76BOOST_CLASS_VERSION(SgAsmInstruction, 1);
77#endif
78
81class AstAttribute;
84class UnparseDelegate;
85class UnparseFormatHelp;
86class AstSpecificDataManagingClassStorageClass;
87
88
89
90/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
91
92/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
93
94#if 1
95// Class Definition for SgNode
96class ROSE_DLL_API SgNode
97 {
98 public:
99
100
101/* #line 102 "../../../src/frontend/SageIII//SgNode.h" */
102
103 virtual SgNode* copy ( SgCopyHelp& help) const;
104// Start of memberFunctionString
105/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
106
107// *** COMMON CODE SECTION BEGINS HERE ***
108
109 public:
110
111 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
112 // and not required which is required to match the other aspects of the copy mechanism code generation.
113 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
114 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
115 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
116 // virtual SgNode* copy ( const SgCopyHelp & help) const;
117
119 virtual std::string class_name() const;
120
122 virtual VariantT variantT() const; // MS: new variant used in tree traversal
123
125 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
126 // static const VariantT static_variant = V_SgNode;
127 enum { static_variant = V_SgNode };
128
129 /* the generated cast function */
131 ROSE_DLL_API friend SgNode* isSgNode( SgNode * s );
132
134 ROSE_DLL_API friend const SgNode* isSgNode( const SgNode * s );
135
136 // ******************************************
137 // * Memory Pool / New / Delete
138 // ******************************************
139
140 public:
142 static const unsigned pool_size; //
144 static std::vector<unsigned char *> pools; //
146 static SgNode * next_node; //
147
149 static unsigned long initializeStorageClassArray(SgNodeStorageClass *); //
150
152 static void clearMemoryPool(); //
153 static void deleteMemoryPool(); //
154
156 static void extendMemoryPoolForFileIO(); //
157
159 static SgNode * getPointerFromGlobalIndex(unsigned long); //
161 static SgNode * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
162
164 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
166 static void resetValidFreepointers(); //
168 static unsigned long getNumberOfLastValidPointer(); //
169
170
171#if defined(INLINE_FUNCTIONS)
173 inline void *operator new (size_t size);
174#else
176 void *operator new (size_t size);
177#endif
179 void operator delete (void* pointer, size_t size);
180
181 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
182 void operator delete (void* pointer)
183 {
184 // This is the generated delete operator...
185 SgNode::operator delete (pointer,sizeof(SgNode));
186 }
187
189 static size_t numberOfNodes();
190
192 static size_t memoryUsage();
193
194 // End of scope which started in IR nodes specific code
195 /* */
196
197 /* name Internal Functions
198 \brief Internal functions ... incomplete-documentation
199
200 These functions have been made public as part of the design, but they are suggested for internal use
201 or by particularly knowledgeable users for specialized tools or applications.
202
203 \internal We could not make these private because they are required by user for special purposes. And
204 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
205
206 */
207
208 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
209 // overridden in every class by *generated* implementation
211 virtual std::vector<SgNode*> get_traversalSuccessorContainer() const;
212 // MS: 06/28/02 container of names of variables or container indices
213 // used used in the traversal to access AST successor nodes
214 // overridden in every class by *generated* implementation
217 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const;
218
219 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
220 // than all the vector copies. The implementation for these functions is generated for each class.
222 virtual size_t get_numberOfTraversalSuccessors() const;
224 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) const;
226 virtual size_t get_childIndex(SgNode *child) const;
227
228#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
229 // MS: 08/16/2002 method for generating RTI information
231 virtual RTIReturnType roseRTI();
232#endif
233 /* */
234
235
236
237 /* name Deprecated Functions
238 \brief Deprecated functions ... incomplete-documentation
239
240 These functions have been deprecated from use.
241 */
242 /* */
243
245 virtual const char* sage_class_name() const ROSE_DEPRECATED_FUNCTION;
246
247 // JJW (10/16/2008): Changed to a single function in Node.code, and put
248 // getVariant() in #if 0 block to prevent confusing Doxygen
249#if 0
251 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
253 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
254#endif
255 /* */
256
257
258
259
260 public:
261 /* name Traversal Support Functions
262 \brief Traversal support functions ... incomplete-documentation
263
264 These functions have been made public as part of the design, but they are suggested for internal use
265 or by particularly knowledgable users for specialized tools or applications.
266 */
267 /* */
268
269 // DQ (11/26/2005): Support for visitor pattern mechanims
270 // (inferior to ROSE traversal mechanism, experimental).
274
275 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
277 virtual void accept (ROSE_VisitorPattern & visitor);
278
279 // DQ (12/26/2005): Support for traversal based on the memory pool
283
287
288 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
289 // This traversal helps support internal tools that call static member functions.
290 // note: this function operates on the memory pools.
294 /* */
295
296 public:
297 /* NodeId support functions */
299 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
302 static SgNode* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
305 static std::string getNodeIdString(SgNode* sgnode);
306 static std::string getNodeIdStringInternal(SgNode* sgnode);
307
308 public:
309 /* name Memory Allocation Functions
310 \brief Memory allocations functions ... incomplete-documentation
311
312 These functions have been made public as part of the design, but they are suggested for internal use
313 or by particularly knowledgable users for specialized tools or applications.
314 */
315 /* */
316
327 virtual bool isInMemoryPool();
328
340
341 // DQ (4/30/2006): Modified to be a const function.
356 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const;
357
368
380 virtual long getChildIndex( SgNode* childNode ) const;
381
382 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
383 // comment here (changed to be a C style comment and not be a doxygen comment).
384 /* \brief Constructor for use by AST File I/O Mechanism
385
386 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
387 which obtained via fast binary file I/O from disk.
388 */
389 // SgNode( SgNodeStorageClass& source );
390
391
392
393
394
395 // JH (10/24/2005): methods added to support the ast file IO
396 private:
397
398 /* name AST Memory Allocation Support Functions
399 \brief Memory allocations support....
400
401 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
402 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
403 and support the AST File I/O Mechanism.
404 */
405 /* */
406
407 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
408 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
409 that I use the same type everywhere, if any changes are made. THe second one declares the type
410 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
411 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
412 a correspinding one in the AST_FILE_IO class!
413 */
414 // DQ (9/2/2015): This typedef is no longer used, we can't define the
415 // comment here (changed to be a C style comment and not be a doxygen comment).
416 /* \brief Typedef used for low level memory access.
417 */
418 // typedef unsigned char* TestType;
419
420 // DQ (9/2/2015): This typedef is no longer used, we can't define the
421 // comment here (changed to be a C style comment and not be a doxygen comment).
422 /* \brief Typedef used to hold memory addresses as values.
423 */
424 // typedef unsigned long AddressType;
425
426
427
428 // necessary, to have direct access to the p_freepointer and the private methods !
430 friend class AST_FILE_IO;
431
433 friend class SgNodeStorageClass;
434
436 friend class AstSpecificDataManagingClass;
437
439 friend class AstSpecificDataManagingClassStorageClass;
440 public:
442 SgNode( const SgNodeStorageClass& source );
443
444 // private: // JJW hack
445 /*
446 name AST Memory Allocation Support Variables
447 Memory allocations support variables
448
449 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
450 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
451 and support the AST File I/O Mechanism.
452 */
453 /* */
454
455 public:
456
457 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
458 // to current node (so that it will work cleanly with build functions to specify patterns).
459 // virtual SgNode* addRegExpAttribute();
466
467#ifndef _MSC_VER
468// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
469// and likely never fully implemented nor tested. Files remain in the src tree but are no
470// longer built.
471#define BUILD_ATERM_SUPPORT 0
472 #if BUILD_ATERM_SUPPORT
473 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
474 // DQ (10/4/2014): Adding ATerm support to ROSE.
484 // Rasmussen (1/7/2019): Added to kill warning messages of overridden virtual function
485 virtual ATerm generate_ATerm();
486
488 virtual void generate_ATerm_Annotation(ATerm & term);
489 #endif
490 #endif // BUILD_ATERM_SUPPORT
491#endif
492 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
493 // virtual generate_AST(ATerm & term);
494 // virtual void read_ATerm_Annotation(ATerm & term);
495
496// *** COMMON CODE SECTION ENDS HERE ***
497
498
499// End of memberFunctionString
500// Start of memberFunctionString
501/* #line 68 "/workspace/src/ROSETTA/Grammar/Node.code" */
502
503 public:
504
511 void set_isModified( bool isModified );
512
517 void set_containsTransformation( bool containsTransformation );
518
519
525 bool get_isModified() const;
526
532
534 void set_parent ( SgNode* parent );
535
538
541
543 bool isChild ( SgNode* node ) const;
544
546 virtual std::string unparseToString(SgUnparse_Info* info) const;
547 std::string unparseToString() const;
548
551
560 static std::vector<std::string> buildCommandLineToSubstituteTransformationFile( const std::vector<std::string>& argv, std::string newFileName );
561
562 // JJW (10/16/2008): Replace variant() by variantT() and a cast (the
563 // numbers are the same, but the enumerator names are different)
564 int variant() const ROSE_DEPRECATED_FUNCTION {return (int)this->variantT();}
565
566 // AS (10/22/2007): build function to return class hierachy subtree of a VariantT
567 static std::vector<VariantT> getClassHierarchySubTreeFunction(VariantT v);
568 static void getClassHierarchySubTreeFunction( VariantT v, std::vector<VariantT>&);
569
575 bool get_isVisited () const ROSE_DEPRECATED_FUNCTION;
576
581 void set_isVisited ( bool isVisited ) ROSE_DEPRECATED_FUNCTION;
582
587 static std::map<SgNode*,std::string> & get_globalMangledNameMap();
588
591 static void clearGlobalMangledNameMap();
592
598 static std::map<std::string, uint64_t> & get_shortMangledNameCache();
599
600
606 static SgUnorderedMapNodeToString & get_globalQualifiedNameMapForNames();
607
613 static void set_globalQualifiedNameMapForNames ( const SgUnorderedMapNodeToString & X );
614
621 static SgUnorderedMapNodeToString & get_globalQualifiedNameMapForTypes();
622
629 static void set_globalQualifiedNameMapForTypes ( const SgUnorderedMapNodeToString & X );
630
637 static std::map<SgNode*,SgUnorderedMapNodeToString> & get_globalQualifiedNameMapForMapsOfTypes();
638
645 static void set_globalQualifiedNameMapForMapsOfTypes ( const std::map<SgNode*,SgUnorderedMapNodeToString> & X );
646
656 static SgUnorderedMapNodeToString & get_globalQualifiedNameMapForTemplateHeaders();
657
662 static void set_globalQualifiedNameMapForTemplateHeaders ( const SgUnorderedMapNodeToString & X );
663
670 static SgUnorderedMapNodeToString& get_globalTypeNameMap();
671
677 static void set_globalTypeNameMap ( const SgUnorderedMapNodeToString& X );
678
679 /* name Persistant Attribute Mechanism
680
681 This is the persistant attribute mechanism for attaching attributed to IR nodes across
682 multiple passes. Note that these attributes are persistant in that they are preserved
683 if the AST is written out to a file and read in from a file. However, virtual function
684 in the user-defined class derived from the AstAttribute must be defined for the attribute
685 to be defined across the boundary of File I/O (simple pack and unpack functions). More
686 sophisticated mechanisms are available within the AstAttributeMechanism object
687 (e.g iterating though attributes, etc; get_attributeMechanism() is available if direct
688 access is required, however mostly only internal tools use this lower level support).
689
690 \internal This used to be a public data member, but has been changed to be a protected
691 pointer instead. The functional interface of the AstAttributeMechanism is presevered
692 but some of the names and the syntax for calling the interface have changed. The
693 pointer to the AstAttributeMechanism is now generated by ROSETTA.
694 */
696 virtual void addNewAttribute(std::string s,AstAttribute* a);
698 virtual AstAttribute* getAttribute(std::string s) const;
700 virtual void updateAttribute(std::string s,AstAttribute* a); // formerly called: replace in AstAttributeMechanism
705 virtual void setAttribute(std::string s,AstAttribute* a);
707 virtual void removeAttribute(std::string s);
709 virtual bool attributeExists(std::string s) const;
711 virtual int numberOfAttributes() const;
712
720 virtual AstAttributeMechanism* get_attributeMechanism() const;
727 virtual void set_attributeMechanism(AstAttributeMechanism* a);
728
729#if ALT_FIXUP_COPY
730 /* name AST Copy Support Functions
731
732 Support for IR node specific fixup of copy operation.
733 This function helps reset scopes and build untraversed parts of the
734 AST that are difficult to have be constructed using the automatically
735 generated copy functions.
736
737 \implementation These functions are used internally inside the AST copy mechanism.
738 The public interface for this functionality is given below this section.
739 */
740 virtual void fixupCopy_scopes (SgNode* copy, SgCopyHelp & help) const;
741 virtual void fixupCopy_symbols (SgNode* copy, SgCopyHelp & help) const;
742 virtual void fixupCopy_references (SgNode* copy, SgCopyHelp & help) const;
743#else
744 virtual void fixupCopy(SgNode* copy, SgCopyHelp & help) const;
745#endif
746
747 /* name Source Position Information
748 \brief Support for source code position information of all IR nodes.
749
750 These are the virtual function definitions, they are overloaded for SgLocatedNode
751 and a few of the SgSupport IR nodes.
752 */
761 virtual Sg_File_Info* get_file_info(void) const { return nullptr; }
762
766 virtual Sg_File_Info* get_startOfConstruct(void) const {return nullptr;}
767
771 virtual Sg_File_Info* get_endOfConstruct(void) const { return nullptr; }
772
773 /* name Control flow graph public functions
774
775 These functions return control flow graph nodes for various positions
776 around a construct. */
777
778#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
783#endif
784
785#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
786 /* name Control flow graph view helper functions
787
788 These functions are used internally inside the control flow graph
789 view code. The public interface for this functionality is given
790 below this section. */
791
793 virtual unsigned int cfgIndexForEnd() const;
794
797 virtual bool cfgIsIndexInteresting(unsigned int index) const;
798
800 virtual unsigned int cfgFindChildIndex(SgNode* n);
801
803 virtual unsigned int cfgFindNextChildIndex(SgNode* n);
804
806 virtual std::vector<VirtualCFG::CFGEdge> cfgOutEdges(unsigned int index = false);
807
809 virtual std::vector<VirtualCFG::CFGEdge> cfgInEdges(unsigned int index = false);
810#endif
811
815 static void set_globalFunctionTypeTable(SgFunctionTypeTable* globalFunctionTypeTable);
819 static void set_globalTypeTable(SgTypeTable* globalTypeTable);
820
821 protected:
822 static std::vector<std::tuple<unsigned char*, unsigned, VariantT>> all_pools;
823 public:
824 static VariantT variantFromPool(SgNode const * n);
825
833
842
843 protected:
844
852
853 private:
854 // Make the copy constructor private (to avoid it being used)
855 /* We have to make the copy constructor available so that the SgUnparse_Info
856 copy constructor can access it, I'm not clear if this is a good idea.
857 */
858 // SgNode(const SgNode &); /* private so it can't be used. */
859
861 SgNode & operator= (const SgNode &) = delete;
862
863public:
877 template<class T>
878 static typename std::enable_if<std::is_base_of<SgNode, T>::value, T*>::type
880 auto node = new T;
881 node->set_parent(parent);
882 return node;
883 }
884
894 template<class T>
895 T* initParentPointer(T *child, SgNode *parent) {
896 ASSERT_not_null(parent);
897 if (child) {
898#ifndef NDEBUG
899 auto toString = [](SgNode *node) {
900 if (node) {
901 return (boost::format("(%s*)%p") % node->class_name() % node).str();
902 } else {
903 return std::string("nullptr");
904 }
905 };
906
907 ASSERT_require2(child->get_parent() == nullptr,
908 "child " + toString(child) +
909 " cannot be inserted into " + toString(parent) +
910 " because it is already a child of " + toString(child->get_parent()));
911#endif
912 child->set_parent(this);
913 }
914 return child;
915 }
916
953 template<class T>
954 typename std::enable_if<
955 std::is_pointer<T>::value,
956 void>::type
957 changeChildPointer(T& edge, T const& child) {
958#ifndef NDEBUG
959 auto toString = [](SgNode *node) {
960 if (node) {
961 return (boost::format("(%s*)%p") % node->class_name() % node).str();
962 } else {
963 return std::string("nullptr");
964 }
965 };
966#endif
967
968 if (child != edge) {
969 // If there is an old child, check that it has the correct parent and then remove it.
970 if (edge) {
971 ASSERT_require2(edge->get_parent() == this,
972 "node " + toString(edge) +
973 " is a child of " + toString(this) +
974 " but has wrong parent " + toString(edge->get_parent()));
975 edge->set_parent(nullptr);
976 edge = nullptr;
977 }
978
979 // If there is a new child, check its parent pointer and then insert it.
980 if (child) {
981 ASSERT_require2(child->get_parent() == nullptr,
982 "node " + toString(child) +
983 " is to be a child of " + toString(this) +
984 " but is already a child of " + toString(child->get_parent()));
985 child->set_parent(this);
986 edge = child;
987 }
988 }
989 }
990
991 // This gets called for non-pointers, which is the situation for nodes that are only lists of other nodes. We're currently
992 // not checking them because the ROSETTA-generated API has too many ways to get around this check, most of which make it
993 // impossible to enforce constraints regarding the parent/child consistency. For example:
994 //
995 // node->children().clear(); // removes a whole bunch of children but doesn't clear their parent pointers
996 // node->children()[i] = child; // changes the ith child, but doesn't clear the previous ith child's parent pointer
997 // for (auto &tmp: node->children()) tmp = nullptr; // changes each child but doesn't clear parent pointers
998 // ad nausiam...
999 template<class T>
1000 typename std::enable_if<
1001 !std::is_pointer<T>::value,
1002 void>::type
1003 changeChildPointer(T& edge, T const& child) {
1004 edge = child;
1005 }
1009private:
1010 // This is called by the debugSerializationBegin and debugSerializationEnd that are in turn called at the beginning and end of
1011 // each AST node's serialization function. The implementation below uses two counters: classSerializationDepth shared by all
1012 // instances of this class, and objectSerializationDepth_ which is a per-instance counter. The relationship of these two
1013 // counters can tell us how deeply nested these recursive calls are, and which of those recursion levels are due to traversing
1014 // through the base classes versus traversing through data members. In the output, we use one character of indentation per
1015 // recursion level, with spaces (' ') representing recursion due to data members and dots ('.') representing recursion due to
1016 // base classes.
1017 void debugSerializationHelper(const char*, bool) {}
1018
1019protected:
1049 virtual void destructorHelper() {}
1050
1051protected:
1059 virtual void debugSerializationBegin(const char *className) {
1060 debugSerializationHelper(className, true);
1061 }
1062 virtual void debugSerializationEnd(const char *className) {
1063 debugSerializationHelper(className, false);
1064 }
1067 public:
1068
1069
1070
1071// End of memberFunctionString
1072
1073
1074
1075
1076 public:
1077 SgNode* get_freepointer() const;
1078 void set_freepointer(SgNode* freepointer);
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090 public:
1091 virtual ~SgNode();
1092
1093
1094 public:
1095 SgNode();
1096
1097 protected:
1098// Start of memberFunctionString
1099SgNode* p_parent;
1100
1101// End of memberFunctionString
1102// Start of memberFunctionString
1103bool p_isModified;
1104
1105// End of memberFunctionString
1106// Start of memberFunctionString
1107bool p_containsTransformation;
1108
1109// End of memberFunctionString
1110// Start of memberFunctionString
1111SgNode* p_freepointer;
1112
1113// End of memberFunctionString
1114// Start of memberFunctionString
1115static SgFunctionTypeTable* p_globalFunctionTypeTable;
1116
1117// End of memberFunctionString
1118// Start of memberFunctionString
1119static SgTypeTable* p_globalTypeTable;
1120
1121// End of memberFunctionString
1122// Start of memberFunctionString
1123static std::map<SgNode*,std::string> p_globalMangledNameMap;
1124
1125// End of memberFunctionString
1126// Start of memberFunctionString
1127static std::map<std::string, uint64_t> p_shortMangledNameCache;
1128
1129// End of memberFunctionString
1130// Start of memberFunctionString
1131static std::unordered_map<SgNode*,std::string> p_globalQualifiedNameMapForNames;
1132
1133// End of memberFunctionString
1134// Start of memberFunctionString
1135static std::unordered_map<SgNode*,std::string> p_globalQualifiedNameMapForTypes;
1136
1137// End of memberFunctionString
1138// Start of memberFunctionString
1139static std::unordered_map<SgNode*,std::string> p_globalQualifiedNameMapForTemplateHeaders;
1140
1141// End of memberFunctionString
1142// Start of memberFunctionString
1143static std::unordered_map<SgNode*,std::string> p_globalTypeNameMap;
1144
1145// End of memberFunctionString
1146// Start of memberFunctionString
1147static std::map<SgNode*,std::unordered_map<SgNode*,std::string> > p_globalQualifiedNameMapForMapsOfTypes;
1148
1149// End of memberFunctionString
1150
1154 friend struct Rose::Traits::generated::describe_field_t<SgNode, bool,&SgNode::p_containsTransformation>;
1156
1157/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1158
1159
1160 };
1161#endif
1162
1163// postdeclarations for SgNode
1164
1165/* #line 1166 "../../../src/frontend/SageIII//SgNode.h" */
1166
1167/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
1168
1169/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1170
1171
1172/* #line 1173 "../../../src/frontend/SageIII//SgNode.h" */
1173
1174#endif // ROSE_SgNode_H
1175
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Stores named attributes in Sage IR nodes.
Base class for all IR node attribute values.
Attribute containing a regex expression as a string.
For preprocessing information including source comments, include , if, define, etc.
Base class for machine instructions.
Supporting class from copy mechanism within ROSE.
Definition sageCopy.h:26
This class represents the function type table (stores all function types so that they can be shared i...
This class represents the base class for all IR nodes within Sage III.
std::string unparseToCompleteString()
This function unparses the AST node (including comments and white space)
SgNode * p_parent
This is the pointer to the parent IR node in the AST.
virtual Sg_File_Info * get_startOfConstruct(void) const
New function interface for Sg_File_Info data stores starting location of contruct (typically the open...
Definition SgNode.h:766
virtual VariantT variantT() const
returns new style SageIII enum values
ROSE_DLL_API friend const SgNode * isSgNode(const SgNode *s)
Casts pointer from base class to derived class (for const pointers)
static SgTypeTable * get_globalTypeTable()
Access function for symbol table specific to non-function types.
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual Sg_File_Info * get_endOfConstruct(void) const
New function interface for Sg_File_Info data stores ending location of contruct (typically the closin...
Definition SgNode.h:771
virtual size_t get_numberOfTraversalSuccessors() const
return number of children in the traversal successor list
bool get_containsTransformation() const
Acess function for containsTransformation flag.
virtual std::vector< VirtualCFG::CFGEdge > cfgInEdges(unsigned int index=false)
Find the in edges of a CFG node – internal version.
void set_isModified(bool isModified)
All nodes in the AST contain a isModified flag used to track changes to the AST.
virtual std::vector< std::string > get_traversalSuccessorNamesContainer() const
container of names of variables or container indices used used in the traversal to access AST success...
virtual void debugSerializationEnd(const char *className)
Called by generated serializers.
Definition SgNode.h:1062
SgNode(const SgNodeStorageClass &source)
IR node constructor to support AST File I/O.
static std::string getNodeIdString(SgNode *sgnode)
compute the NodeId for a particular SgNode*.
virtual bool isInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
VirtualCFG::CFGNode cfgForEnd()
Returns the CFG node for just after this AST node.
std::enable_if< std::is_pointer< T >::value, void >::type changeChildPointer(T &edge, T const &child)
Set a child edge in a tree to point to a specific child.
Definition SgNode.h:957
void set_parent(SgNode *parent)
All nodes in the AST contain a reference to a parent node.
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler *)
FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools
virtual size_t get_childIndex(SgNode *child) const
index-based access to traversal successors by child node
SgNode * get_parent() const
Access function for parent node.
virtual std::vector< SgNode * > get_traversalSuccessorContainer() const
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
bool isChild(SgNode *node) const
Query function for if the input IR nodes is a child of the current IR node.
virtual std::string class_name() const
returns a string representing the class name
int numberOfNodesInSubtree()
Computes the number of nodes in the defined subtree of the AST.
virtual long getChildIndex(SgNode *childNode) const
FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR no...
VirtualCFG::CFGNode cfgForBeginning()
Returns the CFG node for just before this AST node.
virtual std::string unparseToString(SgUnparse_Info *info) const
This function unparses the AST node (excluding comments and unnecessary white space)
virtual unsigned int cfgFindChildIndex(SgNode *n)
Find the index of n in this node's CFG children.
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
Definition SgNode.h:1059
static void set_globalTypeTable(SgTypeTable *globalTypeTable)
Access function for symbol table specific to non-function types.
static std::vector< std::string > buildCommandLineToSubstituteTransformationFile(const std::vector< std::string > &argv, std::string newFileName)
Command line support for this compilation The command line is saved as a static variable so that it w...
virtual unsigned int cfgIndexForEnd() const
Determine the CFG index for the end of this construct.
static std::enable_if< std::is_base_of< SgNode, T >::value, T * >::type createAndParent(SgNode *parent)
Allocate and return a new node after setting its parent.
Definition SgNode.h:879
virtual SgNode * get_traversalSuccessorByIndex(size_t idx) const
index-based access to traversal successors by index number
static void visitRepresentativeNode(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for type-based traversal.
virtual void checkDataMemberPointersIfInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
static size_t numberOfNodes()
Returns the total number of IR nodes of this type.
bool get_isModified() const
Acess function for isModified flag.
ROSE_DLL_API friend SgNode * isSgNode(SgNode *s)
Casts pointer from base class to derived class.
int depthOfSubtree()
Computes the depth of the current defined subtree of the AST.
static SgFunctionTypeTable * get_globalFunctionTypeTable()
Access function for symbol table specific to function types.
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
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 SgNode.h:761
virtual std::vector< VirtualCFG::CFGEdge > cfgOutEdges(unsigned int index=false)
Find the out edges of a CFG node – internal version.
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
std::enable_if<!std::is_pointer< T >::value, void >::type changeChildPointer(T &edge, T const &child)
Set a child edge in a tree to point to a specific child.
Definition SgNode.h:1003
void executeVisitorMemberFunction(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
static SgNode * getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx)
Find a node by its variant type, pool index, and item index.
virtual unsigned int cfgFindNextChildIndex(SgNode *n)
Find the index just after n in this node's CFG children.
static size_t memoryUsage()
Returns the size in bytes of the total memory allocated for all IR nodes of this type.
static void traverseMemoryPoolNodes(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
virtual void post_construction_initialization()
Final initialization for constructors This function is called at the end of generated constructors to...
T * initParentPointer(T *child, SgNode *parent)
Generated for tree edge data member initializations.
Definition SgNode.h:895
virtual std::vector< std::pair< SgNode *, std::string > > returnDataMemberPointers() const
FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools
static void set_globalFunctionTypeTable(SgFunctionTypeTable *globalFunctionTypeTable)
Access function for symbol table specific to function types.
virtual const char * sage_class_name() const
void set_containsTransformation(bool containsTransformation)
Many nodes can hide other AST nodes and we need to track when outer nodes contain modified nodes even...
bool p_isModified
Records if IR node has been modified (data members reset).
bool get_isVisited() const
DOCS IN HEADER: Access function for p_isVisited flag used previously by the AST traversals.
static SgNode * getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx)
FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
SgNode * p_freepointer
This is the pointer to the chain of previously freed objects.
virtual bool cfgIsIndexInteresting(unsigned int index) const
Determine whether a particular CFG node index is "interesting" for this kind of node.
SgNode * addRegExpAttribute(std::string s, AstRegExAttribute *a)
Support for AST matching using regular expression.
SgNode * get_raw_parent() const
Access function for direct access to uncomputed value of parent node.
virtual void destructorHelper()
This gets called by all Rosebud-generated destructors.
Definition SgNode.h:1049
This class represents the location of the code associated with the IR node in the original source cod...
A node in the control flow graph.
Definition virtualCFG.h:70
The ROSE library.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.