Exemplo n.º 1
0
void
WalrusGraph::generateWalrusGraph( SgNode* node, string outputFilename )
   {
// Notes: The generated file in the Walrus format typically requies some editing by hand.
// For large files the "comma" always has to be remove at the end of the edge list and the node list.
// For Binary files the first edge which points to itself ("source=0 distination=0") has to be removed.
// Then the last entry for the node list has to be removed.
// Then is can often work.


     SgProject* project = isSgProject(node);
     if (project != NULL)
        {
          printf ("Found the SgProject \n");

          SgFile* fileNode = project->get_fileList()[0];
          if (isSgBinaryComposite(fileNode) != NULL)
             {
               if (project->get_binary_only() == false)
                    printf ("This should have been set already, what is wrong here! \n");

               project->set_binary_only(true);
             }

          if (project->get_binary_only() == true)
             {
               printf ("Found a binary file \n");
               WalrusGraph::isBinary = true;
             }
        }

     Counter traversal;
     traversal.traverse(node,preorder);

     printf ("node_to_index_map.size() = %zu \n",node_to_index_map.size());

     filebuf fb;
     fb.open (outputFilename.c_str(),ios::out);
     ostream os(&fb);

     ostream outputFile(&fb);
     outputFilePtr = &outputFile;
     ROSE_ASSERT(outputFilePtr != NULL);

     generateEdges(node);
     generateNodes(node);

     outputFile.flush();
   }
