2#ifndef ROSE_SgAsmCilMetadataHeap_H 
    3#define ROSE_SgAsmCilMetadataHeap_H 
    5#include <Cxx_GrammarDeclarations.h> 
    6#include <SgAsmCilDataStream.h> 
   27#ifdef ROSE_SgAsmCilMetadataHeap_IMPL 
   28#include <SgAsmCilAssemblyTable.h> 
   29#include <SgAsmCilAssemblyOSTable.h> 
   30#include <SgAsmCilAssemblyProcessorTable.h> 
   31#include <SgAsmCilAssemblyRefTable.h> 
   32#include <SgAsmCilAssemblyRefOSTable.h> 
   33#include <SgAsmCilAssemblyRefProcessorTable.h> 
   34#include <SgAsmCilClassLayoutTable.h> 
   35#include <SgAsmCilConstantTable.h> 
   36#include <SgAsmCilCustomAttributeTable.h> 
   37#include <SgAsmCilDeclSecurityTable.h> 
   38#include <SgAsmCilEventTable.h> 
   39#include <SgAsmCilEventMapTable.h> 
   40#include <SgAsmCilExportedTypeTable.h> 
   41#include <SgAsmCilFieldTable.h> 
   42#include <SgAsmCilFieldLayoutTable.h> 
   43#include <SgAsmCilFieldMarshalTable.h> 
   44#include <SgAsmCilFieldRVATable.h> 
   45#include <SgAsmCilFileTable.h> 
   46#include <SgAsmCilGenericParamTable.h> 
   47#include <SgAsmCilGenericParamConstraintTable.h> 
   48#include <SgAsmCilImplMapTable.h> 
   49#include <SgAsmCilInterfaceImplTable.h> 
   50#include <SgAsmCilManifestResourceTable.h> 
   51#include <SgAsmCilMemberRefTable.h> 
   52#include <SgAsmCilMethodDefTable.h> 
   53#include <SgAsmCilMethodImplTable.h> 
   54#include <SgAsmCilMethodSemanticsTable.h> 
   55#include <SgAsmCilMethodSpecTable.h> 
   56#include <SgAsmCilModuleTable.h> 
   57#include <SgAsmCilModuleRefTable.h> 
   58#include <SgAsmCilNestedClassTable.h> 
   59#include <SgAsmCilParamTable.h> 
   60#include <SgAsmCilPropertyTable.h> 
   61#include <SgAsmCilPropertyMapTable.h> 
   62#include <SgAsmCilStandAloneSigTable.h> 
   63#include <SgAsmCilTypeDefTable.h> 
   64#include <SgAsmCilTypeRefTable.h> 
   65#include <SgAsmCilTypeSpecTable.h> 
   73#if !defined(DOCUMENTATION) 
   88#ifdef ROSE_ENABLE_BOOST_SERIALIZATION 
   90    friend class boost::serialization::access;
 
   96        s & BOOST_SERIALIZATION_NVP(p_ReservedAlwaysZero);
 
   97        s & BOOST_SERIALIZATION_NVP(p_MajorVersion);
 
   98        s & BOOST_SERIALIZATION_NVP(p_MinorVersion);
 
   99        s & BOOST_SERIALIZATION_NVP(p_HeapSizes);
 
  100        s & BOOST_SERIALIZATION_NVP(p_ReservedAlwaysOne);
 
  101        s & BOOST_SERIALIZATION_NVP(p_Valid);
 
  102        s & BOOST_SERIALIZATION_NVP(p_Sorted);
 
  103        s & BOOST_SERIALIZATION_NVP(p_NumberOfRows);
 
  104        s & BOOST_SERIALIZATION_NVP(p_DataSizeFlags);
 
  105        s & BOOST_SERIALIZATION_NVP(p_AssemblyTable);
 
  106        s & BOOST_SERIALIZATION_NVP(p_AssemblyOSTable);
 
  107        s & BOOST_SERIALIZATION_NVP(p_AssemblyProcessorTable);
 
  108        s & BOOST_SERIALIZATION_NVP(p_AssemblyRefTable);
 
  109        s & BOOST_SERIALIZATION_NVP(p_AssemblyRefOSTable);
 
  110        s & BOOST_SERIALIZATION_NVP(p_AssemblyRefProcessorTable);
 
  111        s & BOOST_SERIALIZATION_NVP(p_ClassLayoutTable);
 
  112        s & BOOST_SERIALIZATION_NVP(p_ConstantTable);
 
  113        s & BOOST_SERIALIZATION_NVP(p_CustomAttributeTable);
 
  114        s & BOOST_SERIALIZATION_NVP(p_DeclSecurityTable);
 
  115        s & BOOST_SERIALIZATION_NVP(p_EventTable);
 
  116        s & BOOST_SERIALIZATION_NVP(p_EventMapTable);
 
  117        s & BOOST_SERIALIZATION_NVP(p_ExportedTypeTable);
 
  118        s & BOOST_SERIALIZATION_NVP(p_FieldTable);
 
  119        s & BOOST_SERIALIZATION_NVP(p_FieldLayoutTable);
 
  120        s & BOOST_SERIALIZATION_NVP(p_FieldMarshalTable);
 
  121        s & BOOST_SERIALIZATION_NVP(p_FieldRVATable);
 
  122        s & BOOST_SERIALIZATION_NVP(p_FileTable);
 
  123        s & BOOST_SERIALIZATION_NVP(p_GenericParamTable);
 
  124        s & BOOST_SERIALIZATION_NVP(p_GenericParamConstraintTable);
 
  125        s & BOOST_SERIALIZATION_NVP(p_ImplMapTable);
 
  126        s & BOOST_SERIALIZATION_NVP(p_InterfaceImplTable);
 
  127        s & BOOST_SERIALIZATION_NVP(p_ManifestResourceTable);
 
  128        s & BOOST_SERIALIZATION_NVP(p_MemberRefTable);
 
  129        s & BOOST_SERIALIZATION_NVP(p_MethodDefTable);
 
  130        s & BOOST_SERIALIZATION_NVP(p_MethodImplTable);
 
  131        s & BOOST_SERIALIZATION_NVP(p_MethodSemanticsTable);
 
  132        s & BOOST_SERIALIZATION_NVP(p_MethodSpecTable);
 
  133        s & BOOST_SERIALIZATION_NVP(p_ModuleTable);
 
  134        s & BOOST_SERIALIZATION_NVP(p_ModuleRefTable);
 
  135        s & BOOST_SERIALIZATION_NVP(p_NestedClassTable);
 
  136        s & BOOST_SERIALIZATION_NVP(p_ParamTable);
 
  137        s & BOOST_SERIALIZATION_NVP(p_PropertyTable);
 
  138        s & BOOST_SERIALIZATION_NVP(p_PropertyMapTable);
 
  139        s & BOOST_SERIALIZATION_NVP(p_StandAloneSigTable);
 
  140        s & BOOST_SERIALIZATION_NVP(p_TypeDefTable);
 
  141        s & BOOST_SERIALIZATION_NVP(p_TypeRefTable);
 
  142        s & BOOST_SERIALIZATION_NVP(p_TypeSpecTable);
 
  151    uint32_t 
