/tests/CompileTests/RoseExample_tests/trial_Cxx_Grammar.C
C | 14108 lines | 8485 code | 2536 blank | 3087 comment | 1750 complexity | 8b54bf5d5c2e8df473121fd27356c4cb MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause, Apache-2.0
Large files files are truncated, but you can click here to view the full file
- // MACHINE GENERATED SOURCE FILE --- DO NOT MODIFY!
- #include "sage3basic.h"
- #include "sage3.h"
- #if 1
- #include "AST_FILE_IO.h"
- using namespace std;
- // Simplify code by using std namespace (never put into header files since it effects users)
- using namespace std;
- static struct
- {
- Cxx_GrammarVariants variant;
- std::string name;
- } Cxx_GrammarTerminalNames[317] = {
- {ModifierTag, "SgModifier"},
- {BitAttributeTag, "SgBitAttribute"},
- {AttributeTag, "SgAttribute"},
- {GraphNodeTag, "SgGraphNode"},
- {GraphEdgeTag, "SgGraphEdge"},
- {GraphTag, "SgGraph"},
- {SupportTag, "SgSupport"},
- {T_PARTIAL_FUNCTION, "SgPartialFunctionType"},
- {T_MEMBERFUNCTION, "SgMemberFunctionType"},
- {T_FUNCTION, "SgFunctionType"},
- {T_POINTER, "SgPointerType"},
- {T_NAME, "SgNamedType"},
- {TypeTag, "SgType"},
- {EXPR_INIT, "SgInitializer"},
- {UNARY_EXPRESSION, "SgUnaryOp"},
- {BINARY_EXPRESSION, "SgBinaryOp"},
- {ValueExpTag, "SgValueExp"},
- {ExpressionTag, "SgExpression"},
- {FORTRAN_DO, "SgFortranDo"},
- {IO_CONTROL_STATEMENT, "SgIOControlStatement"},
- {CLASS_DECL_STMT, "SgClassDeclaration"},
- {CLASS_DEFN_STMT, "SgClassDefinition"},
- {SCOPE_STMT, "SgScopeStatement"},
- {MFUNC_DECL_STMT, "SgMemberFunctionDeclaration"},
- {FUNC_DECL_STMT, "SgFunctionDeclaration"},
- {CPP_DIRECTIVE_STMT, "SgC_PreprocessorDirectiveStatement"},
- {C_LINKAGE_DECLARATION_STMT, "SgClinkageDeclarationStatement"},
- {DECL_STMT, "SgDeclarationStatement"},
- {StatementTag, "SgStatement"},
- {FUNCTION_NAME, "SgFunctionSymbol"},
- {SymbolTag, "SgSymbol"},
- {LocatedNodeTag, "SgLocatedNode"},
- {NodeTag, "SgNode"},
- {SymbolTableTag, "SgSymbolTable"},
- {InitializedNameTag, "SgInitializedName"},
- {NameTag, "SgName"},
- {PragmaTag, "SgPragma"},
- {ModifierNodesTag, "SgModifierNodes"},
- {ConstVolatileModifierTag, "SgConstVolatileModifier"},
- {StorageModifierTag, "SgStorageModifier"},
- {AccessModifierTag, "SgAccessModifier"},
- {FunctionModifierTag, "SgFunctionModifier"},
- {UPC_AccessModifierTag, "SgUPC_AccessModifier"},
- {LinkageModifierTag, "SgLinkageModifier"},
- {SpecialFunctionModifierTag, "SgSpecialFunctionModifier"},
- {TypeModifierTag, "SgTypeModifier"},
- {ElaboratedTypeModifierTag, "SgElaboratedTypeModifier"},
- {BaseClassModifierTag, "SgBaseClassModifier"},
- {DeclarationModifierTag, "SgDeclarationModifier"},
- {_File_InfoTag, "Sg_File_Info"},
- {FileTag, "SgFile"},
- {FileListTag, "SgFileList"},
- {DirectoryTag, "SgDirectory"},
- {DirectoryListTag, "SgDirectoryList"},
- {ProjectTag, "SgProject"},
- {OptionsTag, "SgOptions"},
- {Unparse_InfoTag, "SgUnparse_Info"},
- {FuncDecl_attrTag, "SgFuncDecl_attr"},
- {ClassDecl_attrTag, "SgClassDecl_attr"},
- {T_TYPEDEF_SEQ, "SgTypedefSeq"},
- {T_FUNCTION_PARAMETER_TYPE_LIST, "SgFunctionParameterTypeList"},
- {TemplateParameterTag, "SgTemplateParameter"},
- {TemplateArgumentTag, "SgTemplateArgument"},
- {TemplateParameterListTag, "SgTemplateParameterList"},
- {TemplateArgumentListTag, "SgTemplateArgumentList"},
- {BaseClassTag, "SgBaseClass"},
- {DirectedGraphTag, "SgDirectedGraph"},
- {DirectedGraphNodeTag, "SgDirectedGraphNode"},
- {DirectedGraphEdgeTag, "SgDirectedGraphEdge"},
- {QualifiedNameTag, "SgQualifiedName"},
- {T_UNKNOWN, "SgTypeUnknown"},
- {T_CHAR, "SgTypeChar"},
- {T_SIGNED_CHAR, "SgTypeSignedChar"},
- {T_UNSIGNED_CHAR, "SgTypeUnsignedChar"},
- {T_SHORT, "SgTypeShort"},
- {T_SIGNED_SHORT, "SgTypeSignedShort"},
- {T_UNSIGNED_SHORT, "SgTypeUnsignedShort"},
- {T_INT, "SgTypeInt"},
- {T_SIGNED_INT, "SgTypeSignedInt"},
- {T_UNSIGNED_INT, "SgTypeUnsignedInt"},
- {T_LONG, "SgTypeLong"},
- {T_SIGNED_LONG, "SgTypeSignedLong"},
- {T_UNSIGNED_LONG, "SgTypeUnsignedLong"},
- {T_VOID, "SgTypeVoid"},
- {T_GLOBAL_VOID, "SgTypeGlobalVoid"},
- {T_WCHAR, "SgTypeWchar"},
- {T_FLOAT, "SgTypeFloat"},
- {T_DOUBLE, "SgTypeDouble"},
- {T_LONG_LONG, "SgTypeLongLong"},
- {T_UNSIGNED_LONG_LONG, "SgTypeUnsignedLongLong"},
- {T_LONG_DOUBLE, "SgTypeLongDouble"},
- {T_STRING, "SgTypeString"},
- {T_BOOL, "SgTypeBool"},
- {T_COMPLEX, "SgTypeComplex"},
- {T_IMAGINARY, "SgTypeImaginary"},
- {T_DEFAULT, "SgTypeDefault"},
- {T_MEMBER_POINTER, "SgPointerMemberType"},
- {T_REFERENCE, "SgReferenceType"},
- {T_CLASS, "SgClassType"},
- {T_TEMPLATE, "SgTemplateType"},
- {T_ENUM, "SgEnumType"},
- {T_TYPEDEF, "SgTypedefType"},
- {T_MODIFIER, "SgModifierType"},
- {T_PARTIAL_FUNCTION_MODIFIER, "SgPartialFunctionModifierType"},
- {T_ARRAY, "SgArrayType"},
- {T_ELLIPSE, "SgTypeEllipse"},
- {UnknownMemberFunctionTag, "SgUnknownMemberFunctionType"},
- {T_QUALIFIED_NAME, "SgQualifiedNameType"},
- {EXPR_LIST, "SgExprListExp"},
- {VAR_REF, "SgVarRefExp"},
- {CLASSNAME_REF, "SgClassNameRefExp"},
- {FUNCTION_REF, "SgFunctionRefExp"},
- {MEMBER_FUNCTION_REF, "SgMemberFunctionRefExp"},
- {FUNC_CALL, "SgFunctionCallExp"},
- {SIZEOF_OP, "SgSizeOfOp"},
- {VA_START_OP, "SgVarArgStartOp"},
- {VA_START_ONE_OPERAND_OP, "SgVarArgStartOneOperandOp"},
- {VA_OP, "SgVarArgOp"},
- {VA_END_OP, "SgVarArgEndOp"},
- {VA_COPY_OP, "SgVarArgCopyOp"},
- {TYPEID_OP, "SgTypeIdOp"},
- {EXPR_CONDITIONAL, "SgConditionalExp"},
- {NEW_OP, "SgNewExp"},
- {DELETE_OP, "SgDeleteExp"},
- {THIS_NODE, "SgThisExp"},
- {TYPE_REF, "SgRefExp"},
- {AGGREGATE_INIT, "SgAggregateInitializer"},
- {CONSTRUCTOR_INIT, "SgConstructorInitializer"},
- {ASSIGN_INIT, "SgAssignInitializer"},
- {EXPRESSION_ROOT, "SgExpressionRoot"},
- {UNARY_MINUS_OP, "SgMinusOp"},
- {UNARY_ADD_OP, "SgUnaryAddOp"},
- {NOT_OP, "SgNotOp"},
- {DEREF_OP, "SgPointerDerefExp"},
- {ADDRESS_OP, "SgAddressOfOp"},
- {MINUSMINUS_OP, "SgMinusMinusOp"},
- {PLUSPLUS_OP, "SgPlusPlusOp"},
- {BIT_COMPLEMENT_OP, "SgBitComplementOp"},
- {CAST_OP, "SgCastExp"},
- {THROW_OP, "SgThrowOp"},
- {POINTST_OP, "SgArrowExp"},
- {RECORD_REF, "SgDotExp"},
- {DOTSTAR_OP, "SgDotStarOp"},
- {ARROWSTAR_OP, "SgArrowStarOp"},
- {EQ_OP, "SgEqualityOp"},
- {LT_OP, "SgLessThanOp"},
- {GT_OP, "SgGreaterThanOp"},
- {NE_OP, "SgNotEqualOp"},
- {LE_OP, "SgLessOrEqualOp"},
- {GE_OP, "SgGreaterOrEqualOp"},
- {ADD_OP, "SgAddOp"},
- {SUBT_OP, "SgSubtractOp"},
- {MULT_OP, "SgMultiplyOp"},
- {DIV_OP, "SgDivideOp"},
- {INTEGER_DIV_OP, "SgIntegerDivideOp"},
- {MOD_OP, "SgModOp"},
- {AND_OP, "SgAndOp"},
- {OR_OP, "SgOrOp"},
- {BITXOR_OP, "SgBitXorOp"},
- {BITAND_OP, "SgBitAndOp"},
- {BITOR_OP, "SgBitOrOp"},
- {COMMA_OP, "SgCommaOpExp"},
- {LSHIFT_OP, "SgLshiftOp"},
- {RSHIFT_OP, "SgRshiftOp"},
- {ARRAY_OP, "SgPntrArrRefExp"},
- {SCOPE_OP, "SgScopeOp"},
- {ASSIGN_OP, "SgAssignOp"},
- {PLUS_ASSIGN_OP, "SgPlusAssignOp"},
- {MINUS_ASSIGN_OP, "SgMinusAssignOp"},
- {AND_ASSIGN_OP, "SgAndAssignOp"},
- {IOR_ASSIGN_OP, "SgIorAssignOp"},
- {MULT_ASSIGN_OP, "SgMultAssignOp"},
- {DIV_ASSIGN_OP, "SgDivAssignOp"},
- {MOD_ASSIGN_OP, "SgModAssignOp"},
- {XOR_ASSIGN_OP, "SgXorAssignOp"},
- {LSHIFT_ASSIGN_OP, "SgLshiftAssignOp"},
- {RSHIFT_ASSIGN_OP, "SgRshiftAssignOp"},
- {BOOL_VAL, "SgBoolValExp"},
- {STRING_VAL, "SgStringVal"},
- {SHORT_VAL, "SgShortVal"},
- {CHAR_VAL, "SgCharVal"},
- {UNSIGNED_CHAR_VAL, "SgUnsignedCharVal"},
- {WCHAR_VAL, "SgWcharVal"},
- {UNSIGNED_SHORT_VAL, "SgUnsignedShortVal"},
- {INT_VAL, "SgIntVal"},
- {ENUM_VAL, "SgEnumVal"},
- {UNSIGNED_INT_VAL, "SgUnsignedIntVal"},
- {LONG_INT_VAL, "SgLongIntVal"},
- {LONG_LONG_INT_VAL, "SgLongLongIntVal"},
- {UNSIGNED_LONG_LONG_INT_VAL, "SgUnsignedLongLongIntVal"},
- {UNSIGNED_LONG_INT_VAL, "SgUnsignedLongVal"},
- {FLOAT_VAL, "SgFloatVal"},
- {DOUBLE_VAL, "SgDoubleVal"},
- {LONG_DOUBLE_VAL, "SgLongDoubleVal"},
- {COMPLEX_VAL, "SgComplexVal"},
- {NULL_EXPR, "SgNullExpression"},
- {VARIANT_EXPR, "SgVariantExpression"},
- {STMT_EXPR, "SgStatementExpression"},
- {ASM_OP, "SgAsmOp"},
- {INTRINSICFN, "SgIntrinsicFn"},
- {SUBSCRIPT_EXPR, "SgSubscriptExpression"},
- {SUBSCRIPT_COLON, "SgSubscriptColon"},
- {COLON, "SgColon"},
- {SUBSCRIPT_ASTERISK, "SgSubscriptAsterisk"},
- {USE_ONLY_EXPR, "SgUseOnlyExpression"},
- {USE_RENAME_EXPR, "SgUseRenameExpression"},
- {IO_ITEM_EXPR, "SgIOItemExpression"},
- {IO_IMPLIED_DO, "SgIOImpliedDo"},
- {EXPONENTIATION_OP, "SgExponentiationOp"},
- {FOR_STMT, "SgForStatement"},
- {FOR_INIT_STMT, "SgForInitStatement"},
- {CATCH_STATEMENT_SEQ, "SgCatchStatementSeq"},
- {FUNCTION_PARAMETER_LIST, "SgFunctionParameterList"},
- {CTOR_INITIALIZER_LIST, "SgCtorInitializerList"},
- {BASIC_BLOCK_STMT, "SgBasicBlock"},
- {GLOBAL_STMT, "SgGlobal"},
- {IF_STMT, "SgIfStmt"},
- {FUNC_DEFN_STMT, "SgFunctionDefinition"},
- {WHILE_STMT, "SgWhileStmt"},
- {DO_WHILE_STMT, "SgDoWhileStmt"},
- {SWITCH_STMT, "SgSwitchStatement"},
- {CATCH_STMT, "SgCatchOptionStmt"},
- {VAR_DECL_STMT, "SgVariableDeclaration"},
- {VAR_DEFN_STMT, "SgVariableDefinition"},
- {ENUM_DECL_STMT, "SgEnumDeclaration"},
- {ASM_STMT, "SgAsmStmt"},
- {TYPEDEF_STMT, "SgTypedefDeclaration"},
- {FUNC_TBL_STMT, "SgFunctionTypeTable"},
- {EXPR_STMT, "SgExprStatement"},
- {LABEL_STMT, "SgLabelStatement"},
- {CASE_STMT, "SgCaseOptionStmt"},
- {TRY_STMT, "SgTryStmt"},
- {DEFAULT_STMT, "SgDefaultOptionStmt"},
- {BREAK_STMT, "SgBreakStmt"},
- {CONTINUE_STMT, "SgContinueStmt"},
- {RETURN_STMT, "SgReturnStmt"},
- {GOTO_STMT, "SgGotoStatement"},
- {SPAWN_STMT, "SgSpawnStmt"},
- {NULL_STMT, "SgNullStatement"},
- {VARIANT_STMT, "SgVariantStatement"},
- {PRAGMA_DECL, "SgPragmaDeclaration"},
- {TEMPLATE_DECL_STMT, "SgTemplateDeclaration"},
- {TEMPLATE_INST_DECL_STMT, "SgTemplateInstantiationDecl"},
- {TEMPLATE_INST_DEFN_STMT, "SgTemplateInstantiationDefn"},
- {TEMPLATE_INST_FUNCTION_DECL_STMT, "SgTemplateInstantiationFunctionDecl"},
- {TEMPLATE_INST_MEMBER_FUNCTION_DECL_STMT, "SgTemplateInstantiationMemberFunctionDecl"},
- {PROGRAM_HEADER_STMT, "SgProgramHeaderStatement"},
- {PROCEDURE_HEADER_STMT, "SgProcedureHeaderStatement"},
- {FORTRAN_NONBLOCKED_DO, "SgFortranNonblockedDo"},
- {INTERFACE_STATEMENT, "SgInterfaceStatement"},
- {PARAMETER_STATEMENT, "SgParameterStatement"},
- {COMMON_BLOCK, "SgCommonBlock"},
- {MODULE_STATEMENT, "SgModuleStatement"},
- {USE_STATEMENT, "SgUseStatement"},
- {STOP_OR_PAUSE_STATEMENT, "SgStopOrPauseStatement"},
- {IO_STATEMENT, "SgIOStatement"},
- {INPUT_OUTPUT_STATEMENT, "SgInputOutputStatement"},
- {OPEN_STATEMENT, "SgOpenStatement"},
- {CLOSE_STATEMENT, "SgCloseStatement"},
- {INQUIRE_STATEMENT, "SgInquireStatement"},
- {IO_FILE_CONTROL_STMT, "SgIOFileControlStmt"},
- {TEMP_Block_Data_Statement, "SgBlockDataStatement"},
- {TEMP_Implicit_Statement, "SgImplicitStatement"},
- {TEMP_Statement_Function_Statement, "SgStatementFunctionStatement"},
- {TEMP_Where_Statement, "SgWhereStatement"},
- {TEMP_Nullify_Statement, "SgNullifyStatement"},
- {TEMP_Equivalence_Statement, "SgEquivalenceStatement"},
- {TEMP_Derived_Type_Statement, "SgDerivedTypeStatement"},
- {TEMP_Attribute_Specification_Statement, "SgAttributeSpecificationStatement"},
- {TEMP_Allocate_Statement, "SgAllocateStatement"},
- {TEMP_Deallocate_Statement, "SgDeallocateStatement"},
- {TEMP_Contains_Statement, "SgContainsStatement"},
- {TEMP_Sequence_Statement, "SgSequenceStatement"},
- {TEMP_Else_Where_Statement, "SgElseWhereStatement"},
- {TEMP_Arithmetic_If_Statement, "SgArithmeticIfStatement"},
- {TEMP_Assign_Statement, "SgAssignStatement"},
- {TEMP_Computed_Goto_Statement, "SgComputedGotoStatement"},
- {TEMP_Assigned_Goto_Statement, "SgAssignedGotoStatement"},
- {NAMESPACE_DECLARATION_STMT, "SgNamespaceDeclarationStatement"},
- {NAMESPACE_ALIAS_DECLARATION_STMT, "SgNamespaceAliasDeclarationStatement"},
- {NAMESPACE_DEFINITION_STMT, "SgNamespaceDefinitionStatement"},
- {USING_DECLARATION_STMT, "SgUsingDeclarationStatement"},
- {USING_DIRECTIVE_STMT, "SgUsingDirectiveStatement"},
- {TEMPLATE_INST_DIRECTIVE_STMT, "SgTemplateInstantiationDirectiveStatement"},
- {INCLUDE_DIRECTIVE_STMT, "SgIncludeDirectiveStatement"},
- {DEFINE_DIRECTIVE_STMT, "SgDefineDirectiveStatement"},
- {UNDEF_DIRECTIVE_STMT, "SgUndefDirectiveStatement"},
- {IFDEF_DIRECTIVE_STMT, "SgIfdefDirectiveStatement"},
- {IFNDEF_DIRECTIVE_STMT, "SgIfndefDirectiveStatement"},
- {IF_DIRECTIVE_STMT, "SgIfDirectiveStatement"},
- {DEAD_IF_DIRECTIVE_STMT, "SgDeadIfDirectiveStatement"},
- {ELSE_DIRECTIVE_STMT, "SgElseDirectiveStatement"},
- {ELSEIF_DIRECTIVE_STMT, "SgElseifDirectiveStatement"},
- {ENDIF_DIRECTIVE_STMT, "SgEndifDirectiveStatement"},
- {LINE_DIRECTIVE_STMT, "SgLineDirectiveStatement"},
- {WARNING_DIRECTIVE_STMT, "SgWarningDirectiveStatement"},
- {ERROR_DIRECTIVE_STMT, "SgErrorDirectiveStatement"},
- {EMPTY_DIRECTIVE_STMT, "SgEmptyDirectiveStatement"},
- {C_LINKAGE_START_STMT, "SgClinkageStartStatement"},
- {C_LINKAGE_END_STMT, "SgClinkageEndStatement"},
- {VARIABLE_NAME, "SgVariableSymbol"},
- {FUNCTYPE_NAME, "SgFunctionTypeSymbol"},
- {CLASS_NAME, "SgClassSymbol"},
- {TEMPLATE_NAME, "SgTemplateSymbol"},
- {ENUM_NAME, "SgEnumSymbol"},
- {FIELD_NAME, "SgEnumFieldSymbol"},
- {TYPEDEF_NAME, "SgTypedefSymbol"},
- {MEMBER_FUNC_NAME, "SgMemberFunctionSymbol"},
- {LABEL_NAME, "SgLabelSymbol"},
- {DEFAULT_NAME, "SgDefaultSymbol"},
- {NAMESPACE_NAME, "SgNamespaceSymbol"},
- {INTRINSIC_SYMBOL, "SgIntrinsicSymbol"},
- {MODULE_SYMBOL, "SgModuleSymbol"},
- {INTERFACE_SYMBOL, "SgInterfaceSymbol"},
- {COMMON_SYMBOL, "SgCommonSymbol"},
- {TOKEN, "SgToken"},
- {Cxx_Grammar_LAST_TAG, "last tag" }
- };
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarClassDefinitionMacros.macro"
- // ********************************************************
- // member functions specific to each node in the grammar
- // ********************************************************
- #line 6 "../Grammar/grammarClassDefinitionMacros.macro before marker MEMBER_FUNCTION_DEFINITIONS"
- #line 1 ""
- #line 1 ""
- // Start of memberFunctionString
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/dataMemberAccessFunctions.macro"
- // *** DATA ACCESS FUNCTION SECTION BEGINS HERE ***
- SgNode*
- SgNode::get_freepointer () const
- {
- assert (this != NULL);
- return p_freepointer;
- }
- void
- SgNode::set_freepointer ( SgNode* freepointer )
- {
- assert (this != NULL);
- set_isModified(true);
-
- #if DEBUG_SAGE_ACCESS_FUNCTIONS
- if (p_freepointer != NULL && freepointer != NULL && p_freepointer != freepointer)
- {
- printf ("Warning: freepointer = %p overwriting valid pointer p_freepointer = %p \n",freepointer,p_freepointer);
- #if DEBUG_SAGE_ACCESS_FUNCTIONS_ASSERTION
- printf ("Error fails assertion (p_freepointer != NULL && freepointer != NULL && p_freepointer != freepointer) is false\n");
- ROSE_ASSERT(false);
- #endif
- }
- #endif
- p_freepointer = freepointer;
- }
- // *** DATA ACCESS FUNCTION SECTION ENDS HERE ***
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 331 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Common.code"
- // *** COMMON CODE SECTION BEGINS HERE ***
- int
- SgNode::getVariant() const
- {
- // This function is used in ROSE while "variant()" is used in SAGE
- assert(this != NULL);
- return variant();
- }
- // This function is used in ROSE in treeTraversal code
- // eventually replaces getVariant() and variant()
- // though after variant() has been removed for a while we will
- // want to change the name of variantT() back to variant()
- // (since the "T" was ment to stand for temporary).
- // When this happens the variantT() will be depricated.
- VariantT
- SgNode::variantT() const {
- return V_SgNode;
- }
- #if 0
- int
- SgNode::variant() const
- {
- // This function is used in SAGE
- assert(this != NULL);
- return NodeTag;
- }
- #endif
- const char*
- SgNode::sage_class_name() const
- {
- assert(this != NULL);
- return "SgNode";
- }
- std::string
- SgNode::class_name() const
- {
- assert(this != NULL);
- return "SgNode";
- }
- // DQ (11/26/2005): Support for visitor pattern mechanims
- // (inferior to ROSE traversal mechanism, experimental).
- void
- SgNode::executeVisitorMemberFunction (ROSE_VisitorPattern & visitor)
- {
- ROSE_ASSERT(this != NULL);
- visitor.visit(this);
- }
- // *** COMMON CODE SECTION ENDS HERE ***
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 769 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Node.code"
- // ########################################
- // Some global variables used within SAGE 3
- // ########################################
- // declaration of variable to control internal output of debuging information
- int SAGE_DEBUG = 0; // default value is zero
- // JJW (1/19/2007): Added global variable for whether virtual CFG is
- // interprocedural
- bool interproceduralControlFlowGraph = false;
- // ###############################
- // Start of source code for SgNode
- // ###############################
- // Support for global function type symbol table (moved to be static data pointer)
- // DQ (1/31/2006): Modified to build all types in the memory pools
- // SgFunctionTypeTable* SgNode::Sgfunc_type_table = new SgFunctionTypeTable();
- // SgFunctionTypeTable* SgNode::p_globalFunctionTypeTable = new SgFunctionTypeTable();
- SgFunctionTypeTable* SgNode::p_globalFunctionTypeTable = NULL;
- // DQ (3/12/2007): Added mangled name map to improve performance of generating mangled names
- std::map<SgNode*,std::string> SgNode::p_globalMangledNameMap;
- std::map<std::string,int> SgNode::p_shortMangledNameCache;
- // DQ (10/5/2007): Added IR node specific function to permit copies, via AST copy(), to be fixedup
- // Usually this will correct scopes and in a few cases build child IR nodes that are not traversed
- // (and thus shared in the result from the automatically generated copy function).
- void
- SgNode::fixupCopy(SgNode* copy, SgCopyHelp & help) const
- {
- // This is the empty default inplementation, not a problem if it is called!
- }
- // DQ (1/31/2006): We might want this function to be automaticaly generated
- // except that then we could not support the assertion. Also we
- // don't have to set this function, though perhaps the interface function
- // should be implemented to set it just on general principles.
- SgFunctionTypeTable*
- SgNode::get_globalFunctionTypeTable()
- {
- // DQ (1/31/2006): If there is no global function type symbol table then build one
- if (p_globalFunctionTypeTable == NULL)
- {
- // printf ("In SgNode::get_globalFunctionTypeTable(): p_globalFunctionTypeTable == NULL (allocating the global function type symbol table) \n");
- p_globalFunctionTypeTable = new SgFunctionTypeTable();
- ROSE_ASSERT(p_globalFunctionTypeTable != NULL);
- // p_globalFunctionTypeTable->set_parent(???);
- }
- ROSE_ASSERT(p_globalFunctionTypeTable != NULL);
- return p_globalFunctionTypeTable;
- }
- void
- SgNode::set_globalFunctionTypeTable ( SgFunctionTypeTable* globalFunctionTypeTable )
- {
- p_globalFunctionTypeTable = globalFunctionTypeTable;
- }
- // DQ (3/17/2007): return reference to the global mangled name map (the use
- // of this map is a performance optimization).
- std::map<SgNode*,std::string> &
- SgNode::get_globalMangledNameMap()
- {
- return p_globalMangledNameMap;
- }
- #if 0
- std::map<SgNode*,std::string> &
- SgNode:: get_mangledNameCache()
- {
- return p_mangledNameCache;
- }
- #endif
- std::map<std::string, int> &
- SgNode:: get_shortMangledNameCache()
- {
- return p_shortMangledNameCache;
- }
- // DQ (3/17/2007): return reference to the global mangled name map (the use
- // of this map is a performance optimization).
- void
- SgNode::clearGlobalMangledNameMap()
- {
- // Remove all elements from the globalMangledNameMap
- // p_globalMangledNameMap.erase(p_globalMangledNameMap.begin(),p_globalMangledNameMap.end());
- p_globalMangledNameMap.clear();
- // DQ (6/26/2007): The function types require the same mangled names be generated across
- // clears of the p_globalMangledNameMap cache. Clearing the short name map breaks this.
- // It might be that we don't want to clear the short name map to permit the same mangled
- // names to be regenerated. However, for the purposes of AST merge this is not a problem.
- // p_shortMangledNameCache.clear();
- }
- #if 0
- // DQ (3/12/2007): Not clear how to do this!
- SgName
- SgNode::lookupMangledName(const SgNode* node) const
- {
- string returnString;
- // DQ (3/12/2007): Experiment with mangled name map (caching for performance improvement)
- const SgName name = "__global__";
- SgGlobal* global = const_cast<SgGlobal*>(this);
- std::map<SgNode*,std::string>::iterator i = p_globalMangledNameMap.find(global);
- if (i != p_globalMangledNameMap.end())
- {
- return i->second.c_str();
- }
- else
- {
- p_globalMangledNameMap[global] = name;
- return name;
- }
- return SgName(returnString);
- }
- #endif
- // DQ (4/10/2006): These are the default virtual function definitions (each returns an error)
- void
- SgNode::addNewAttribute( std::string s, AstAttribute* a )
- {
- printf ("Error: calling SgNode::addNewAttribute(%s) \n",s.c_str());
- ROSE_ASSERT(false);
- }
- void
- SgNode::setAttribute( std::string s, AstAttribute* a )
- {
- printf ("Error: calling SgNode::setAttribute(%s) \n",s.c_str());
- ROSE_ASSERT(false);
- }
- AstAttribute*
- SgNode::getAttribute(std::string s) const
- {
- printf ("Error: calling SgNode::getAttribute(%s) \n",s.c_str());
- ROSE_ASSERT(false);
- return NULL;
- }
- void
- SgNode::updateAttribute( std::string s, AstAttribute* a )
- {
- // formerly called: replace
- printf ("Error: calling SgNode::updateAttribute(%s) \n",s.c_str());
- ROSE_ASSERT(false);
- }
- void
- SgNode::removeAttribute(std::string s)
- {
- printf ("Error: calling SgNode::removeAttribute(%s) \n",s.c_str());
- ROSE_ASSERT(false);
- }
- bool
- SgNode::attributeExists(std::string s) const
- {
- printf ("Error: calling SgNode::attributeExists(%s) \n",s.c_str());
- ROSE_ASSERT(false);
- }
- int
- SgNode::numberOfAttributes() const
- {
- int returnValue = 0;
- return returnValue;
- }
- AstAttributeMechanism*
- SgNode::get_attributeMechanism() const
- {
- // DQ (4/10/2006): virtual function defined at the SgNode and redefined whereever there is
- // an AstAttributeMechanism defined! Note that there is no set function defined.
- return NULL;
- }
- void
- SgNode::set_attributeMechanism(AstAttributeMechanism* a)
- {
- // Nothing to do here, but we need this virtual function so that the correct access
- // function will be call on IR nodes where the AstAttributeMechanism is defined as
- // a data member.
- printf ("Error: SgNode::set_attributeMechanism(AstAttributeMechanism* a) has been called \n");
- ROSE_ASSERT(false);
- }
- #if 0
- void
- SgNode::print( std::ostream* os, /* 0 uses the default */
- int maxdepth) /* controlling function*/
- {
- Sg_print_info().reset(os, maxdepth);
- this->_print(0);
- }
- bool
- SgNode::_print(int depth) const
- {
- return Sg_print_info().output_class(this,sage_class_name(), depth + 1);
- }
- #endif
- #if 0
- //! implementation in base class - overridden by SgLocatedNode::directives(ostream&)
- void
- SgNode::directives(std::ostream& os)
- {
- // to be overridden by SgLocatedNode::directives(ostream&)
- }
- #endif
- #if 0
- void
- SgNode::unparse(SgUnparse_Info& info, std::ostream& os)
- {
- /* nothing to be done in general: only comments for statements*/
- directives(os);
- logical_unparse(info,os);
- }
- void
- SgNode::unparse_helper(SgUnparse_Info& info, std::ostream& os)
- {
- }
- void
- SgNode::logical_unparse(SgUnparse_Info& info, std::ostream& os)
- {
- }
- #endif
- void
- SgNode::post_construction_initialization()
- {
- // default implementation does nothing!
- }
- // DQ (7/23/2005): Let these be automatically generated by ROSETTA!
- // See note above where these are proptotyped, they have to be defined
- // explicitly to avoid endless recursion!
- void
- SgNode::set_isModified ( bool isModified)
- {
- p_isModified = isModified;
- }
-
- bool
- SgNode::get_isModified () const
- {
- return p_isModified;
- }
-
- bool
- SgNode::get_isVisited () const
- {
- // The p_isVisited flag has been removed, it is an error to call this function.
- assert (this != NULL);
- printf ("Error: The p_isVisited flag has been removed, it is an error to call this function (get_isVisited). \n");
- ROSE_ASSERT(false);
- return true;
- }
- void
- SgNode::set_isVisited ( bool isVisited )
- {
- // The p_isVisited flag has been removed, it is an error to call this function.
- assert (this != NULL);
- printf ("Error: The p_isVisited flag has been removed, it is an error to call this function (set_isVisited). \n");
- ROSE_ASSERT(false);
- set_isModified(true);
- // p_isVisited = isVisited;
- /* */
- }
- // ! Permits specification of parent node (connects the AST tree)
- /* ! This function is called internally to connect the elements of the grammar to form the AST.
- */
- void
- SgNode::set_parent ( SgNode* parent )
- {
- // ROSE_ASSERT (parent != NULL); // QY: should allow setting parent to NULL when detaching SgNodes
- // DQ (9/24/2004): Enforce this simple rule!
- ROSE_ASSERT(this != NULL);
- ROSE_ASSERT(this != parent);
- // printf ("In SgNode::set_parent(): Setting parent of %p = %s to %p = %s \n",this,class_name().c_str(),parent,parent->class_name().c_str());
- p_parent = parent;
- // ROSE_ASSERT( ( this != (SgNode*)(0xb484411c) ) || ( parent != (SgNode*)(0xb46fe008) ) );
- // I think this should be always be true, so let's inforce it (this happends for test2005_64.C)
- if ( ( variantT() == V_SgClassDeclaration ) && ( parent->variantT() == V_SgFunctionParameterList ) )
- {
- printf ("Warning: Found case in set_parent() where this is a SgClassDeclaration and parent is a SgFunctionParameterList \n");
- // get_file_info()->display("Warning: Found case in set_parent() where this is a SgClassDeclaration and parent is a SgFunctionParameterList");
- }
- // ROSE_ASSERT( ( variantT() != V_SgClassDeclaration ) || ( parent->variantT() != V_SgFunctionParameterList ) );
- // We should not be setting the parent on SgType IR nodes
- ROSE_ASSERT( isSgType(this) == NULL );
- }
- /*! \brief Set the parent node.
- This function is called internally to connect the elements of the grammar to form the
- AST. This is the backward reference up the tree.
- \internal We can't have ROSETTA build these access functions since we want specific
- checking of values for NULL pointers (parent point is NULL only for SgProject)
- */
- SgNode*
- SgNode::get_parent () const
- {
- ROSE_ASSERT(this != NULL);
- SgNode* returnNode = p_parent;
- // DQ (5/24/2006): I would like to allow SgSymbols to have a valid parent pointer since it can be used to reference
- // the symbol table as a way to support better debugging within the AST merge mechanims.
- // Sage II semantics: Types and Symbols always have a NULL parent (This is the way it is implemented (from Sage II))
- // if ( (isSgType( const_cast<SgNode*>(this) ) != NULL) || (isSgSymbol( const_cast<SgNode*>(this) ) != NULL) )
- if ( isSgType( const_cast<SgNode*>(this) ) != NULL )
- returnNode = NULL;
- return returnNode;
- }
- // DQ (3/8/2007): Added more efficent implementation to support AST consitency tests and other work.
- //! Query function for if the input IR nodes is a child of the current IR node.
- bool
- SgNode::isChild ( SgNode* node ) const
- {
- return (getChildIndex(node) != -1);
- }
- vector<string>
- SgNode::buildCommandLineToSubstituteTransformationFile( const vector<string>& argv, std::string newFileName )
- {
- int fileNameCounter = 0;
- int fileNameLocation = 0;
- // return a copy of the commandline input to this function
- vector<string> transformation_argv(argv.size());
- // printf ("In buildCommandLineToSubstituteTransformationFile(): argc = %d \n",argc);
- // copy all the entries in the command line.
- for (unsigned int i=0; i < argv.size(); i++)
- {
- // Count up the number of filenames (if it is ZERO then this is likely a link line called
- // using the compiler (required for template processing in C++ with most compilers) if there
- // is ONE then this is the source file. Currently their can only be ONE source file specified.
- // most options appear as -<option>
- // have to process +w2 (warnings option) on some compilers so include +<option>
- if ( argv[i].size() < 1 || (argv[i][0] != '-') || (argv[i][0] != '+') )
- {
- unsigned int length = argv[i].size();
- // printf ("Look for file names: argv[%d] = %s length = %d \n",i,argv[i],length);
- // look only for .c and .C files (source code files)
- // The length has to be greater then 2 or else we will generate a purify error!
- if ( (length > 2) && (argv[i][length-2] == '.') && ( (argv[i][length-1] == 'c') || (argv[i][length-1] == 'C') ) )
- {
- // printf ("Found a filename = %s \n",argv[i]);
- // ROSE::sourceFileNamesWithPath [fileNameCounter] = strdup(argv[i]);
- // ROSE::sourceFileNamesWithoutPath [fileNameCounter] = strdup(argv[i]);
- // argv[i] = "rose_transformation.C";
- // transformation_argv[i] = "rose_transformation.C";
- transformation_argv[i] = strdup(newFileName.c_str());
- // record the location of the filename in the command line and the number of filenames
- fileNameLocation = i;
- fileNameCounter++;
- }
- else
- {
- transformation_argv [i] = argv[i];
- }
- }
- else
- {
- transformation_argv [i] = argv[i];
- }
- // printf ("In loop: i = %d \n",i);
- }
- // For now ets only debug the case of a single file specified on the command line
- ROSE_ASSERT (fileNameCounter == 1);
- ROSE_ASSERT (fileNameLocation > 0);
- // We have found the location of the filename in the command line (now modify it)
- // now delete the original file name
- // delete argv[fileNameLocation];
- // argv[fileNameLocation] = "rose_transformation.C";
- // argv[fileNameLocation] = "/home/dquinlan/ROSE/NEW_ROSE/TransformationSpecification/rose_transformation.C";
- // argv[fileNameLocation] = "/home/dquinlan2/ROSE/SUN_CC_NOPURIFY/TransformationSpecification/rose_transformation.C";
- // argv[fileNameLocation] = "rose_transformation.C";
- #if 0
- // This is not longer required (EDG sets its
- // primary_source_file_name internally from the
- // command line directly).
- // Since it is a problem to call EDG more than once with
- // (EDG comand line processing can only be called once)
- // the easiest thing to do is change the name of the primary
- // source file. See notes in the TODO document.
- EDG_secondarySourceFile = argv[fileNameLocation];
- #endif
- // printf ("Command line modified to include \"rose_transformation.C\"! \n");
- return transformation_argv;
- }
- std::string
- SgNode::unparseToString(SgUnparse_Info* info) const
- {
- // DQ (4/4/2006): Added optional parameter to customize unparsing
- // Generate the string (don't pass a SgUnparse_Info object so that we can use the
- // default settings).
- std::string outputString = globalUnparseToString(this,info);
- return outputString;
- }
- std::string
- SgNode::unparseToCompleteString()
- {
- // Generate the string (pass a SgUnparse_Info object)
- SgUnparse_Info* inputUnparseInfoPointer = new SgUnparse_Info();
- inputUnparseInfoPointer->unset_SkipComments(); // generate comments
- inputUnparseInfoPointer->unset_SkipWhitespaces(); // generate all whitespaces to format the code
- std::string outputString = globalUnparseToString(this,inputUnparseInfoPointer);
- return outputString;
- }
- // DQ (10/8/2007): I would like to get rid of this mechanism in the future.
- SgShallowCopy *SgShallowCopy::p_static_instance = NULL;
- SgTreeCopy *SgTreeCopy ::p_static_instance = NULL;
- void
- SgCopyHelp::insertCopiedNodePair( const SgNode* key, SgNode* value )
- {
- // DQ (10/8/2007): This function support the saving of state used to associated original IR nodes with the copies made of them so that symbols can be updated.
- if (copiedNodeMap.find(key) == copiedNodeMap.end())
- {
- // Add the node to the map...
- copiedNodeMap[key] = value;
- }
- }
- SgNode*
- SgTreeCopy::copyAst( const SgNode *n )
- {
- #if 0
- if (isSgType( const_cast<SgNode*>(n) ) != NULL)
- {
- return const_cast<SgNode *>(n);
- }
- SgNode *nCopy = n->copy(*this);
- nCopy->set_parent(NULL);
- return nCopy;
- #else
- // DQ (10/8/2007): I have modified this function to have a single return.
- // This function is called by the copy mechanism to copy AST child trees.
- SgNode *nCopy = NULL;
- // If this is a SgType, then force it to be shared, since all SgTypes are shared.
- // if (isSgType( const_cast<SgNode*>(n) ) != NULL)
- if (isSgType(n) != NULL)
- {
- // Share the reference to the IR node.
- nCopy = const_cast<SgNode *>(n);
- }
- else
- {
- // If this is a class definition then only do a deep copy if it is from a defining class declaration.
- const SgClassDefinition* classDefinition = isSgClassDefinition(n);
- if (classDefinition != NULL)
- {
- ROSE_ASSERT(classDefinition->get_parent() != NULL);
- SgClassDeclaration* classDeclaration = isSgClassDeclaration(classDefinition->get_parent());
- if (classDeclaration == classDeclaration->get_definingDeclaration())
- {
- // Do a deep copy on this IR node.
- nCopy = n->copy(*this);
- }
- else
- {
- // Share the reference to the IR node.
- nCopy = const_cast<SgNode *>(n);
- }
- }
- else
- {
- // Do a deep copy on this IR node.
- nCopy = n->copy(*this);
- }
- // Set the parent to NULL, the copy mechanism we set it correctly ...
- nCopy->set_parent(NULL);
- }
- return nCopy;
- #endif
- }
- #if 0
- bool SgTreeCopy :: clone_node( const SgNode *n ) const
- {
- if (isSgType( const_cast<SgNode*>(n) ) != 0)
- return false;
- return true;
- }
- #endif
- unsigned int
- SgNode::cfgIndexForEnd() const {
- ROSE_ASSERT (!"CFG functions only work on SgExpression, SgStatement, and SgInitializedName");
- return 0;
- }
- bool
- SgNode::cfgIsIndexInteresting(unsigned int) const {
- ROSE_ASSERT (!"CFG functions only work on SgExpression, SgStatement, and SgInitializedName");
- return false;
- }
- unsigned int
- SgNode::cfgFindChildIndex(SgNode*) {
- ROSE_ASSERT (!"CFG functions only work on SgExpression, SgStatement, and SgInitializedName");
- return 0;
- }
- unsigned int
- SgNode::cfgFindNextChildIndex(SgNode*) {
- ROSE_ASSERT (!"CFG functions only work on SgExpression, SgStatement, and SgInitializedName");
- return 0;
- }
- std::vector<VirtualCFG::CFGEdge>
- SgNode::cfgOutEdges(unsigned int) {
- ROSE_ASSERT (!"CFG functions only work on SgExpression, SgStatement, and SgInitializedName");
- return std::vector<VirtualCFG::CFGEdge>();
- }
- std::vector<VirtualCFG::CFGEdge>
- SgNode::cfgInEdges(unsigned int) {
- ROSE_ASSERT (!"CFG functions only work on SgExpression, SgStatement, and SgInitializedName");
- return std::vector<VirtualCFG::CFGEdge>();
- }
-
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 1362 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Node.code"
- #if 0
- bool SgNode::error()
- {
- // Put error checking here
- ROSE_ASSERT (this != NULL);
- if (getVariant() != NodeTag)
- {
- printf ("Error in SgNode::error(): SgNode object has a %s variant \n",
- Cxx_GrammarTerminalNames[getVariant()].name);
- // printf ("Error in SgNode::error() \n");
- ROSE_ABORT();
- }
- // ROSE_ASSERT (getVariant() == SgNodeTag);
- ROSE_ASSERT (getVariant() == NodeTag);
- return false; // //::error();
- }
- #endif
- // End of memberFunctionString
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarVariantFunctionDefinitionMacros.macro"
- int
- SgNode::variant() const
- {
- // This function is generated from grammarVariantFunctionDefinitionMacros.macro
- #ifdef DEBUG
- // printf ("In SgNode::variant() const \n");
- #endif
- assert(this != NULL);
- return NodeTag;
- }
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarIsClassNameFunctionDefinitionMacros.macro"
- SgNode* isSgNode ( SgNode* inputDerivedClassPointer )
- {
- return dynamic_cast<SgNode*>(inputDerivedClassPointer);
- }
- // DQ (11/8/2003): Added version of functions taking const pointer
- const SgNode* isSgNode ( const SgNode* inputDerivedClassPointer )
- {
- return dynamic_cast<const SgNode*>(inputDerivedClassPointer);
- }
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarDestructorDefinitionMacros.macro"
- /**
- \brief Generated destructor
- This destructor is automatically generated (by ROSETTA). This destructor
- only frees memory of data members associated with the parts of the current IR node which
- are NOT traversed. Those data members that are part of a traversal can be freed using
- a traversal (calling this destructor on all children in a post-order traversal). Such
- a traversal which deletes a whole AST is provided by DeleteSgTree(SgNode*).
- \internal All IR nodes with data members specified using setDataPrototype() within ROSETTA
- are specified as NO_DELETE is also specified as DEF_TRAVERSAL. Those marked as
- NO_TRAVERSAL can be marked as NO_DELETE or DEF_DELETE.
- \note All SgSymbol IR nodes are deleted when the symbol table is deleted. Currently most
- SgType IR nodes are not deleted (since they are shared). Also, all STL lists of
- pointers are not yet implemented to call delete on eash pointer in the container.
- (This could be done by derivation from the STL containers to define containers that
- automatically deleted their members.)
- */
- SgNode::~SgNode ()
- {
- #if 0
- // debugging information!
- printf ("In SgNode::~SgNode (destructor) \n");
- #endif
- #if 1
- // DQ (6/25/2006): Commented out destructor body to allow the File I/O to work.
-
- // case: not a listType for parent
- p_parent = NULL; // non list case
- // case: not a listType for isModified
- p_isModified = false; // non list case
- #line 32 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarDestructorDefinitionMacros.macro"
- #endif
- }
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarConstructorDefinitionMacros.macro"
- // Generated constructor
- SgNode::SgNode ( )
-
- {
- #ifdef DEBUG
- // printf ("In SgNode::SgNode () sage_class_name() = %s \n",sage_class_name());
- #endif
- p_parent = NULL;
- p_isModified = false;
- p_freepointer = AST_FileIO::IS_VALID_POINTER();
- #line 11 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarConstructorDefinitionMacros.macro"
- // Test the variant virtual function
- assert(NodeTag == variant());
- post_construction_initialization();
- // Test the isSgNode() function since it has been problematic
- assert(isSgNode(this) != NULL);
- }
- #line 1 ""
- #line 1 ""
- #line 6 "../Grammar/grammarClassDefinitionMacros.macro after marker MEMBER_FUNCTION_DEFINITIONS"
- #line 7 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarClassDefinitionMacros.macro"
- // ********************************************************
- // member functions common across all array grammar objects
- // ********************************************************
- #line 1 ""
- #line 1 ""
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarClassDefinitionMacros.macro"
- // ********************************************************
- // member functions specific to each node in the grammar
- // ********************************************************
- #line 6 "../Grammar/grammarClassDefinitionMacros.macro before marker MEMBER_FUNCTION_DEFINITIONS"
- #line 1 ""
- #line 1 ""
- // Start of memberFunctionString
- #line 3893 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Support.code"
- // No functions defined for the GrammarSource
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 331 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Common.code"
- // *** COMMON CODE SECTION BEGINS HERE ***
- int
- SgSupport::getVariant() const
- {
- // This function is used in ROSE while "variant()" is used in SAGE
- assert(this != NULL);
- return variant();
- }
- // This function is used in ROSE in treeTraversal code
- // eventually replaces getVariant() and variant()
- // though after variant() has been removed for a while we will
- // want to change the name of variantT() back to variant()
- // (since the "T" was ment to stand for temporary).
- // When this happens the variantT() will be depricated.
- VariantT
- SgSupport::variantT() const {
- return V_SgSupport;
- }
- #if 0
- int
- SgSupport::variant() const
- {
- // This function is used in SAGE
- assert(this != NULL);
- return SupportTag;
- }
- #endif
- const char*
- SgSupport::sage_class_name() const
- {
- assert(this != NULL);
- return "SgSupport";
- }
- std::string
- SgSupport::class_name() const
- {
- assert(this != NULL);
- return "SgSupport";
- }
- // DQ (11/26/2005): Support for visitor pattern mechanims
- // (inferior to ROSE traversal mechanism, experimental).
- void
- SgSupport::executeVisitorMemberFunction (ROSE_VisitorPattern & visitor)
- {
- ROSE_ASSERT(this != NULL);
- visitor.visit(this);
- }
- // *** COMMON CODE SECTION ENDS HERE ***
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 1387 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Node.code"
- #if 0
- //! Error checking support
- /*! Verifies the following:
- - working getVariant() member function
- - calls base class's error() member function
- Every class has one of these functions.
- */
- bool
- SgSupport::error()
- {
- // Put error checking here
- ROSE_ASSERT (this != NULL);
- if (getVariant() != SupportTag)
- {
- printf ("Error in SgSupport::error(): SgSupport object has a %s variant \n",
- Cxx_GrammarTerminalNames[getVariant()].name);
- // printf ("Error in SgSupport::error() \n");
- ROSE_ABORT();
- }
- ROSE_ASSERT (getVariant() == SupportTag);
- return SgNode::error();
- }
- #endif
- // End of memberFunctionString
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarVariantFunctionDefinitionMacros.macro"
- int
- SgSupport::variant() const
- {
- // This function is generated from grammarVariantFunctionDefinitionMacros.macro
- #ifdef DEBUG
- // printf ("In SgSupport::variant() const \n");
- #endif
- assert(this != NULL);
- return SupportTag;
- }
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarIsClassNameFunctionDefinitionMacros.macro"
- SgSupport* isSgSupport ( SgNode* inputDerivedClassPointer )
- {
- return dynamic_cast<SgSupport*>(inputDerivedClassPointer);
- }
- // DQ (11/8/2003): Added version of functions taking const pointer
- const SgSupport* isSgSupport ( const SgNode* inputDerivedClassPointer )
- {
- return dynamic_cast<const SgSupport*>(inputDerivedClassPointer);
- }
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarDestructorDefinitionMacros.macro"
- /**
- \brief Generated destructor
- This destructor is automatically generated (by ROSETTA). This destructor
- only frees memory of data members associated with the parts of the current IR node which
- are NOT traversed. Those data members that are part of a traversal can be freed using
- a traversal (calling this destructor on all children in a post-order traversal). Such
- a traversal which deletes a whole AST is provided by DeleteSgTree(SgNode*).
- \internal All IR nodes with data members specified using setDataPrototype() within ROSETTA
- are specified as NO_DELETE is also specified as DEF_TRAVERSAL. Those marked as
- NO_TRAVERSAL can be marked as NO_DELETE or DEF_DELETE.
- \note All SgSymbol IR nodes are deleted when the symbol table is deleted. Currently most
- SgType IR nodes are not deleted (since they are shared). Also, all STL lists of
- pointers are not yet implemented to call delete on eash pointer in the container.
- (This could be done by derivation from the STL containers to define containers that
- automatically deleted their members.)
- */
- SgSupport::~SgSupport ()
- {
- #if 0
- // debugging information!
- printf ("In SgSupport::~SgSupport (destructor) \n");
- #endif
- #if 1
- // DQ (6/25/2006): Commented out destructor body to allow the File I/O to work.
-
- #line 32 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarDestructorDefinitionMacros.macro"
- #endif
- }
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarConstructorDefinitionMacros.macro"
- // Generated constructor
- SgSupport::SgSupport ( )
- : SgNode()
- {
- #ifdef DEBUG
- // printf ("In SgSupport::SgSupport () sage_class_name() = %s \n",sage_class_name());
- #endif
- // Test the variant virtual function
- assert(SupportTag == variant());
- post_construction_initialization();
- // Test the isSgSupport() function since it has been problematic
- assert(isSgSupport(this) != NULL);
- }
- #line 1 ""
- #line 1 ""
- #line 6 "../Grammar/grammarClassDefinitionMacros.macro after marker MEMBER_FUNCTION_DEFINITIONS"
- #line 7 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarClassDefinitionMacros.macro"
- // ********************************************************
- // member functions common across all array grammar objects
- // ********************************************************
- #line 1 ""
- #line 1 ""
- #line 1 ""
- #line 1 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/grammarClassDefinitionMacros.macro"
- // ********************************************************
- // member functions specific to each node in the grammar
- // ********************************************************
- #line 6 "../Grammar/grammarClassDefinitionMacros.macro before marker MEMBER_FUNCTION_DEFINITIONS"
- #line 1 ""
- #line 1 ""
- // Start of memberFunctionString
- // End of memberFunctionString
- // Start of memberFunctionString
- #line 7362 "/home/dquinlan/ROSE/NEW_ROSE/src/ROSETTA/Grammar/Support.code"
- // Added to support assignments to string variables.
- SgName::operator std::string () const
- {
- return p_char;
- }
- // DQ (10/5/2007): We no longer need this!
- // Definition of defaultName (use a default parameter)
- // const SgName SgdefaultName("defaultName");
- SgName::SgName()
- : p_char("")
- { }
- unsigned int
- SgName::get_length() const
- {
- ROSE_ASSERT(this != NULL);
- return p_char.size();
- }
- SgName::SgName(const char * str): p…
Large files files are truncated, but you can click here to view the full file