Exemplo n.º 2
0
void postProcessingSupport (SgNode* node)
{
    // DQ (5/24/2006): Added this test to figue out where Symbol parent pointers are being reset to NULL
    // TestParentPointersOfSymbols::test();

    // DQ (7/25/2005): It is presently an error to call this function with a SgProject
    // or SgDirectory, since there is no way to compute the SgFile from such IR nodes
    // (could be multiply defined).
    // ROSE_ASSERT(isSgProject(node) == NULL && isSgDirectory(node) == NULL);
    // GB (8/19/2009): Removed the assertion against calling this function on
    // SgProject and SgDirectory nodes. Nothing below needs to compute a
    // SgFile, as far as I can tell; also, calling the AstPostProcessing just
    // once on an entire project is more efficient than calling it once per
    // file.

    // JJW (12/5/2008): Turn off C and C++ postprocessing steps when the new EDG
    // interface is being used (it should produce correct, complete ASTs on its
    // own and do its own fixups)
#ifdef ROSE_USE_NEW_EDG_INTERFACE

    // Only do AST post-processing for C/C++
    bool doPostprocessing = (SageInterface::is_Fortran_language() == true) ||
                            (SageInterface::is_PHP_language() == true) ||
                            (SageInterface::is_Python_language() == true);

    // If this is C or C++ then we are using the new EDG translation and althrough fewer
    // fixups should be required, some are still required.
    if (doPostprocessing == false)
    {
#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
        printf ("Postprocessing AST build using new EDG/Sage Translation Interface. \n");
#endif
#if 0
        // DQ (4/26/2013): Debugging code.
        printf ("In postProcessingSupport: Test 1: Calling postProcessingTestFunctionCallArguments() \n");
        postProcessingTestFunctionCallArguments(node);
#endif
#ifndef ROSE_USE_CLANG_FRONTEND
        // DQ (10/31/2012): Added fixup for EDG bug which drops variable declarations of some source sequence lists.
        fixupEdgBugDuplicateVariablesInAST();
#endif

        // DQ (5/1/2012): After EDG/ROSE translation, there should be no IR nodes marked as transformations.
        // Liao 11/21/2012. AstPostProcessing() is called within both Frontend and Midend
        // so we have to detect the mode first before asserting no transformation generated file info objects
        if (SageBuilder::SourcePositionClassificationMode != SageBuilder::e_sourcePositionTransformation)
            detectTransformations(node);

        // DQ (8/12/2012): reset all of the type references (to intermediately generated types).
        fixupTypeReferences();

        // Reset and test and parent pointers so that it matches our definition
        // of the AST (as defined by the AST traversal mechanism).
        topLevelResetParentPointer(node);

        // DQ (8/23/2012): Modified to take a SgNode so that we could compute the global scope for use in setting
        // parents of template instantiations that have not be placed into the AST but exist in the memory pool.
        // Another 2nd step to make sure that parents of even IR nodes not traversed can be set properly.
        // resetParentPointersInMemoryPool();
        resetParentPointersInMemoryPool(node);

        // DQ (6/27/2005): fixup the defining and non-defining declarations referenced at each SgDeclarationStatement
        // This is a more sophisticated fixup than that done by fixupDeclarations. See test2009_09.C for an example
        // of a non-defining declaration appearing before a defining declaration and requiring a fixup of the
        // non-defining declaration reference to the defining declaration.
        fixupAstDefiningAndNondefiningDeclarations(node);

        // DQ (6/11/2013): This corrects where EDG can set the scope of a friend declaration to be different from the defining declaration.
        // We need it to be a rule in ROSE that the scope of the declarations are consistant between defining and all non-defining declaration).
        fixupAstDeclarationScope(node);

        // Fixup the symbol tables (in each scope) and the global function type
        // symbol table. This is less important for C, but required for C++.
        // But since the new EDG interface has to handle C and C++ we don't
        // setup the global function type table there to be uniform.
        fixupAstSymbolTables(node);

        // DQ (4/14/2010): Added support for symbol aliases for C++
        // This is the support for C++ "using declarations" which uses symbol aliases in the symbol table to provide
        // correct visability of symbols included from alternative scopes (e.g. namespaces).
        fixupAstSymbolTablesToSupportAliasedSymbols(node);

        // DQ (2/12/2012): Added support for this, since AST_consistancy expects get_nameResetFromMangledForm() == true.
        resetTemplateNames(node);

        // **********************************************************************
        // DQ (4/29/2012): Added some of the template fixup support for EDG 4.3 work.
        // DQ (6/21/2005): This function now only marks the subtrees of all appropriate declarations as compiler generated.
        // DQ (5/27/2005): mark all template instantiations (which we generate as template specializations) as compiler generated.
        // This is required to make them pass the unparser and the phase where comments are attached.  Some fixup of filenames
        // and line numbers might also be required.
        fixupTemplateInstantiations(node);

#if 0
        // DQ (4/26/2013): Debugging code.
        printf ("In postProcessingSupport: Test 2: Calling postProcessingTestFunctionCallArguments() \n");
        postProcessingTestFunctionCallArguments(node);
#endif

        // DQ (8/19/2005): Mark any template specialization (C++ specializations are template instantiations
        // that are explicit in the source code).  Such template specializations are marked for output only
        // if they are present in the source file.  This detail could effect handling of header files later on.
        // Have this phase preceed the markTemplateInstantiationsForOutput() since all specializations should
        // be searched for uses of (references to) instantiated template functions and member functions.
        markTemplateSpecializationsForOutput(node);

        // DQ (6/21/2005): This function marks template declarations for output by the unparser (it is part of a
        // fixed point iteration over the AST to force find all templates that are required (EDG at the moment
        // outputs only though template functions that are required, but this function solves the more general
        // problem of instantiation of both function and member function templates (and static data, later)).
        markTemplateInstantiationsForOutput(node);

        // DQ (10/21/2007): Friend template functions were previously not properly marked which caused their generated template
        // symbols to be added to the wrong symbol tables.  This is a cause of numerous symbol table problems.
        fixupFriendTemplateDeclarations();
        // DQ (4/29/2012): End of new template fixup support for EDG 4.3 work.
        // **********************************************************************

        // DQ (5/14/2012): Fixup source code position information for the end of functions to match the largest values in their subtree.
        // DQ (10/27/2007): Setup any endOfConstruct Sg_File_Info objects (report on where they occur)
        fixupSourcePositionConstructs();

#if 0
        // DQ (4/26/2013): Debugging code.
        printf ("In postProcessingSupport: Test 3: Calling postProcessingTestFunctionCallArguments() \n");
        postProcessingTestFunctionCallArguments(node);
#endif

        // DQ (2/12/2012): This is a problem for test2004_35.C (debugging this issue).
        // printf ("Exiting after calling resetTemplateNames() \n");
        // ROSE_ASSERT(false);

        // DQ (10/4/2012): Added this pass to support command line option to control use of constant folding
        // (fixes bug pointed out by Liao).
        // DQ (9/14/2011): Process the AST to remove constant folded values held in the expression trees.
        // This step defines a consistent AST more suitable for analysis since only the constant folded
        // values will be visited.  However, the default should be to save the original expression trees
        // and remove the constant folded values since this represents the original code.
#if 1
        resetConstantFoldedValues(node);
#else
        // DQ (10/11/2012): This is helpful to allow us to see both expression trees in the AST for debugging.
        printf ("Skipping AST Postprocessing resetConstantFoldedValues() \n");
#endif

#if 0
        // DQ (4/26/2013): Debugging code.
        printf ("In postProcessingSupport: Test 4: Calling postProcessingTestFunctionCallArguments() \n");
        postProcessingTestFunctionCallArguments(node);
#endif

        // DQ (10/5/2012): Fixup known macros that might expand into a recursive mess in the unparsed code.
        fixupSelfReferentialMacrosInAST(node);

        // Make sure that frontend-specific and compiler-generated AST nodes are marked as such. These two must run in this
        // order since checkIsCompilerGenerated depends on correct values of compiler-generated flags.
        checkIsFrontendSpecificFlag(node);
        checkIsCompilerGeneratedFlag(node);

        // This resets the isModified flag on each IR node so that we can record
        // where transformations are done in the AST.  If any transformations on
        // the AST are done, even just building it, this step should be the final
        // step.
        checkIsModifiedFlag(node);

        // DQ (5/2/2012): After EDG/ROSE translation, there should be no IR nodes marked as transformations.
        // Liao 11/21/2012. AstPostProcessing() is called within both Frontend and Midend
        // so we have to detect the mode first before asserting no transformation generated file info objects
        if (SageBuilder::SourcePositionClassificationMode !=SageBuilder::e_sourcePositionTransformation)
            detectTransformations(node);

#if 0
        // DQ (4/26/2013): Debugging code.
        printf ("In postProcessingSupport: Test 10: Calling postProcessingTestFunctionCallArguments() \n");
        postProcessingTestFunctionCallArguments(node);
#endif

        // DQ (4/24/2013): Detect the correct function declaration to declare the use of default arguments.
        // This can only be a single function and it can't be any function (this is a moderately complex issue).
        fixupFunctionDefaultArguments(node);

        // DQ (12/20/2012): We now store the logical and physical source position information.
        // Although they are frequently the same, the use of #line directives causes them to be different.
        // This is part of debugging the physical source position information which is used in the weaving
        // of the comments and CPP directives into the AST.  For this the consistancy check is more helpful
        // if done befor it is used (here), instead of after the comment and CPP directive insertion in the
        // AST Consistancy tests.
        checkPhysicalSourcePosition(node);

#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
        printf ("DONE: Postprocessing AST build using new EDG/Sage Translation Interface. \n");
#endif
        return;
    }
#endif // ROSE_USE_NEW_EDG_INTERFACE -- do postprocessing unconditionally when the old EDG interface is used

    // DQ (7/7/2005): Introduce tracking of performance of ROSE.
    // TimingPerformance timer ("AST Fixup: time (sec) = ");

    if ( SgProject::get_verbose() >= AST_POST_PROCESSING_VERBOSE_LEVEL )
        cout << "/* AST Postprocessing started. */" << endl;

    ROSE_ASSERT(node != NULL);

    // DQ (7/19/2005): Moved to after parent pointer fixup!
    // subTemporaryAstFixes(node);

    // DQ (3/11/2006): Fixup NULL pointers left by users when building the AST
    // (note that the AST translation fixes these directly).  This step is
    // provided as a way to make the AST build by users consistant with what
    // is built elsewhere within ROSE.
    fixupNullPointersInAST(node);

    // DQ (8/9/2005): Some function definitions in Boost are build without
    // a body (example in test2005_102.C, but it appears to work fine).
    fixupFunctionDefinitions(node);

    // DQ (8/10/2005): correct any template declarations mistakenly marked as compiler-generated
    fixupTemplateDeclarations(node);

    // Output progress comments for these relatively expensive operations on the AST
    if ( SgProject::get_verbose() >= AST_POST_PROCESSING_VERBOSE_LEVEL )
        cout << "/* AST Postprocessing reset parent pointers */" << endl;

    topLevelResetParentPointer (node);

    // DQ (6/10/2007): This is called later, but call it now to reset the parents in SgTemplateInstantiationDecl
    // This is required (I think) so that resetTemplateNames() can compute template argument name qualification correctly.
    // See test2005_28.C for where this is required.
    // resetParentPointersInMemoryPool();
    resetParentPointersInMemoryPool(node);

    // Output progress comments for these relatively expensive operations on the AST
    if ( SgProject::get_verbose() >= AST_POST_PROCESSING_VERBOSE_LEVEL )
        cout << "/* AST Postprocessing reset parent pointers (done) */" << endl;

    // DQ (7/19/2005): Moved to after parent pointer fixup!
    // subTemporaryAstFixes(node);
    removeInitializedNamePtr(node);

    // DQ (3/17/2007): This should be empty
    ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (12/1/2004): This should be done before the reset of template names (since that operation requires valid scopes!)
    // DQ (11/29/2004): Added to support new explicit scope information on IR nodes
    // initializeExplicitScopeData(node);
    initializeExplicitScopes(node);

    // DQ (5/28/2006): Fixup names in declarations that are inconsistent (e.g. where more than one non-defining declaration exists)
    resetNamesInAST();

    // DQ (3/17/2007): This should be empty
    ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // Output progress comments for these relatively expensive operations on the AST
    if ( SgProject::get_verbose() >= AST_POST_PROCESSING_VERBOSE_LEVEL )
        cout << "/* AST Postprocessing reset template names */" << endl;

#if 0
    // DQ (5/15/2011): I don't feel comfortable with this being called before the AST is finied being post processed.
    // This used to be called in the unparser, but that is after resetTemplateNames() below and that is a problem
    // because template names have already been generated.
    void newBuildHiddenTypeAndDeclarationLists( SgNode* node );
    printf ("Developing a new implementation of the name qualification support. \n");
    newBuildHiddenTypeAndDeclarationLists(node);
    printf ("DONE: new name qualification support built. \n");

    printf ("Calling SgNode::clearGlobalMangledNameMap() \n");
    SgNode::clearGlobalMangledNameMap();
#endif

    // DQ (5/15/2011): This causes template names to be computed as strings and and without name qualification
    // if we don't call the name qualification before here. Or we reset the template names after we do the
    // analysis to support the name qualification.
    // reset the names of template class declarations
    resetTemplateNames(node);

    // DQ (2/12/2012): This is a problem for test2004_35.C (debugging this issue).
    // printf ("Exiting after calling resetTemplateNames() \n");
    // ROSE_ASSERT(false);

    // DQ (3/17/2007): This should be empty
    ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // Output progress comments for these relatively expensive operations on the AST
    if ( SgProject::get_verbose() >= AST_POST_PROCESSING_VERBOSE_LEVEL )
        cout << "/* AST Postprocessing reset template names (done) */" << endl;

    // DQ (6/26/2007): Enum values used before they are defined in a class can have NULL declaration pointers.  This
    // fixup handles this case and traverses just the SgEnumVal objects.
    fixupEnumValues();

    // DQ (4/7/2010): This was commented out to modify Fortran code, but I think it should NOT modify Fortran code.
    // DQ (5/21/2008): This only make since for C and C++ (Error, this DOES apply to Fortran where the "parameter" attribute is used!)
    if (SageInterface::is_Fortran_language() == false && SageInterface::is_Java_language() == false)
    {
        // DQ (3/20/2005): Fixup AST so that GNU g++ compile-able code will be generated
        fixupInClassDataInitialization(node);
    }

    // DQ (3/24/2005): Fixup AST to generate code that works around GNU g++ bugs
    fixupforGnuBackendCompiler(node);

    // DQ (4/19/2005): fixup all definingDeclaration and NondefiningDeclaration pointers in SgDeclarationStatement IR nodes
    // fixupDeclarations(node);

    // DQ (5/20/2005): make the non-defining (forward) declarations added by EDG for static template
    // specializations added under the "--instantiation local" option match the defining declarations.
    fixupStorageAccessOfForwardTemplateDeclarations(node);

#if 0
    // DQ (6/27/2005): fixup the defining and non-defining declarations referenced at each SgDeclarationStatement
    fixupAstDefiningAndNondefiningDeclarations(node);
#endif

    // DQ (6/21/2005): This function now only marks the subtrees of all appropriate declarations as compiler generated.
    // DQ (5/27/2005): mark all template instantiations (which we generate as template specializations) as compiler generated.
    // This is required to make them pass the unparser and the phase where comments are attached.  Some fixup of filenames
    // and line numbers might also be required.
    fixupTemplateInstantiations(node);

    // DQ (8/19/2005): Mark any template specialization (C++ specializations are template instantiations
    // that are explicit in the source code).  Such template specializations are marked for output only
    // if they are present in the source file.  This detail could effect handling of header files later on.
    // Have this phase preceed the markTemplateInstantiationsForOutput() since all specializations should
    // be searched for uses of (references to) instantiated template functions and member functions.
    markTemplateSpecializationsForOutput(node);

    // DQ (6/21/2005): This function marks template declarations for output by the unparser (it is part of a
    // fixed point iteration over the AST to force find all templates that are required (EDG at the moment
    // outputs only though template functions that are required, but this function solves the more general
    // problem of instantiation of both function and member function templates (and static data, later)).
    markTemplateInstantiationsForOutput(node);

    // DQ (3/17/2007): This should be empty
    ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (3/16/2006): fixup any newly added declarations (see if we can eliminate the first place where this is called, above)
    // fixup all definingDeclaration and NondefiningDeclaration pointers in SgDeclarationStatement IR nodes
    // driscoll6 (6/10/11): this traversal sets p_firstNondefiningDeclaration for defining declarations, which
    // causes justifiable failures in AstConsistencyTests. Until this is resolved, skip this test for Python.
    if (SageInterface::is_Python_language()) {
        //cerr << "warning: python. Skipping fixupDeclarations() in astPostProcessing.C" << endl;
    } else {
        fixupDeclarations(node);
    }

    // DQ (3/17/2007): This should be empty
    ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (2/12/2006): Moved to trail marking templates (as a test)
    // DQ (6/27/2005): fixup the defining and non-defining declarations referenced at each SgDeclarationStatement
    // This is a more sophisticated fixup than that done by fixupDeclarations.
    fixupAstDefiningAndNondefiningDeclarations(node);

#if 0
    ROSE_ASSERT(saved_declaration != NULL);
    printf ("saved_declaration = %p saved_declaration->get_definingDeclaration() = %p saved_declaration->get_firstNondefiningDeclaration() = %p \n",
            saved_declaration,saved_declaration->get_definingDeclaration(),saved_declaration->get_firstNondefiningDeclaration());
    ROSE_ASSERT(saved_declaration->get_definingDeclaration() != saved_declaration->get_firstNondefiningDeclaration());
#endif

    // DQ (10/21/2007): Friend template functions were previously not properly marked which caused their generated template
    // symbols to be added to the wrong symbol tables.  This is a cause of numerous symbol table problems.
    fixupFriendTemplateDeclarations();

    // DQ (3/17/2007): This should be the last point at which the globalMangledNameMap is empty
    // The fixupAstSymbolTables will generate calls to function types that will be placed into
    // the globalMangledNameMap.
    ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (6/26/2005): The global function type symbol table should be rebuilt (since the names of templates
    // used in qualified names of types have been reset (in post processing).  Other local symbol tables should
    // be initalized and constructed for any empty scopes (for consistancy, we want all scopes to have a valid
    // symbol table pointer).
    fixupAstSymbolTables(node);

    // DQ (3/17/2007): At this point the globalMangledNameMap has been used in the symbol table construction. OK.
    // ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (8/20/2005): Handle backend vendor specific template handling options
    // (e.g. g++ options: -fno-implicit-templates and -fno-implicit-inline-templates)
    processTemplateHandlingOptions(node);

    // DQ (5/22/2005): relocate compiler generated forward template instantiation declarations to appear
    // after the template declarations and before first use.
    // relocateCompilerGeneratedTemplateInstantiationDeclarationsInAST(node);

    // DQ (8/27/2005): This disables output of some template instantiations that would result in
    // "ambiguous template specialization" in g++ (version 3.3.x, 3.4.x, and 4.x).  See test2005_150.C
    // for more detail.
    markOverloadedTemplateInstantiations(node);

    // DQ (9/5/2005): Need to mark all nodes in any subtree marked as a transformation
    markTransformationsForOutput(node);

    // DQ (3/5/2006): Mark functions that are provided for backend compatability as compiler generated by ROSE
#if 1
    markBackendSpecificFunctionsAsCompilerGenerated(node);
#else
    printf ("Warning: Skipped marking of backend specific functions ... \n");
#endif

    // DQ (5/24/2006): Added this test to figure out where Symbol parent pointers are being reset to NULL
    // TestParentPointersOfSymbols::test();

    // DQ (5/24/2006): reset the remaining parents in IR nodes missed by the AST based traversals
    // resetParentPointersInMemoryPool();
    resetParentPointersInMemoryPool(node);

    // DQ (3/17/2007): This should be empty
    // ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (5/29/2006): Fixup types in declarations that are not shared (e.g. where more than one non-defining declaration exists)
    resetTypesInAST();

    // DQ (3/17/2007): This should be empty
    // ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // DQ (3/10/2007): fixup name of any template classes that have been copied incorrectly into SgInitializedName
    // list in base class constructor preinitialization lists (see test2004_156.C for an example).
    resetContructorInitilizerLists();

    // DQ (10/27/2007): Setup any endOfConstruct Sg_File_Info objects (report on where they occur)
    fixupSourcePositionConstructs();

    // DQ (1/19/2008): This can be called at nearly any point in the ast fixup.
    markLhsValues(node);

#ifndef ROSE_USE_CLANG_FRONTEND
    // DQ (2/21/2010): This normalizes an EDG trick (well documented) that replaces "__PRETTY_FUNCTION__" variable
    // references with variable given the name of the function where the "__PRETTY_FUNCTION__" variable references
    // was found. This is only seen when compiling ROSE using ROSE and was a mysterious property of ROSE for a long
    // time until it was identified.  This fixup traversal changes the name back to "__PRETTY_FUNCTION__" to make
    // the code generated using ROSE when compiling ROSE source code the same as if GNU processed it (e.g. using CPP).
    if (SageInterface::is_Java_language() == false) {
        fixupPrettyFunctionVariables(node);
    }
#endif

#if 0
    // DQ (1/22/2008): Use this for the Fortran code to get more accurate source position information.

    // DQ (4/16/2007): comment out to test how function declaration prototypes are reset or set wrong.
    // DQ (11/1/2006): fixup source code position information for AST IR nodes.
    fixupSourcePositionInformation(node);
#endif

#if 0
    // DQ (11/10/2007): Moved computation of hidden list from astPostProcessing.C to unparseFile so that
    // it will be called AFTER any transformations and immediately before code generation where it is
    // really required.  This part of a fix for Liao's outliner, but should be useful for numerous
    // transformations.
    // DQ (8/6/2007): Only compute the hidden lists if working with C++ code!
    if (SageInterface::is_Cxx_language() == true)
    {
        // DQ (5/22/2007): Moved from SgProject::parse() function to here so that propagateHiddenListData() could be called afterward.
        // DQ (5/8/2007): Now build the hidden lists for types and declarations (Robert Preissl's work)
        Hidden_List_Computation::buildHiddenTypeAndDeclarationLists(node);

        // DQ (6/5/2007): We actually need this now since the hidden lists are not pushed to lower scopes where they are required.
        // DQ (5/22/2007): Added support for passing hidden list information about types, declarations and elaborated types to child scopes.
        propagateHiddenListData(node);
    }
#endif

    // DQ (11/24/2007): Support for Fortran resolution of array vs. function references.
    if (SageInterface::is_Fortran_language() == true)
    {
        // I think this is not used since I can always figure out if something is an
        // array reference or a function call.
        fixupFortranReferences(node);

        // DQ (10/3/2008): This bug in OFP is now fixed so no fixup is required.
        // This is the most reliable way to introduce the Fortran "contains" statement.
        // insertFortranContainsStatement(node);
    }

    // DQ (9/26/2008): fixup the handling of use declarations (SgUseStatement).
    // This also will fixup C++ using declarations.
    fixupFortranUseDeclarations(node);

#if 0
    ROSE_MemoryUsage memoryUsage1;
    printf ("Test 1: memory_usage = %f \n",memoryUsage1.getMemoryUsageMegabytes());
#endif

    // DQ (4/14/2010): Added support for symbol aliases for C++
    // This is the support for C++ "using declarations" which uses symbol aliases in the symbol table to provide
    // correct visability of symbols included from alternative scopes (e.g. namespaces).
    fixupAstSymbolTablesToSupportAliasedSymbols(node);

#if 0
    ROSE_MemoryUsage memoryUsage2;
    printf ("Test 2: memory_usage = %f \n",memoryUsage2.getMemoryUsageMegabytes());
#endif

    // DQ (6/24/2010): To support merge, we want to normalize the typedef lists for each type so that
    // the names of the types will evaluate to be the same (and merge appropriately).
    normalizeTypedefSequenceLists();

#if 0
    ROSE_MemoryUsage memoryUsage3;
    printf ("Test 3: memory_usage = %f \n",memoryUsage3.getMemoryUsageMegabytes());
#endif

    // DQ (3/7/2010): Identify the fragments of the AST that are disconnected.
    // Moved from astConsistancy tests (since it deletes nodes not connected to the AST).
    // TestForDisconnectedAST::test(node);

    // DQ (9/14/2011): Process the AST to remove constant folded values held in the expression trees.
    // This step defines a consistant AST more suitable for analysis since only the constant folded
    // values will be visited.  However, the default should be to save the original expression trees
    // and remove the constant folded values since this represents the original code.  This mechanism
    // will provide a default when it is more fully implemented.
    resetConstantFoldedValues(node);

    // Make sure that compiler-generated AST nodes are marked for Sg_File_Info::isCompilerGenerated().
    checkIsCompilerGeneratedFlag(node);

    // DQ (5/22/2005): Nearly all AST fixup should be done before this closing step
    // QY: check the isModified flag
    // CheckIsModifiedFlagSupport(node);
    checkIsModifiedFlag(node);

#if 0
    ROSE_MemoryUsage memoryUsage4;
    printf ("Test 4: memory_usage = %f \n",memoryUsage4.getMemoryUsageMegabytes());
#endif

    // ROSE_ASSERT(saved_declaration->get_definingDeclaration() != saved_declaration->get_firstNondefiningDeclaration());

    // DQ (3/17/2007): This should be empty
    // ROSE_ASSERT(SgNode::get_globalMangledNameMap().size() == 0);

    // This is used for both of the fillowing tests.
    SgSourceFile* sourceFile = isSgSourceFile(node);

#if 1
    // DQ (9/11/2009): Added support for numbering of statements required to support name qualification.
    if (sourceFile != NULL)
    {
        // DQ (9/11/2009): Added support for numbering of statements required to support name qualification.
        // sourceFile->buildStatementNumbering();
        SgGlobal* globalScope = sourceFile->get_globalScope();
        ROSE_ASSERT(globalScope != NULL);
        globalScope->buildStatementNumbering();
    }
    else
    {
        if (SgProject* project = isSgProject(node))
        {
            SgFilePtrList &files = project->get_fileList();
            for (SgFilePtrList::iterator fileI = files.begin(); fileI != files.end(); ++fileI)
            {
                if ( (sourceFile = isSgSourceFile(*fileI)) )
                {
                    SgGlobal* globalScope = sourceFile->get_globalScope();
                    ROSE_ASSERT(globalScope != NULL);
                    globalScope->buildStatementNumbering();
                }
            }
        }
    }
#endif

    // DQ (4/4/2010): check that the global scope has statements.
    // This was an error for Fortran and it appeared that everything
    // was working when it was not.  It appeared because of a strange
    // error between versions of the OFP support files.  So as a
    // way to avoid this in the future, we issue a warning for Fortran
    // code that has no statements in the global scope.  It can still
    // be a valid Fortran code (containing only comments).  but this
    // should help avoid our test codes appearing to work when they
    // don't (in the future). For C/C++ files there should always be
    // something in the global scope (because or ROSE defined functions),
    // so this test should not be a problem.
    if (sourceFile != NULL)
    {
        SgGlobal* globalScope = sourceFile->get_globalScope();
        ROSE_ASSERT(globalScope != NULL);
        if (globalScope->get_declarations().empty() == true)
        {
            printf ("WARNING: no statements in global scope for file = %s \n",sourceFile->getFileName().c_str());
        }
    }
    else
    {
        if (SgProject* project = isSgProject(node))
        {
            SgFilePtrList &files = project->get_fileList();
            for (SgFilePtrList::iterator fileI = files.begin(); fileI != files.end(); ++fileI)
            {
                if ( (sourceFile = isSgSourceFile(*fileI)) )
                {
                    SgGlobal* globalScope = sourceFile->get_globalScope();
                    ROSE_ASSERT(globalScope != NULL);
                    if (globalScope->get_declarations().empty() == true)
                    {
                        printf ("WARNING: no statements in global scope for file = %s \n",(*fileI)->getFileName().c_str());
                    }
                }
            }
        }
    }

    if ( SgProject::get_verbose() >= AST_POST_PROCESSING_VERBOSE_LEVEL )
        cout << "/* AST Postprocessing finished */" << endl;



    // DQ (5/3/2010): Added support for binary analysis specific post-processing.
    SgProject* project = isSgProject(node);
    if (project != NULL)
    {
#if 0
        // printf ("In postProcessingSupport(): project->get_exit_after_parser() = %s \n",project->get_exit_after_parser() ? "true" : "false");
        // printf ("In postProcessingSupport(): project->get_binary_only()       = %s \n",project->get_binary_only() ? "true" : "false");
        if (project->get_binary_only() == true)
        {
            printf ("Inside of postProcessingSupport(): Processing binary project \n");
            // ROSE_ASSERT(false);

            // addEdgesInAST();
        }
#endif
    }

}