const& get_ReservedAlwaysZero() 
const;
 
  152    void set_ReservedAlwaysZero(uint32_t 
const&);
 
  159    uint8_t 
const& get_MajorVersion() 
const;
 
  160    void set_MajorVersion(uint8_t 
const&);
 
  167    uint8_t 
const& get_MinorVersion() 
const;
 
  168    void set_MinorVersion(uint8_t 
const&);
 
  175    uint8_t 
const& get_HeapSizes() 
const;
 
  176    void set_HeapSizes(uint8_t 
const&);
 
  183    uint8_t 
const& get_ReservedAlwaysOne() 
const;
 
  184    void set_ReservedAlwaysOne(uint8_t 
const&);
 
  191    uint64_t 
const& get_Valid() 
const;
 
  192    void set_Valid(uint64_t 
const&);
 
  199    uint64_t 
const& get_Sorted() 
const;
 
  200    void set_Sorted(uint64_t 
const&);
 
  207    std::vector<uint32_t> 
const& get_NumberOfRows() 
const;
 
  208    void set_NumberOfRows(std::vector<uint32_t> 
const&);
 
  215    uint64_t 
const& get_DataSizeFlags() 
const;
 
  216    void set_DataSizeFlags(uint64_t 
const&);
 
  527      e_ref_string_heap           = 1 << 0,
 
  528      e_ref_guid_heap             = 1 << 1,
 
  529      e_ref_blob_heap             = 1 << 2,
 
  531      e_ref_assembly_ref          = 1 << 3,
 
  532      e_ref_type_def              = 1 << 4,
 
  533      e_ref_event                 = 1 << 5,
 
  534      e_ref_field                 = 1 << 6,
 
  535      e_ref_generic_param         = 1 << 7,
 
  536      e_ref_module_ref            = 1 << 8,
 
  537      e_ref_method_def            = 1 << 9,
 
  538      e_ref_param                 = 1 << 10,
 
  539      e_ref_property              = 1 << 11,
 
  541      e_ref_has_constant          = 1 << 12,
 
  542      e_ref_has_custom_attribute  = 1 << 13,
 
  543      e_ref_has_decl_security     = 1 << 14,
 
  544      e_ref_has_field_marshall    = 1 << 15,
 
  545      e_ref_has_semantics         = 1 << 16,
 
  546      e_ref_method_def_or_ref     = 1 << 17,
 
  547      e_ref_type_def_or_ref       = 1 << 18,
 
  548      e_ref_implementation        = 1 << 19,
 
  549      e_ref_member_forwarded      = 1 << 20,
 
  550      e_ref_member_ref_parent     = 1 << 21,
 
  551      e_ref_type_or_method_def    = 1 << 22,
 
  552      e_ref_custom_attribute_type = 1 << 23,
 
  553      e_ref_resolution_scope      = 1 << 24,
 
  554      e_ref_last                  = 1 << 25,
 
  557    enum TableKind : std::uint8_t
 
  562      e_AssemblyProcessor = 0x21,
 
  563      e_AssemblyRef = 0x23,
 
  564      e_AssemblyRefOS = 0x25,
 
  565      e_AssemblyRefProcessor = 0x24,
 
  566      e_ClassLayout = 0x0F,
 
  568      e_CustomAttribute = 0x0C,
 
  569      e_DeclSecurity = 0x0E,
 
  572      e_ExportedType = 0x27,
 
  574      e_FieldLayout = 0x10,
 
  575      e_FieldMarshal = 0x0D,
 
  578      e_GenericParam = 0x2A,
 
  579      e_GenericParamConstraint = 0x2C,
 
  581      e_InterfaceImpl = 0x09,
 
  582      e_ManifestResource = 0x28,
 
  586      e_MethodSemantics = 0x18,
 
  590      e_NestedClass = 0x29,
 
  593      e_PropertyMap = 0x15,
 
  594      e_StandAloneSig = 0x11,
 
  598      e_Unknown_table_kind = 0xFF
 
  602    void parse(
const std::vector<uint8_t>& buf, 
size_t startOfMetaData) 
override;
 
  605    void unparse(std::vector<uint8_t>& buf, 
size_t startOfMetaData) 
const override;
 
  608    void dump(std::ostream& os) 
const override;
 
  613    SgAsmCilMetadata* get_MetadataNode(std::uint32_t idx, TableKind tblcode) 
const;
 
  619    SgAsmCilMetadata* get_CodedMetadataNode(std::uint32_t refcode, ReferenceKind knd) 
const;
 
  625    SgAsmCilMetadata* get_MetadataNode(std::uint32_t refcode, ReferenceKind knd) 
const;
 
  637                         uint32_t 
const& Size,
 
  638                         std::string 
const& Name,
 
  639                         uint32_t 
const& NamePadding);
 
  667          virtual std::string 
class_name() 
const override;
 
  670          virtual VariantT 
variantT() 
const override; 
 
  675          enum { static_variant = V_SgAsmCilMetadataHeap };
 
  690          static const unsigned pool_size; 
 
  692          static std::vector<unsigned char *> pools; 
 
  697          static unsigned long initializeStorageClassArray(SgAsmCilMetadataHeapStorageClass *); 
 
  700          static void clearMemoryPool(); 
 
  701          static void deleteMemoryPool(); 
 
  704          static void extendMemoryPoolForFileIO(); 
 
  709          static SgAsmCilMetadataHeap * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, 
unsigned long); 
 
  712          static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long); 
 
  714          static void resetValidFreepointers(); 
 
  716          static unsigned long getNumberOfLastValidPointer(); 
 
  719#if defined(INLINE_FUNCTIONS) 
  721          inline void *
operator new (
size_t size);
 
  724          void *
operator new (
size_t size);
 
  727          void operator delete (
void* pointer, 
size_t size);
 
  730          void operator delete (
void* pointer)
 
  776#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT 
  779          virtual RTIReturnType 
roseRTI() 
override;
 
  793          virtual const char* 
sage_class_name() const  override ROSE_DEPRECATED_FUNCTION;
 
  799          virtual int variant() const ROSE_DEPRECATED_FUNCTION;
 
  981          friend class SgAsmCilMetadataHeapStorageClass;
 
  984          friend class AstSpecificDataManagingClass;
 
  987          friend class AstSpecificDataManagingClassStorageClass;
 
 1019#define BUILD_ATERM_SUPPORT 0 
 1020   #if BUILD_ATERM_SUPPORT 
 1021   #ifdef ROSE_USE_ROSE_ATERM_SUPPORT 
 1033          virtual ATerm generate_ATerm() 
override;
 
 1036          virtual void generate_ATerm_Annotation(ATerm & term) 
override;
 
 1108uint32_t p_ReservedAlwaysZero;
 
 1112uint8_t p_MajorVersion;
 
 1116uint8_t p_MinorVersion;
 
 1124uint8_t p_ReservedAlwaysOne;
 
 1136std::vector<uint32_t> p_NumberOfRows;
 
 1140uint64_t p_DataSizeFlags;
 
Class holding static data and functions supporting File I/O.
 
Attribute containing a regex expression as a string.
 
CIL AssemblyProcessor tables.
 
CIL AssemblyRefOS tables.
 
CIL AssemblyRefProcessor tables.
 
CIL CustomAttribute tables.
 
Base class for CIL branch of binary analysis IR nodes.
 
virtual void dump(std::ostream &os) const
Prints the object's data in a human readable form.
 
virtual void unparse(std::vector< uint8_t > &buf, size_t startOfMetaData) const
Unparses the metadata objects into the buffer.
 
void initializeProperties()
Initialize all properties that have explicit initial values.
 
CIL GenericParamConstraint tables.
 
CIL InterfaceImpl tables.
 
CIL ManifestResource tables.
 
CIL MethodSemantics tables.
 
CIL StandAloneSig tables.
 
Supporting class from copy mechanism within ROSE.
 
This class represents the base class for all IR nodes within Sage III.
 
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
 
virtual size_t get_numberOfTraversalSuccessors() const
return number of children in the traversal successor list
 
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.
 
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...
 
int variant() const
Older version function returns enum value "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
 
virtual std::vector< SgNode * > get_traversalSuccessorContainer() const
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
 
virtual VariantT variantT() const
returns new style SageIII enum values
 
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...
 
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
 
virtual SgNode * get_traversalSuccessorByIndex(size_t idx) const
index-based access to traversal successors by index number
 
virtual std::string class_name() const
returns a string representing the class name
 
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.
 
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
 
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
 
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.
 
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 const char * sage_class_name() const
generates string representing the class name: (e.g. for SgNode returns "SgNode").
 
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 SgNode * getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx)
FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
 
SgNode * addRegExpAttribute(std::string s, AstRegExAttribute *a)
Support for AST matching using regular expression.
 
void parse(SgAsmGenericFile *)
Main function to parse DWARF information.
 
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
 
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.