LCOV - code coverage report
Current view: top level - home/yyan7/compiler/rexompiler/src/frontend/SageIII - fixupCopy_scopes.C (source / functions) Hit Total Coverage
Test: ROSE Lines: 255 674 37.8 %
Date: 2022-12-08 13:48:47 Functions: 15 46 32.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // tps (01/14/2010) : Switching from rose.h to sage3.
       2             : #include "sage3basic.h"
       3             : 
       4             : #include "fixupCopy.h"
       5             : 
       6             : #ifdef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
       7             :    #include "transformationSupport.h"
       8             : #endif
       9             : 
      10             : // This file implementes support for the AST copy fixup.  It is specific to:
      11             : // 1) Scope pointer fixup
      12             : // 2) Parent pointer fixup
      13             : // 3 defining and not defining declarations fixup
      14             : 
      15           0 : void outputMap ( SgCopyHelp & help )
      16             :    {
      17           0 :      int counter = 0;
      18           0 :      SgCopyHelp::copiedNodeMapTypeIterator i = help.get_copiedNodeMap().begin();
      19             : 
      20           0 :      printf ("COPY MAP: \n");
      21           0 :      while (i != help.get_copiedNodeMap().end())
      22             :         {
      23           0 :           if ( (i->first->get_startOfConstruct() != NULL) && (i->first->get_startOfConstruct()->isFrontendSpecific() == false) )
      24             :              {
      25           0 :                printf ("entry %4d: i->first = %p  i->second = %p = %s\n",counter,i->first,i->second,i->first->class_name().c_str());
      26             :              }
      27             : 
      28             :        // printf ("entry %4d: i->first = %p  i->second = %p = %s\n",counter,i->first,i->second,i->first->class_name().c_str());
      29           0 :           ROSE_ASSERT(i->first->variantT() == i->second->variantT());
      30             : 
      31           0 :           counter++;
      32           0 :           i++;
      33             :         }
      34           0 :    }
      35             : 
      36             : void
      37          33 : resetVariableDefinitionSupport ( const SgInitializedName* originalInitializedName, SgInitializedName* copyInitializedName, SgDeclarationStatement* targetDeclaration )
      38             :    {
      39             :   // DQ (10/8/2007): This is s supporting function to the SgInitializedName::fixupCopy_scopes() member function.
      40             : 
      41             :   // DQ (5/14/2012): Added simple test.
      42          33 :      ROSE_ASSERT(copyInitializedName != NULL);
      43             : 
      44             :   // Where the scope is reset, also build a new SgVariableDefinition (I forget why).
      45          33 :      ROSE_ASSERT(copyInitializedName->get_declptr() != NULL);
      46             : 
      47          33 :      SgNode* originalDeclaration = originalInitializedName->get_declptr();
      48          33 :      switch(originalDeclaration->variantT())
      49             :         {
      50          22 :           case V_SgVariableDefinition:
      51          22 :              {
      52             :             // In this case the target declaration is a SgVariableDefinition, and it has to be constructed, so the input paremter is NULL.
      53          22 :                ROSE_ASSERT(targetDeclaration == NULL);
      54             : 
      55          22 :                SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(originalInitializedName->get_declptr());
      56          22 :                ROSE_ASSERT(variableDefinition_original != NULL);
      57             : 
      58             :             // DQ (1/20/204): Moved to supporting the more general expression (required), plus the expression from which it may have been generated.
      59             :             // SgUnsignedLongVal* bitfield = variableDefinition_original->get_bitfield();
      60          22 :                SgExpression* bitfield = variableDefinition_original->get_bitfield();
      61             : 
      62          22 :                SgVariableDefinition* variableDefinition_copy = new SgVariableDefinition(copyInitializedName,bitfield);
      63          22 :                ROSE_ASSERT(variableDefinition_copy != NULL);
      64          22 :                copyInitializedName->set_declptr(variableDefinition_copy);
      65          22 :                variableDefinition_copy->set_parent(copyInitializedName);
      66             : 
      67             :             // This is the same way that Sg_File_Info objects are built in the copy mechanism.
      68          22 :                Sg_File_Info* newStartOfConstruct = new Sg_File_Info(*(variableDefinition_original->get_startOfConstruct()));
      69          22 :                ROSE_ASSERT(variableDefinition_original->get_endOfConstruct() != NULL);
      70          22 :                Sg_File_Info* newEndOfConstruct   = new Sg_File_Info(*(variableDefinition_original->get_endOfConstruct()));
      71             : 
      72          22 :                variableDefinition_copy->set_startOfConstruct(newStartOfConstruct);
      73          22 :                variableDefinition_copy->set_endOfConstruct(newEndOfConstruct);
      74             : 
      75          22 :                newStartOfConstruct->set_parent(variableDefinition_copy);
      76          22 :                newEndOfConstruct->set_parent(variableDefinition_copy);
      77             : 
      78          22 :                break;
      79             :              }
      80             : 
      81           0 :           case V_SgEnumDeclaration:
      82           0 :              {
      83             :             // In this case the target declaration is a SgEnumDeclaration, and it has already been copied so it need not be created.
      84           0 :                ROSE_ASSERT(targetDeclaration != NULL);
      85             : 
      86           0 :                SgEnumDeclaration* enumDeclaration_original = isSgEnumDeclaration(originalInitializedName->get_declptr());
      87           0 :                if (copyInitializedName->get_declptr() == enumDeclaration_original)
      88             :                   {
      89             :                  // Then reset to the targetDeclaration.
      90           0 :                     copyInitializedName->set_declptr(targetDeclaration);
      91             :                   }
      92             : 
      93             :                break;
      94             :              }
      95             : 
      96             :        // DQ (12/23/2012): Added support for templates.
      97          11 :           case V_SgTemplateFunctionDeclaration:
      98          11 :           case V_SgTemplateMemberFunctionDeclaration:
      99             : 
     100          11 :           case V_SgFunctionDeclaration:
     101          11 :           case V_SgMemberFunctionDeclaration:
     102          11 :           case V_SgTemplateInstantiationFunctionDecl:
     103          11 :           case V_SgTemplateInstantiationMemberFunctionDecl:
     104          11 :           case V_SgProcedureHeaderStatement:
     105          11 :           case V_SgProgramHeaderStatement:
     106          11 :              {
     107             :             // In this case the target declaration is a SgFunctionDeclaration, and it has already been copied so it need not be created.
     108          11 :                ROSE_ASSERT(targetDeclaration != NULL);
     109             : 
     110          11 :                SgFunctionDeclaration* functionDeclaration_original = isSgFunctionDeclaration(originalInitializedName->get_declptr());
     111          11 :                if (copyInitializedName->get_declptr() == functionDeclaration_original)
     112             :                   {
     113             :                  // Then reset to the targetDeclaration.
     114           9 :                     copyInitializedName->set_declptr(targetDeclaration);
     115             :                   }
     116             : 
     117             :                break;
     118             :              }
     119             : 
     120           0 :           default:
     121           0 :              {
     122           0 :                printf ("Error: default reached in resetVariableDefinitionSupport() originalDeclaration = %p = %s \n",originalDeclaration,originalDeclaration->class_name().c_str());
     123           0 :                ROSE_ABORT();
     124             :              }
     125             :         }
     126             : 
     127          33 :    }
     128             : 
     129             : 
     130             : // DQ (10/5/2007): Added IR node specific function to permit copies, via AST copy(), to be fixedup
     131             : // Usually this will correct scopes and in a few cases build child IR nodes that are not traversed
     132             : // (and thus shared in the result from the automatically generated copy function).
     133             : void
     134          45 : SgInitializedName::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     135             :    {
     136             :   // This is the empty default inplementation, not a problem if it is called!
     137             : 
     138             : #if DEBUG_FIXUP_COPY
     139             :   // printf ("Inside of SgInitializedName::fixupCopy_scopes() %p = %s \n",this,SageInterface::get_name(this).c_str());
     140             :      printf ("Inside of SgInitializedName::fixupCopy_scopes() %p = %s \n",this,this->get_name().str());
     141             : #endif
     142             : 
     143             :   // Need to fixup the scope and perhaps build the SgVariableDefinition object!
     144          45 :      SgInitializedName* initializedName_copy = isSgInitializedName(copy);
     145          45 :      ROSE_ASSERT(initializedName_copy != NULL);
     146             : 
     147             :   // DQ (4/21/2016): Replacing "__null" with more portable (non-gnu specific) use using "NULL".
     148             :   // ROSE_ASSERT (initializedName_copy->get_declptr() != __null);
     149          45 :      ROSE_ASSERT (initializedName_copy->get_declptr() != NULL);
     150             : 
     151             :      // fprintf(stderr, "SgInitializedName::fixupCopy_scopes(%p) this=%p\n", copy, this);
     152             :      // fprintf(stderr, "Copy's scope is %p, my scope is %p\n", initializedName_copy->get_scope(), this->get_scope());
     153             : 
     154             :   // ROSE_ASSERT(this->get_symbol_from_symbol_table() != NULL);
     155             : 
     156          45 :      if (initializedName_copy->get_scope() == this->get_scope())
     157             :         {
     158          84 :           FixupCopyDataMemberMacro(initializedName_copy,SgScopeStatement,get_scope,set_scope)
     159             :           // fprintf(stderr, "After: copy's scope is %p, my scope is %p\n", initializedName_copy->get_scope(), this->get_scope());
     160             : 
     161          42 :           SgNode* parent = initializedName_copy->get_parent();
     162             : 
     163             :        // printf ("In SgInitializedName::fixupCopy_scopes(): parent = %p \n",parent);
     164             : 
     165             :        // Since the parent might not have been set yet we have to allow for this case. In the case of a
     166             :        // SgInitializedName in a SgVariableDeclaration the SgInitializedName objects have their parents
     167             :        // set after the SgInitializedName is copied and in the copy function for the parent (SgVariableDeclaration).
     168             :           // fprintf (stderr, "In SgInitializedName::fixupCopy_scopes(): parent = %p = %s \n",parent,parent->class_name().c_str());
     169          42 :           if (parent != NULL)
     170             :              {
     171          42 :                ROSE_ASSERT(parent != NULL);
     172             :             // printf ("In SgInitializedName::fixupCopy_scopes(): parent = %p = %s \n",parent,parent->class_name().c_str());
     173             : 
     174          42 :                switch(parent->variantT())
     175             :                   {
     176             :                  // DQ (12/28/2012): Adding support for templates.
     177          22 :                     case V_SgTemplateVariableDeclaration:
     178             : 
     179          22 :                     case V_SgVariableDeclaration:
     180          22 :                        {
     181          22 :                          resetVariableDefinitionSupport(this,initializedName_copy,NULL);
     182          22 :                          break;
     183             :                        }
     184             : 
     185           0 :                     case V_SgEnumDeclaration:
     186           0 :                        {
     187           0 :                          SgEnumDeclaration* enumDeclaration = isSgEnumDeclaration(parent);
     188           0 :                          ROSE_ASSERT(enumDeclaration != NULL);
     189           0 :                          resetVariableDefinitionSupport(this,initializedName_copy,enumDeclaration);
     190           0 :                          break;
     191             :                        }
     192             : 
     193          20 :                     case V_SgFunctionParameterList:
     194          20 :                        {
     195          20 :                          SgNode* parentFunction = parent->get_parent();
     196          20 :                          SgFunctionDeclaration* functionDeclaration = isSgFunctionDeclaration(parentFunction);
     197             : 
     198             :                       // The parent of the SgFunctionParameterList might not have been set yet, so allow for this!
     199          20 :                          if (functionDeclaration != NULL)
     200             :                             {
     201             :                            // DQ (5/14/2012): Added simple test.
     202          11 :                               ROSE_ASSERT(initializedName_copy != NULL);
     203             : 
     204             :                            // DQ (5/14/2012): Added simple test, required in resetVariableDefinitionSupport().
     205          11 :                               ROSE_ASSERT(initializedName_copy->get_declptr() != NULL);
     206             : 
     207          11 :                               resetVariableDefinitionSupport(this,initializedName_copy,functionDeclaration);
     208             :                             }
     209             :                          break;
     210             :                        }
     211             : 
     212           0 :                     default:
     213           0 :                        {
     214           0 :                          printf ("default reached in SgInitializedName::fixupCopy_scopes() parent = %p = %s \n",parent,parent->class_name().c_str());
     215           0 :                          ROSE_ABORT();
     216             :                        }
     217             :                   }
     218             :              }
     219             :         }
     220             :        else
     221             :         {
     222             : #if DEBUG_FIXUP_COPY
     223             :        // fprintf (stderr, "Skipping resetting the scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
     224             :           printf ("Skipping resetting the scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
     225             : #endif
     226             :         }
     227             : 
     228             : 
     229          45 :      if (this->get_prev_decl_item() != NULL)
     230             :         {
     231           0 :           FixupCopyDataMemberMacro(initializedName_copy,SgInitializedName,get_prev_decl_item,set_prev_decl_item)
     232             :         }
     233             : 
     234             : #if DEBUG_FIXUP_COPY
     235             :      printf ("Leaving SgInitializedName::fixupCopy_scopes() \n\n");
     236             : #endif
     237          45 :    }
     238             : 
     239             : 
     240             : // DQ (11/1/2007): Build lighter weight versions of SgStatement::fixupCopy_scopes() and SgExpression::fixupCopy_scopes()
     241             : // and refactor code into the SgLocatedNode::fixupCopy_scopes().
     242             : 
     243             : void
     244          87 : SgStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     245             :    {
     246             :   // We need to call the fixupCopy function from the parent of a SgVariableDeclaration because the
     247             :   // copy function in the parent of the variable declaration sets the parent of the SgVariableDeclaration
     248             :   // and we need this parent in the fixupCopy function in the SgInitializedName.
     249             : 
     250             : #if DEBUG_FIXUP_COPY
     251             :      printf ("Inside of SgStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
     252             : #endif
     253             : 
     254          87 :      SgLocatedNode::fixupCopy_scopes(copy,help);
     255          87 :    }
     256             : 
     257             : void
     258       10070 : SgExpression::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     259             :    {
     260             : #if DEBUG_FIXUP_COPY
     261             :      printf ("Inside of SgExpression::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
     262             : #endif
     263             : 
     264       10070 :      Rose_STL_Container<SgNode*> children_original = const_cast<SgExpression*>(this)->get_traversalSuccessorContainer();
     265       20140 :      Rose_STL_Container<SgNode*> children_copy     = const_cast<SgNode*>(copy)->get_traversalSuccessorContainer();
     266       10070 :      ROSE_ASSERT (children_original.size() == children_copy.size());
     267             : 
     268       18427 :      for (Rose_STL_Container<SgNode*>::const_iterator
     269       10070 :             i_original = children_original.begin(),
     270       10070 :             i_copy = children_copy.begin();
     271       18427 :           i_original != children_original.end(); ++i_original, ++i_copy) {
     272        8357 :        if (*i_original == NULL) continue;
     273        8323 :        (*i_original)->fixupCopy_scopes(*i_copy,help);
     274             :      }
     275             : 
     276       10070 :      SgLocatedNode::fixupCopy_scopes(copy,help);
     277       10070 :    }
     278             : 
     279             : // DQ (11/1/2007): Make this work on SgLocatedNode (so that it can work on SgStatement and SgExpression).
     280             : 
     281             : // DQ (10/5/2007): Added IR node specific function to permit copies, via AST copy(), to be fixedup
     282             : // Usually this will correct scopes and in a few cases build child IR nodes that are not traversed
     283             : // (and thus shared in the result from the automatically generated copy function).
     284             : void
     285       10157 : SgLocatedNode::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     286             :    {
     287             : #if DEBUG_FIXUP_COPY
     288             :      printf ("Inside of SgLocatedNode::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
     289             : #endif
     290             : 
     291       10157 :      SgLocatedNode* copyLocatedNode = isSgLocatedNode(copy);
     292       10157 :      ROSE_ASSERT(copyLocatedNode != NULL);
     293             : 
     294             :   // DQ (10/24/2007): New test.
     295       10157 :      ROSE_ASSERT(copyLocatedNode->variantT() == this->variantT());
     296             : 
     297             :   // DQ (7/15/2007): Added assertion...
     298             :   // ROSE_ASSERT(this->get_parent() != NULL);
     299             :   // ROSE_ASSERT(copyStatement->get_parent() != NULL);
     300             : 
     301             :   // DQ (10/15/2007): If the parent of the original AST is not set then we will not process the parent in the copy,
     302             :   // thus the AST copy mechanism can handle incompletely setup AST (as required for use in the EDG/Sage translation)
     303             :   // yet only return an AST of similar quality.
     304       10157 :      if (this->get_parent() != NULL)
     305             :         {
     306        9400 :           FixupCopyDataMemberMacro(copyLocatedNode,SgNode,get_parent,set_parent)
     307             : 
     308             :        // Debugging information
     309        9398 :           SgNode* cpParent = copyLocatedNode->get_parent();
     310        9398 :           if (cpParent == NULL)
     311             :              {
     312             : #if PRINT_DEVELOPER_WARNINGS
     313             :                printf ("In SgLocatedNode::fixupCopy_scopes(): this->get_parent() != NULL, but copyLocatedNode->get_parent() == NULL for copyLocatedNode = %p = %s \n",copyLocatedNode,copyLocatedNode->class_name().c_str());
     314             :                printf ("     this                        = %p = %s \n",this,this->class_name().c_str());
     315             :                printf ("     this->get_parent()          = %p = %s \n",this->get_parent(),this->get_parent()->class_name().c_str());
     316             : #endif
     317             :              }
     318             : 
     319             :        // Debugging information
     320        9398 :           if (cpParent != NULL && cpParent->variantT() != this->get_parent()->variantT())
     321             :              {
     322             : #if PRINT_DEVELOPER_WARNINGS
     323             :                printf ("Warning: In SgLocatedNode::fixupCopy_scopes(): the parent of this and copyStatement are different \n");
     324             :                printf ("     this                        = %p = %s \n",this,this->class_name().c_str());
     325             :                printf ("     copyLocatedNode             = %p = %s \n",copyLocatedNode,copyLocatedNode->class_name().c_str());
     326             :                printf ("     this->get_parent()          = %p = %s \n",this->get_parent(),this->get_parent()->class_name().c_str());
     327             :                printf ("     copyStatement->get_parent() = %p = %s \n",cpParent,cpParent->class_name().c_str());
     328             : 
     329             :                this->get_startOfConstruct()->display("this->get_startOfConstruct(): debug");
     330             : #endif
     331             :              }
     332             :        // ROSE_ASSERT(copyStatement->get_parent()->variantT() == this->get_parent()->variantT());
     333             :         }
     334         759 :          else if (SgProject::get_verbose() > 0)
     335             :         {
     336           0 :           printf ("In SgLocatedNode::fixupCopy_scopes(): parent not set for original AST at %p = %s, thus copy left similarly incomplete \n",this,this->class_name().c_str());
     337             :         }
     338             : 
     339             :   // DQ (2/20/2009): Added assertion, I think it is up to the parent node copy function to set the parent in the copying of any children.
     340             :   // ROSE_ASSERT(copy->get_parent() != NULL);
     341       10157 :      if (copy->get_parent() == NULL)
     342             :         {
     343             :        // Note that using SageInterface::get_name(this) will work where SageInterface::get_name(copy)
     344             :        // will fail because sometimes the parent pointer is required to be valid within
     345             :        // SageInterface::get_name() (e.g. between SgFunctionParameterList and it's parent: SgFunctionDeclaration).
     346             : #if 0
     347             :           printf ("Returning a copy = %p = %s = %s with NULL parent \n",copy,copy->class_name().c_str(),SageInterface::get_name(this).c_str());
     348             : #endif
     349             :         }
     350             : 
     351             : #if DEBUG_FIXUP_COPY
     352             :      printf ("Leaving SgLocatedNode::fixupCopy_scopes() \n\n");
     353             : #endif
     354       10157 :    }
     355             : 
     356             : void
     357          21 : SgScopeStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     358             :    {
     359             :   // We need to call the fixupCopy function from the parent of a SgVariableDeclaration because the
     360             :   // copy function in the parent of the variable declaration sets the parent of the SgVariableDeclaration
     361             :   // and we need this parent in the fixupCopy function in the SgInitializedName.
     362             : 
     363             : #if DEBUG_FIXUP_COPY
     364             :      printf ("Inside of SgScopeStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
     365             : #endif
     366             : 
     367             :   // printf ("\nInside of SgScopeStatement::fixupCopy_scopes() for %p = %s copy = %p \n\n",this,this->class_name().c_str(),copy);
     368             :   // this->get_startOfConstruct()->display("Inside of SgScopeStatement::fixupCopy_scopes()");
     369             : 
     370          21 :      SgScopeStatement* copyScopeStatement = isSgScopeStatement(copy);
     371          21 :      ROSE_ASSERT(copyScopeStatement != NULL);
     372             : 
     373             :   // DQ (10/24/2007): New test.
     374          21 :      ROSE_ASSERT(copyScopeStatement->variantT() == this->variantT());
     375             : 
     376             :   // The symbol table should not have been setup yet!
     377             : 
     378             :   // DQ (5/21/2013): Restrict direct access to the symbol table.
     379             :   // if (copyScopeStatement->get_symbol_table()->size() != 0)
     380          21 :      if (copyScopeStatement->symbol_table_size() != 0)
     381             :         {
     382             : #if 0
     383             :           printf ("copy = %p = %s = %s \n",copy,copy->class_name().c_str(),SageInterface::get_name(copy).c_str());
     384             : #endif
     385             : #if 0
     386             :           copyScopeStatement->get_file_info()->display("In SgScopeStatement::fixupCopy_scopes()");
     387             : #endif
     388             :         }
     389             : 
     390             :   // DQ (2/6/2009): Comment this out since it fails for the case of the reverseTraversal tests.
     391             :   // ROSE_ASSERT(copyScopeStatement->get_symbol_table()->size() == 0);
     392             : 
     393             :   // Call the base class fixupCopy member function
     394          21 :      SgStatement::fixupCopy_scopes(copy,help);
     395             : 
     396             :   // printf ("\nLeaving SgScopeStatement::fixupCopy_scopes() for %p = %s copy = %p \n\n",this,this->class_name().c_str(),copy);
     397          21 :    }
     398             : 
     399             : 
     400             : 
     401             : void
     402           0 : SgGlobal::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     403             :    {
     404             : #if DEBUG_FIXUP_COPY
     405             :      printf ("Inside of SgGlobal::fixupCopy_scopes() for %p copy = %p \n",this,copy);
     406             : #endif
     407             : 
     408           0 :      SgGlobal* global_copy = isSgGlobal(copy);
     409           0 :      ROSE_ASSERT(global_copy != NULL);
     410             : 
     411           0 :      const SgDeclarationStatementPtrList & statementList_original = this->getDeclarationList();
     412           0 :      const SgDeclarationStatementPtrList & statementList_copy     = global_copy->getDeclarationList();
     413             : 
     414           0 :      SgDeclarationStatementPtrList::const_iterator i_original = statementList_original.begin();
     415           0 :      SgDeclarationStatementPtrList::const_iterator i_copy     = statementList_copy.begin();
     416             : 
     417             :   // Iterate over both lists to match up the correct pairs of SgStatement objects
     418           0 :      while ( (i_original != statementList_original.end()) && (i_copy != statementList_copy.end()) )
     419             :         {
     420           0 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
     421             : 
     422           0 :           i_original++;
     423           0 :           i_copy++;
     424             :         }
     425             : 
     426             :   // Call the base class fixupCopy member function
     427           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
     428             : 
     429             :   // printf ("\nLeaving SgGlobal::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
     430           0 :    }
     431             : 
     432             : // JJW 2/1/2008 -- Added support to fixup statement expressions
     433             : void
     434          19 : SgExprStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     435             :    {
     436             : #if DEBUG_FIXUP_COPY
     437             :      printf ("Inside of SgExprStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
     438             : #endif
     439             : 
     440          19 :      SgExprStatement* es_copy = isSgExprStatement(copy);
     441          19 :      ROSE_ASSERT(es_copy != NULL);
     442             : 
     443          19 :      SgExpression* expression_original = this->get_expression();
     444          19 :      SgExpression* expression_copy     = es_copy->get_expression();
     445             : 
     446          19 :      expression_original->fixupCopy_scopes(expression_copy, help);
     447             : 
     448             :   // Call the base class fixupCopy member function
     449          19 :      SgStatement::fixupCopy_scopes(copy,help);
     450             : 
     451             :   // printf ("\nLeaving SgExprStatement::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
     452          19 :    }
     453             : 
     454             : // DQ (10/6/2007): Added fixup function to set scopes not set properly by the ROSETTA generated copy!
     455             : void
     456          16 : SgBasicBlock::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     457             :    {
     458             : #if DEBUG_FIXUP_COPY
     459             :      printf ("Inside of SgBasicBlock::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
     460             : #endif
     461             : 
     462          16 :      SgBasicBlock* block_copy = isSgBasicBlock(copy);
     463          16 :      ROSE_ASSERT(block_copy != NULL);
     464             : 
     465          16 :      const SgStatementPtrList & statementList_original = this->getStatementList();
     466          16 :      const SgStatementPtrList & statementList_copy     = block_copy->getStatementList();
     467             : 
     468             :   // Check that this need not be handled as a special case such as SgIfStmt.
     469          16 :      if (this->containsOnlyDeclarations() == true)
     470             :         {
     471           0 :           ROSE_ASSERT(this->getDeclarationList().size() == statementList_original.size());
     472             :         }
     473             :        else
     474             :         {
     475          16 :           ROSE_ASSERT(this->getStatementList().size() == statementList_original.size());
     476             :         }
     477             : 
     478          16 :      SgStatementPtrList::const_iterator i_original = statementList_original.begin();
     479          16 :      SgStatementPtrList::const_iterator i_copy     = statementList_copy.begin();
     480             : 
     481             :   // Iterate over both lists to match up the correct pairs of SgStatement objects
     482          51 :      while ( (i_original != statementList_original.end()) && (i_copy != statementList_copy.end()) )
     483             :         {
     484          35 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
     485             : 
     486          35 :           i_original++;
     487          35 :           i_copy++;
     488             :         }
     489             : 
     490             :   // Call the base class fixupCopy member function
     491          16 :      SgScopeStatement::fixupCopy_scopes(copy,help);
     492             : 
     493             :   // printf ("\nLeaving SgBasicBlock::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
     494          16 :    }
     495             : 
     496             : void
     497          42 : SgDeclarationStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     498             :    {
     499             : #if DEBUG_FIXUP_COPY
     500             :      printf ("Inside of SgDeclarationStatement::fixupCopy_scopes() for %p = %s copy = %p (defining = %p firstNondefining = %p) \n",
     501             :           this,this->class_name().c_str(),copy,this->get_definingDeclaration(),this->get_firstNondefiningDeclaration());
     502             : #endif
     503             : 
     504             : #if DEBUG_FIXUP_COPY_OUTPUT_MAP
     505             :      outputMap(help);
     506             : #endif
     507             : 
     508             :   // Need to fixup the scopes and defining and non-defining declaration.
     509             : 
     510          42 :      SgDeclarationStatement* copyDeclarationStatement = isSgDeclarationStatement(copy);
     511          42 :      ROSE_ASSERT(copyDeclarationStatement != NULL);
     512             : 
     513             :   // DQ (10/20/2007): This is an essential piece of the fixup of the AST copy.  This is a recursive construction of IR nodes that have
     514             :   // defining and non-defining parts used when either or both were not copied in the initial call to the copy member functions.
     515             :   // Since we can visit the IR nodes in any order, and some declaration can have multiple parts (defining and non-defining declaration)
     516             :   // We have to make sure that these are processed first (in some cases they may have escaped being copied by the AST Copy mechanism
     517             :   // when they were not part of the traversed AST). So we have to build them if they don't exist (triggered by existance in the copy map).
     518             : 
     519             :   // Check if this IR node has been copied?  If so then it is in the copy map.
     520             :   // bool hasBeenCopied = (help.get_copiedNodeMap().find(this) != help.get_copiedNodeMap().end());
     521             :   // printf ("hasBeenCopied = %s \n",hasBeenCopied ? "true" : "false");
     522             :   // if (hasBeenCopied == false)
     523             : 
     524          84 :      bool definingDeclarationCopied         = (help.get_copiedNodeMap().find(this->get_definingDeclaration())         != help.get_copiedNodeMap().end());
     525          84 :      bool firstNondefiningDeclarationCopied = (help.get_copiedNodeMap().find(this->get_firstNondefiningDeclaration()) != help.get_copiedNodeMap().end());
     526             : 
     527             :   // DQ (3/2/2009): Handle the case of friend declaration.
     528          42 :      bool isFriendDeclaration = this->get_declarationModifier().isFriend();
     529             : 
     530             : #if 0
     531             :      printf ("### this = %p = %s copyDeclarationStatement = %p definingDeclarationCopied = %s firstNondefiningDeclarationCopied = %s \n",
     532             :           this,this->class_name().c_str(),copyDeclarationStatement,definingDeclarationCopied ? "true" : "false", firstNondefiningDeclarationCopied ? "true" : "false");
     533             :      printf ("    this->get_definingDeclaration()            = %p \n",this->get_definingDeclaration());
     534             :      printf ("    this->get_firstNondefiningDeclaration()    = %p \n",this->get_firstNondefiningDeclaration());
     535             :      printf ("    this->get_declarationModifier().isFriend() = %s \n",this->get_declarationModifier().isFriend() ? "true" : "false");
     536             :      printf ("    firstNondefiningDeclarationCopied          = %s \n",firstNondefiningDeclarationCopied ? "true" : "false");
     537             :      printf ("    definingDeclarationCopied                  = %s \n",definingDeclarationCopied ? "true" : "false");
     538             :      printf ("    isFriendDeclaration                        = %s \n",isFriendDeclaration ? "true" : "false");
     539             : #endif
     540             : 
     541             :   // DQ (3/2/2009): Modified to exclude copying of friend declaration defining and non defining declarations.
     542             :   // if (definingDeclarationCopied == true && firstNondefiningDeclarationCopied == true)
     543          42 :      if ( (definingDeclarationCopied == true && firstNondefiningDeclarationCopied == true) || (isFriendDeclaration == true) )
     544             :         {
     545             :        // We can process the current non-defining declaration (which is not the first non-defining declaration)
     546             :         }
     547             :        else
     548             :         {
     549             :        // Note sure if we need these variables
     550             :        // SgDeclarationStatement* copyOfDefiningDeclaration         = NULL;
     551             :        // SgDeclarationStatement* copyOfFirstNondefiningDeclaration = NULL;
     552             : 
     553             :        // Note: This will cause the first non-defining declaration to be copied first when neither have been processed.
     554             :        // if (this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == false)
     555             :        // if (this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == false && this == this->get_definingDeclaration())
     556             :        // if (this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == false && this == this->get_firstNondefiningDeclaration())
     557             :        // if (this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == false && this == this->get_firstNondefiningDeclaration())
     558          38 :           if (this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == false)
     559             :              {
     560             : #if 0
     561             :                printf ("*** this = %p this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == false && this == this->get_definingDeclaration() \n",this);
     562             : #endif
     563             :             // Setup the firstNondefining declaration
     564             :             // ROSE_ASSERT(definingDeclarationCopied == true);
     565             : 
     566             :             // We could build vitual constructors, but then that is what the copy function is so call copy!
     567             :             // This also added the firstNondefiningDeclaration to the copy map
     568             : 
     569             :             // DQ (10/21/2007): Use the copy help object so that it can control copying of defining vs. non-defining declaration.
     570             :             // SgNode* copyOfFirstNondefiningDeclarationNode = this->get_firstNondefiningDeclaration()->copy(help);
     571             :             // printf ("Nested copy of firstNondefiningDeclaration \n");
     572           1 :                SgNode* copyOfFirstNondefiningDeclarationNode = help.copyAst(this->get_firstNondefiningDeclaration());
     573             :             // printf ("DONE: Nested copy of firstNondefiningDeclaration \n");
     574             : 
     575           1 :                ROSE_ASSERT(copyOfFirstNondefiningDeclarationNode != NULL);
     576           1 :                ROSE_ASSERT(copyOfFirstNondefiningDeclarationNode->get_parent() == NULL);
     577             : #if 0
     578             :                printf ("SgDeclarationStatement::fixupCopy_scopes(): copyOfFirstNondefiningDeclarationNode = %p \n",copyOfFirstNondefiningDeclarationNode);
     579             :                printf ("SgDeclarationStatement::fixupCopy_scopes(): this->get_firstNondefiningDeclaration() = %p \n",this->get_firstNondefiningDeclaration());
     580             :                printf ("SgDeclarationStatement::fixupCopy_scopes(): this->get_firstNondefiningDeclaration()->get_parent() = %p \n",this->get_firstNondefiningDeclaration()->get_parent());
     581             :                printf ("SgDeclarationStatement::fixupCopy_scopes(): firstNondefiningDeclarationCopied = %s \n",firstNondefiningDeclarationCopied ? "true" : "false");
     582             : #endif
     583             :             // Must reset the parent (semantics of AST copy), but this will be done by reset
     584             : 
     585             :             // DQ (3/14/2014): The parent might not be set if the non-defining declaration has not be added to the AST (i.e. if it has only been used to build a symbol).
     586             :             // ROSE_ASSERT(this->get_firstNondefiningDeclaration()->get_parent() != NULL);
     587             : 
     588           1 :                copyOfFirstNondefiningDeclarationNode->set_parent(this->get_firstNondefiningDeclaration()->get_parent());
     589             : 
     590             :             // DQ (3/14/2014): The parent might not be set if the non-defining declaration has not be added to the AST (i.e. if it has only been used to build a symbol).
     591             :             // ROSE_ASSERT(copyOfFirstNondefiningDeclarationNode->get_parent() != NULL);
     592           1 :                if (copyOfFirstNondefiningDeclarationNode->get_parent() == NULL)
     593             :                   {
     594           0 :                     printf ("Note: SgDeclarationStatement::fixupCopy_scopes(): copyOfFirstNondefiningDeclarationNode->get_parent() == NULL \n");
     595             :                   }
     596             : 
     597             :             // printf ("Commented out setting of scopes on the this->get_firstNondefiningDeclaration() \n");
     598           1 :                this->get_firstNondefiningDeclaration()->fixupCopy_scopes(copyOfFirstNondefiningDeclarationNode,help);
     599             : 
     600             :             // copyOfFirstNondefiningDeclaration = isSgDeclarationStatement(copyOfFirstNondefiningDeclarationNode);
     601             :              }
     602             :             else
     603             :              {
     604             :             // Note: This needs to be in the else case to handle the recursion properly (else this case would be procesed twice)
     605          37 :                if (this->get_definingDeclaration() != NULL && definingDeclarationCopied == false)
     606             :                   {
     607             : #if 0
     608             :                     printf ("*** this = %p this->get_definingDeclaration() != NULL && definingDeclarationCopied == false \n",this);
     609             : #endif
     610             :                  // DQ (2/19/2009): I don't think that the firstNondefiningDeclarationCopied has to be true (here we are copying the defining declaration).
     611             :                  // Setup the defining declaration
     612             :                  // ROSE_ASSERT(firstNondefiningDeclarationCopied == true);
     613             : #if 0
     614             :                     if (firstNondefiningDeclarationCopied == false)
     615             :                        {
     616             :                       // This is the case of copying a definind declaration from one file to another (we have to
     617             :                       // copy the associated non-defining declarations so that they will have the same scopes).
     618             :                          ROSE_ASSERT(this->get_firstNondefiningDeclaration() != NULL);
     619             :                          SgNode* copyOfFirstNondefiningDeclarationNode = help.copyAst(this->get_firstNondefiningDeclaration());
     620             : 
     621             :                          ROSE_ASSERT(copyOfFirstNondefiningDeclarationNode != NULL);
     622             :                          ROSE_ASSERT(copyOfFirstNondefiningDeclarationNode->get_parent() == NULL);
     623             : 
     624             :                       // Must reset the parent (semantics of AST copy), but this will be done by reset
     625             :                          ROSE_ASSERT(this->get_firstNondefiningDeclaration()->get_parent() != NULL);
     626             :                          copyOfFirstNondefiningDeclarationNode->set_parent(this->get_firstNondefiningDeclaration()->get_parent());
     627             : 
     628             :                          this->get_firstNondefiningDeclaration()->fixupCopy_scopes(copyOfFirstNondefiningDeclarationNode,help);
     629             :                        }
     630             : #endif
     631             :                  // DQ (10/21/2007): Use the copy help object so that it can control copying of defining vs. non-defining declaration.
     632             :                  // SgNode* copyOfDefiningDeclarationNode = this->get_definingDeclaration()->copy(help);
     633           1 :                     SgNode* copyOfDefiningDeclarationNode = help.copyAst(this->get_definingDeclaration());
     634           1 :                     ROSE_ASSERT(copyOfDefiningDeclarationNode != NULL);
     635             : 
     636             :                  // If we didn't make a copy of the definingDeclaration then this is still a valid pointer, so there is no need to reset the parent or call
     637           1 :                     if (copyOfDefiningDeclarationNode != this->get_definingDeclaration())
     638             :                        {
     639             : #if 0
     640             :                          printf ("*** this = %p copyOfDefiningDeclarationNode != this->get_definingDeclaration() \n",this);
     641             : #endif
     642             :                       // DQ (2/26/2009): Set the parent to NULL (before resetting to valid value).
     643           1 :                          copyOfDefiningDeclarationNode->set_parent(NULL);
     644             : 
     645           1 :                          ROSE_ASSERT(copyOfDefiningDeclarationNode->get_parent() == NULL);
     646             : 
     647           1 :                          if (this->get_definingDeclaration()->get_parent() == NULL)
     648             :                             {
     649           0 :                               printf ("ERROR: this = %p = %s = %s this->get_definingDeclaration() = %p \n",this,this->class_name().c_str(),SageInterface::get_name(this).c_str(),this->get_definingDeclaration());
     650             :                             }
     651             : 
     652             :                       // Must reset the parent (semantics of AST copy), but this will be done by reset
     653             : 
     654             :                       // DQ (9/10/2014): The new support for template function handling causes some template to be saved and there parent pointers not set until later.
     655             :                       // This is likely why this is failing (see copytest2007_40.C).
     656             :                       // ROSE_ASSERT(this->get_definingDeclaration()->get_parent() != NULL);
     657           1 :                          if (this->get_definingDeclaration()->get_parent() == NULL)
     658             :                             {
     659           0 :                               if (isSgTemplateFunctionDeclaration(this->get_definingDeclaration()) != NULL || isSgTemplateMemberFunctionDeclaration(this->get_definingDeclaration()) != NULL)
     660             :                                  {
     661           0 :                                    printf ("Warning: (inner scope) this->get_definingDeclaration()->get_parent() == NULL (OK for some SgTemplateFunctionDeclaration and SgTemplateMemberFunctionDeclaration) \n");
     662             :                                  }
     663           0 :                                 else if (isSgTemplateClassDeclaration(this->get_definingDeclaration()) != NULL)
     664             :                                  {
     665           0 :                                    printf ("WARNING: %p (%s) has no parent! \n", this->get_definingDeclaration(), this->get_definingDeclaration()->class_name().c_str());
     666             :                                  }
     667             :                                 else
     668             :                                  {
     669           0 :                                    printf ("ERROR: %p (%s) has no parent! \n", this->get_definingDeclaration(), this->get_definingDeclaration()->class_name().c_str());
     670           0 :                                    ROSE_ASSERT(this->get_definingDeclaration()->get_parent() != NULL);
     671             :                                  }
     672             :                             }
     673           1 :                          copyOfDefiningDeclarationNode->set_parent(this->get_definingDeclaration()->get_parent());
     674             : #if 0
     675             :                          printf ("Exiting before recursive call to copy as a test! \n");
     676             :                          ROSE_ABORT();
     677             : #endif
     678             : #if 1
     679             :                       // DQ (2/26/2009): This was valid code that was temporarily commented out (turning it back on).
     680             :                       // DQ (10/21/2007): I think this was a bug!
     681             :                       // this->get_firstNondefiningDeclaration()->fixupCopy_scopes(copyOfDefiningDeclarationNode,help);
     682           1 :                          this->get_definingDeclaration()->fixupCopy_scopes(copyOfDefiningDeclarationNode,help);
     683             : #else
     684             :                          printf ("Skipping call to fixup_scopes on the defining declaration (endless recursion for outlining example moreTest4.cpp) \n");
     685             : #endif
     686             :                        }
     687             : 
     688             :                  // DQ (9/10/2014): See not above.
     689             :                  // DQ (2/20/2009): Added assertion!
     690             :                  // ROSE_ASSERT(copyOfDefiningDeclarationNode->get_parent() != NULL);
     691           1 :                     if (copyOfDefiningDeclarationNode->get_parent() == NULL)
     692             :                        {
     693           0 :                          printf ("Warning: (outer scope) this->get_definingDeclaration()->get_parent() == NULL (OK for some SgTemplateFunctionDeclaration and SgTemplateMemberFunctionDeclaration) \n");
     694             :                        }
     695             : 
     696             :                  // copyOfDefiningDeclaration = isSgDeclarationStatement(copyOfDefiningDeclarationNode);
     697             :                   }
     698             :                  else
     699             :                   {
     700             :                  // This is an acceptable case, but only if:
     701          36 :                     ROSE_ASSERT(this->get_definingDeclaration() == NULL || this->get_firstNondefiningDeclaration() == NULL);
     702             :                   }
     703             :              }
     704             :         }
     705             : 
     706             :   // If this is a declaration which is a defining declaration, then the copy should be as well.
     707          42 :      if (this->get_definingDeclaration() == this)
     708             :         {
     709             :        // printf ("This is a DEFINING declaration this %p = %s copyDeclarationStatement = %p = %s \n",this,this->class_name().c_str(),copyDeclarationStatement,copyDeclarationStatement->class_name().c_str());
     710           3 :           copyDeclarationStatement->set_definingDeclaration(copyDeclarationStatement);
     711             : 
     712             :        // If this is the defining declaration the we can reset the defining declaration on the firstNondefiningDeclaration (if it has been updated)
     713           3 :           if (this->get_firstNondefiningDeclaration() != copyDeclarationStatement->get_firstNondefiningDeclaration())
     714             :              {
     715             :             // printf ("This is the defining declaration, so we can reset the defining declaration on the firstNondefiningDeclaration \n");
     716           3 :                FixupCopyDataMemberMacro(copyDeclarationStatement->get_firstNondefiningDeclaration(),SgDeclarationStatement,get_definingDeclaration,set_definingDeclaration)
     717             :              }
     718             :         }
     719             :        else
     720             :         {
     721             :        // DQ (10/19/2007): If there was a defining declaration then the copy's defining declaration using the map
     722             :        // printf ("NOT a DEFINING declaration: this->get_definingDeclaration() = %p \n",this->get_definingDeclaration());
     723          39 :           if (this->get_definingDeclaration() != NULL)
     724             :              {
     725           3 :                ROSE_ASSERT(copyDeclarationStatement->get_definingDeclaration() != NULL);
     726             : 
     727           4 :                FixupCopyDataMemberMacro(copyDeclarationStatement,SgDeclarationStatement,get_definingDeclaration,set_definingDeclaration)
     728             : #if 0
     729             :                printf ("On the firstNondefiningDeclaration %p setting the definingDeclaration to %p \n",
     730             :                     copyDeclarationStatement->get_firstNondefiningDeclaration(),copyDeclarationStatement->get_definingDeclaration());
     731             :                copyDeclarationStatement->get_firstNondefiningDeclaration()->set_definingDeclaration(copyDeclarationStatement->get_definingDeclaration());
     732             : #endif
     733             :              }
     734             :             else
     735             :              {
     736             :             // printf ("In SgDeclarationStatement::fixupCopy_scopes(): this->get_definingDeclaration() == NULL \n");
     737             :              }
     738             :         }
     739             : 
     740             :   // DQ (10/12/2007): It is not always clear if this is a great idea.  This uncovered a bug in the
     741             :   // SageInterface::isOverloaded() function. Having two declarations marked as the firstNondefiningDeclaration
     742             :   // could be a problem at some point.  But for now this preserves the concept of an exact copy, so I am
     743             :   // leaving it as is.
     744             : 
     745             :   // If this is a declaration which is a nondefining declaration, then the copy should be as well.
     746             :   // if (this->get_firstNondefiningDeclaration() == this)
     747          42 :      if (this->get_firstNondefiningDeclaration() == this)
     748             :         {
     749             :        // printf ("This is the FIRST-NON-DEFINING declaration this %p = %s copyDeclarationStatement = %p = %s \n",this,this->class_name().c_str(),copyDeclarationStatement,copyDeclarationStatement->class_name().c_str());
     750          39 :           copyDeclarationStatement->set_firstNondefiningDeclaration(copyDeclarationStatement);
     751             : 
     752             :        // If this is the firstNondefining declaration the we can reset the firstNondefiningDeclaration on the definingDeclaration (if it has been updated)
     753          39 :           if (this->get_definingDeclaration() != copyDeclarationStatement->get_definingDeclaration())
     754             :              {
     755             :             // printf ("This is the firstNondefining declaration, so  we can reset the firstNondefiningDeclaration on the definingDeclaration \n");
     756           4 :                FixupCopyDataMemberMacro(copyDeclarationStatement->get_definingDeclaration(),SgDeclarationStatement,get_firstNondefiningDeclaration,set_firstNondefiningDeclaration)
     757             :              }
     758             :         }
     759             :        else
     760             :         {
     761             :        // DQ (10/19/2007): If there was a defining declaration then the copy's defining declaration using the map
     762             :        // printf ("NOT a FIRST_NON_DEFINING declaration: this->get_firstNondefiningDeclaration() = %p \n",this->get_firstNondefiningDeclaration());
     763             :        // if (this->get_firstNondefiningDeclaration() != NULL)
     764           3 :           if (this->get_firstNondefiningDeclaration() != NULL && firstNondefiningDeclarationCopied == true)
     765             :              {
     766           2 :                ROSE_ASSERT(copyDeclarationStatement->get_firstNondefiningDeclaration() != NULL);
     767           3 :                FixupCopyDataMemberMacro(copyDeclarationStatement,SgDeclarationStatement,get_firstNondefiningDeclaration,set_firstNondefiningDeclaration)
     768             :              }
     769             :             else
     770             :              {
     771             :             // printf ("In SgDeclarationStatement::fixupCopy_scopes(): this->get_firstNondefiningDeclaration() == NULL \n");
     772             :              }
     773             :         }
     774             : 
     775             : 
     776             :   // DQ (10/16/2007): Added assertion (see copytest2007_17.C)
     777          42 :      if (this->get_definingDeclaration() != NULL && this->get_firstNondefiningDeclaration() != NULL)
     778             :         {
     779             :        // printf ("this->get_definingDeclaration()         = %p = %s \n",this->get_definingDeclaration(),this->get_definingDeclaration()->class_name().c_str());
     780             :        // printf ("this->get_firstNondefiningDeclaration() = %p = %s \n",this->get_firstNondefiningDeclaration(),this->get_firstNondefiningDeclaration()->class_name().c_str());
     781           6 :           ROSE_ASSERT(this->get_definingDeclaration()->variantT() == this->get_firstNondefiningDeclaration()->variantT());
     782             :         }
     783             : 
     784             :   // DQ (10/16/2007): Added assertion (see copytest2007_17.C)
     785          42 :      if (copyDeclarationStatement->get_definingDeclaration() != NULL && copyDeclarationStatement->get_firstNondefiningDeclaration() != NULL)
     786             :         {
     787             :        // printf ("copyDeclarationStatement->get_definingDeclaration()         = %p = %s \n",copyDeclarationStatement->get_definingDeclaration(),copyDeclarationStatement->get_definingDeclaration()->class_name().c_str());
     788             :        // printf ("copyDeclarationStatement->get_firstNondefiningDeclaration() = %p = %s \n",copyDeclarationStatement->get_firstNondefiningDeclaration(),copyDeclarationStatement->get_firstNondefiningDeclaration()->class_name().c_str());
     789           6 :           ROSE_ASSERT(copyDeclarationStatement->get_definingDeclaration()->variantT() == copyDeclarationStatement->get_firstNondefiningDeclaration()->variantT());
     790             :         }
     791             : 
     792             :   // DQ (10/12/2007): Set the scope for those SgDeclarationStatements which store their scope explicitly.
     793             :   // printf ("this->hasExplicitScope() = %s \n",this->hasExplicitScope() ? "true" : "false");
     794          42 :      if (this->hasExplicitScope() == true)
     795             :         {
     796             :        // printf ("Reset the scope of the copy for this = %p = %s \n",this,this->class_name().c_str());
     797          14 :           FixupCopyDataMemberMacro(copyDeclarationStatement,SgScopeStatement,get_scope,set_scope)
     798             : 
     799             : #if 0
     800             :        // DQ (10/21/2007): This can be OK for where a function prototype is being generated from a defining function declaration.
     801             : 
     802             :        // ROSE_ASSERT(copyDeclarationStatement->get_scope() != this->get_scope());
     803             :           if (copyDeclarationStatement->get_scope() == this->get_scope())
     804             :              {
     805             :                printf ("##########  ERROR: SCOPES NOT SET CORRECTLY! (%p = %s)  ########## \n",copy,copy->class_name().c_str());
     806             :              }
     807             : #endif
     808             : 
     809             :        // Make sure that the copy sets the scopes to be the same type
     810           7 :           ROSE_ASSERT(copyDeclarationStatement->get_scope()->variantT() == this->get_scope()->variantT());
     811             : 
     812             :        // DQ (2/28/2009): Make sure that the declaration and the copy are in the same file.
     813             :        // ROSE_ASSERT(TransformationSupport::getSourceFile(copyDeclarationStatement) == TransformationSupport::getSourceFile(this));
     814             :        // ROSE_ASSERT(TransformationSupport::getSourceFile(this->get_firstNondefiningDeclaration()) == TransformationSupport::getSourceFile(this));
     815           7 :           if (this->get_definingDeclaration() != NULL)
     816             :              {
     817             :             // DQ (3/4/2009): This test fails for copytest2007_34.C
     818           6 :                if (TransformationSupport::getSourceFile(this->get_definingDeclaration()) != TransformationSupport::getSourceFile(this))
     819             :                   {
     820           0 :                     printf ("Warning: TransformationSupport::getSourceFile(this->get_definingDeclaration()) != TransformationSupport::getSourceFile(this) \n");
     821           0 :                     printf ("Commented out failing test for copytest2007_34.C \n");
     822             :                   }
     823             :             // ROSE_ASSERT(TransformationSupport::getSourceFile(this->get_definingDeclaration()) == TransformationSupport::getSourceFile(this));
     824             :              }
     825             : 
     826             : #if 0
     827             :        // DQ (3/3/2009): For some declaration there is a defining and non-defining and if in copying both only one has
     828             :        // been copied before this test they will appear to be from different file until the second declaration is copied.
     829             :           if (copyDeclarationStatement->get_firstNondefiningDeclaration() != NULL)
     830             :              {
     831             :                if (TransformationSupport::getSourceFile(copyDeclarationStatement->get_firstNondefiningDeclaration()) != TransformationSupport::getSourceFile(copyDeclarationStatement))
     832             :                   {
     833             :                     printf ("Error: source files don't match for copyDeclarationStatement = %p and copyDeclarationStatement->get_firstNondefiningDeclaration() = %p \n",copyDeclarationStatement,copyDeclarationStatement->get_firstNondefiningDeclaration());
     834             :                   }
     835             :              }
     836             : #endif
     837             : 
     838             :        // DQ (3/2/2009): Make sure this is not the non-defining declaration since the defining declaration will not have been copied yet and so of course the files will not match.
     839             :        // ROSE_ASSERT(TransformationSupport::getSourceFile(copyDeclarationStatement->get_firstNondefiningDeclaration()) == TransformationSupport::getSourceFile(copyDeclarationStatement));
     840             :        // if (copyDeclarationStatement->get_definingDeclaration() != NULL)
     841           7 :           if (copyDeclarationStatement->get_definingDeclaration() != NULL && this != this->get_firstNondefiningDeclaration())
     842             :              {
     843             :             // ROSE_ASSERT(TransformationSupport::getSourceFile(copyDeclarationStatement->get_definingDeclaration()) == TransformationSupport::getSourceFile(copyDeclarationStatement));
     844           3 :                if (TransformationSupport::getSourceFile(copyDeclarationStatement->get_definingDeclaration()) != TransformationSupport::getSourceFile(copyDeclarationStatement))
     845             :                   {
     846           0 :                     printf ("copyDeclarationStatement = %p = %s \n",copyDeclarationStatement,copyDeclarationStatement->class_name().c_str());
     847           0 :                     printf ("############# Detected case of copyDeclarationStatement->get_definingDeclaration() in file %s \n",
     848           0 :                          TransformationSupport::getSourceFile(copyDeclarationStatement->get_definingDeclaration())->getFileName().c_str());
     849           0 :                     printf ("############# Detected case of copyDeclarationStatement in file %s \n",TransformationSupport::getSourceFile(copyDeclarationStatement)->getFileName().c_str());
     850             : 
     851             :                  // This is not what we want here!
     852             :                  // copyDeclarationStatement->set_definingDeclaration(NULL);
     853             : 
     854           0 :                     printf ("Error: source files don't match for copyDeclarationStatement = %p and copyDeclarationStatement->get_definingDeclaration() = %p \n",copyDeclarationStatement,copyDeclarationStatement->get_definingDeclaration());
     855           0 :                     ROSE_ABORT();
     856             :                   }
     857             :              }
     858             :         }
     859             : 
     860             :   // DQ (10/19/2007): Added test...
     861          42 :      if (this->get_definingDeclaration() != NULL && this->get_firstNondefiningDeclaration() != NULL)
     862             :         {
     863             :        // DQ (11/6/2007): If these are in the same namespace but different in different instances of the namespace
     864             :        // definition (SgNamespaceDefinitionStatement objects), then the test for the same scope is more complex.
     865           6 :           SgNamespaceDefinitionStatement* definingNamespace         = isSgNamespaceDefinitionStatement(this->get_definingDeclaration()->get_scope());
     866           6 :           SgNamespaceDefinitionStatement* firstNondefiningNamespace = isSgNamespaceDefinitionStatement(this->get_firstNondefiningDeclaration()->get_scope());
     867           6 :           if (definingNamespace != NULL && firstNondefiningNamespace != NULL)
     868             :              {
     869             :             // printf ("Test for same namespace is more complex: definingNamespace = %p firstNondefiningNamespace = %p \n",definingNamespace,firstNondefiningNamespace);
     870           0 :                SgNamespaceDeclarationStatement* definingNamespaceDeclaration         = definingNamespace->get_namespaceDeclaration();
     871           0 :                SgNamespaceDeclarationStatement* firstNondefiningNamespaceDeclaration = firstNondefiningNamespace->get_namespaceDeclaration();
     872           0 :                ROSE_ASSERT(definingNamespaceDeclaration != NULL);
     873           0 :                ROSE_ASSERT(firstNondefiningNamespaceDeclaration != NULL);
     874           0 :                ROSE_ASSERT(definingNamespaceDeclaration->get_firstNondefiningDeclaration() == firstNondefiningNamespaceDeclaration->get_firstNondefiningDeclaration());
     875             :              }
     876             :             else
     877             :              {
     878           6 :                if (this->get_definingDeclaration()->get_scope() != this->get_firstNondefiningDeclaration()->get_scope() )
     879             :                   {
     880             : #if 0
     881             :                     printf ("Error in matching scopes: this = %p = %s = %s \n",this,this->class_name().c_str(),SageInterface::get_name(this).c_str());
     882             :                     printf ("     this->get_definingDeclaration()         = %p \n",this->get_definingDeclaration());
     883             :                     printf ("     this->get_firstNondefiningDeclaration() = %p \n",this->get_firstNondefiningDeclaration());
     884             :                     printf ("     this->get_definingDeclaration()->get_scope()         = %p = %s \n",this->get_definingDeclaration()->get_scope(),this->get_definingDeclaration()->get_scope()->class_name().c_str());
     885             :                     printf ("     this->get_firstNondefiningDeclaration()->get_scope() = %p = %s \n",this->get_firstNondefiningDeclaration()->get_scope(),this->get_firstNondefiningDeclaration()->get_scope()->class_name().c_str());
     886             : #endif
     887             :                  // this->get_startOfConstruct()->display("Error: this scope mismatch: debug");
     888             :                  // this->get_definingDeclaration()->get_startOfConstruct()->display("Error: definingDeclaration scope mismatch: debug");
     889             :                  // this->get_firstNondefiningDeclaration()->get_startOfConstruct()->display("Error: firstNondefiningDeclaration scope mismatch: debug");
     890             :                   }
     891             : 
     892             :             // DQ (2/19/2009): Make sure that these are the same kind of IR nodes since they might be in different files (instead of in the same file).
     893             :             // ROSE_ASSERT(this->get_definingDeclaration()->get_scope() == this->get_firstNondefiningDeclaration()->get_scope() );
     894           6 :                ROSE_ASSERT(this->get_definingDeclaration()->get_scope()->variantT() == this->get_firstNondefiningDeclaration()->get_scope()->variantT() );
     895             :              }
     896             : 
     897             :        // ROSE_ASSERT(this->get_definingDeclaration()->get_scope() == this->get_firstNondefiningDeclaration()->get_scope() );
     898             :         }
     899             : 
     900             :   // DQ (10/19/2007): Added test...
     901          42 :      if (copyDeclarationStatement->get_definingDeclaration() != NULL && copyDeclarationStatement->get_firstNondefiningDeclaration() != NULL)
     902             :         {
     903             : #if 0
     904             :           printf ("copyDeclarationStatement = %p = %s = %s copyDeclarationStatement->get_firstNondefiningDeclaration() = %p \n",
     905             :                copyDeclarationStatement,copyDeclarationStatement->class_name().c_str(),SageInterface::get_name(copyDeclarationStatement).c_str(),
     906             :                copyDeclarationStatement->get_firstNondefiningDeclaration());
     907             :           printf ("copyDeclarationStatement = %p copyDeclarationStatement->get_definingDeclaration() = %p \n",
     908             :                copyDeclarationStatement,copyDeclarationStatement->get_definingDeclaration());
     909             :           printf ("copyDeclarationStatement->get_scope() = %p copyDeclarationStatement->get_firstNondefiningDeclaration()->get_scope() = %p \n",
     910             :                copyDeclarationStatement->get_scope(),copyDeclarationStatement->get_firstNondefiningDeclaration()->get_scope());
     911             : #endif
     912             : #if 1
     913             :        // DQ (10/19/2007): Check the loop (not passible until both have been processed)
     914           6 :           ROSE_ASSERT(copyDeclarationStatement->get_firstNondefiningDeclaration()->get_definingDeclaration() != NULL);
     915           6 :           ROSE_ASSERT(copyDeclarationStatement->get_definingDeclaration()->get_firstNondefiningDeclaration() != NULL);
     916             : #else
     917             :        // DQ (2/26/2009): See if I get past this so that I can generate the graphs so that I can debug this.
     918             :           printf ("Skipping failing test \n");
     919             : #endif
     920             :        // ROSE_ASSERT(copyDeclarationStatement->get_firstNondefiningDeclaration()->get_definingDeclaration() == copyDeclarationStatement->get_definingDeclaration());
     921             : 
     922             :        // We can't assert this yet since this is part of the copy of the defining declaration within the processing of the non-defining declaration (recurssively called!)
     923             :        // ROSE_ASSERT(copyDeclarationStatement->get_definingDeclaration()->get_firstNondefiningDeclaration() == copyDeclarationStatement->get_firstNondefiningDeclaration());
     924             : 
     925             :        // If we can get to this point then we can perform this additional test
     926             :        // ROSE_ASSERT(copyDeclarationStatement->get_definingDeclaration()->get_scope() == copyDeclarationStatement->get_firstNondefiningDeclaration()->get_scope() );
     927             :         }
     928             : 
     929             :   // DQ (2/20/2009): Added assertion.
     930             :   // ROSE_ASSERT(copy->get_parent() != NULL);
     931             : 
     932             :   // Call the base class fixupCopy member function (this will setup the parent)
     933          42 :      SgStatement::fixupCopy_scopes(copy,help);
     934             : 
     935             :   // DQ (2/20/2009): Note: These are allowed to be NULL a warning is issued in SgLocatedNode::fixupCopy_scopes().
     936             :   // ROSE_ASSERT(copy->get_parent() != NULL);
     937          42 :    }
     938             : 
     939             : 
     940             : void
     941           7 : SgFunctionDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
     942             :    {
     943           7 :      SgFunctionDeclaration* functionDeclaration_copy = isSgFunctionDeclaration(copy);
     944           7 :      ROSE_ASSERT(functionDeclaration_copy != NULL);
     945             : 
     946             : #if DEBUG_FIXUP_COPY
     947             :      printf ("\nIn SgFunctionDeclaration::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
     948             : #endif
     949             : 
     950             :   // printf ("\nIn SgFunctionDeclaration::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
     951             : 
     952             :   // Call the base class fixupCopy member function
     953           7 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
     954             : 
     955             :   // Setup the scopes of the SgInitializedName objects in the paraleter list
     956           7 :      ROSE_ASSERT(get_parameterList() != NULL);
     957           7 :      get_parameterList()->fixupCopy_scopes(functionDeclaration_copy->get_parameterList(),help);
     958             : 
     959             :   // Setup the details in the SgFunctionDefinition (this may have to rebuild the sysmbol table)
     960             :   // printf ("In SgFunctionDeclaration::fixupCopy_scopes(): this->get_definition() = %p \n",this->get_definition());
     961           7 :      if (this->get_definition() != NULL)
     962             :         {
     963             :        // DQ (3/15/2014): The defining declaration should not be marked (isForward() == true).
     964           3 :           if (isForward() == true)
     965             :              {
     966           0 :                printf ("Warning: The defining declaration should not be marked (isForward() == true) \n");
     967           0 :                printf ("SgFunctionDeclaration::fixupCopy_scopes(): (isForward() == true): functionDeclaration_copy = %p = %s \n",functionDeclaration_copy,functionDeclaration_copy->class_name().c_str());
     968           0 :                printf ("   --- functionDeclaration_copy->get_firstNondefiningDeclaration() = %p \n",functionDeclaration_copy->get_firstNondefiningDeclaration());
     969           0 :                printf ("   --- functionDeclaration_copy->get_definingDeclaration()         = %p \n",functionDeclaration_copy->get_definingDeclaration());
     970             : 
     971             :             // functionDeclaration_copy->get_file_info()->display("SgFunctionDeclaration::fixupCopy_scopes(): (isForward() == true): debug");
     972             : 
     973             :             // Reset this!
     974           0 :                functionDeclaration_copy->unsetForward();
     975             : 
     976             :             // DQ (3/15/2014): This is a Java specific issue. I don't want to be changing the original
     977             :             // version of the statement we are copying. This needs to be fixed properly in the Java AST.
     978           0 :                printf ("TODO (Java): isForward() status is being reset for the original SgFunctionDeclaration as part of SgFunctionDeclaration::fixupCopy_scopes(): this = %p = %s = %s \n",this,this->class_name().c_str(),this->get_name().str());
     979             :             // this->unsetForward();
     980           0 :                this->get_definition()->get_declaration()->unsetForward();
     981             :              }
     982           3 :           ROSE_ASSERT(isForward() == false);
     983             : 
     984             :        // DQ (2/26/2009): Handle special cases where the copyHelp function is non-trivial.
     985             :        // Is every version of copyHelp object going to be a problem?
     986             : 
     987             :        // For the outlining, our copyHelp object does not copy defining function declarations
     988             :        // and substitutes a non-defining declarations, so if the copy has been built this way
     989             :        // then skip trying to reset the SgFunctionDefinition.
     990             :        // printf ("In SgFunctionDeclaration::fixupCopy_scopes(): functionDeclaration_copy->get_definition() = %p \n",functionDeclaration_copy->get_definition());
     991             :        // this->get_definition()->fixupCopy_scopes(functionDeclaration_copy->get_definition(),help);
     992           3 :           if (functionDeclaration_copy->get_definition() != NULL)
     993             :              {
     994           3 :                this->get_definition()->fixupCopy_scopes(functionDeclaration_copy->get_definition(),help);
     995             :              }
     996             : 
     997             :        // If this is a declaration with a definition then it is a defining declaration
     998             :        // functionDeclaration_copy->set_definingDeclaration(functionDeclaration_copy);
     999             :         }
    1000             : 
    1001             :   // printf ("\nLeaving SgFunctionDeclaration::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1002           7 :    }
    1003             : 
    1004             : // DQ (10/6/2007): Added fixup function to set scopes not set properly by the ROSETTA generated copy!
    1005             : void
    1006          12 : SgFunctionParameterList::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1007             :    {
    1008             : #if DEBUG_FIXUP_COPY
    1009             :      printf ("Inside of SgFunctionParameterList::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1010             : #endif
    1011             : 
    1012             :   // Also call the base class version of the fixupCopycopy() member function
    1013          12 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1014             : 
    1015          12 :      SgFunctionParameterList* copyFunctionParameterList = isSgFunctionParameterList(copy);
    1016          12 :      ROSE_ASSERT(copyFunctionParameterList != NULL);
    1017             : 
    1018          12 :      const SgInitializedNamePtrList & parameterList_original = this->get_args();
    1019          12 :      SgInitializedNamePtrList & parameterList_copy           = copyFunctionParameterList->get_args();
    1020             : 
    1021          12 :      SgInitializedNamePtrList::const_iterator i_original = parameterList_original.begin();
    1022          12 :      SgInitializedNamePtrList::iterator i_copy           = parameterList_copy.begin();
    1023             : 
    1024             :   // Iterate over both lists to match up the correct pairs of SgInitializedName objects
    1025          34 :      while ( (i_original != parameterList_original.end()) && (i_copy != parameterList_copy.end()) )
    1026             :         {
    1027          22 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
    1028             : 
    1029          22 :           i_original++;
    1030          22 :           i_copy++;
    1031             :         }
    1032          12 :    }
    1033             : 
    1034             : 
    1035             : void
    1036           0 : SgMemberFunctionDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1037             :    {
    1038             : #if DEBUG_FIXUP_COPY
    1039             :      printf ("In SgMemberFunctionDeclaration::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1040             : #endif
    1041             : 
    1042           0 :      SgMemberFunctionDeclaration* memberFunctionDeclaration_copy = isSgMemberFunctionDeclaration(copy);
    1043           0 :      ROSE_ASSERT(memberFunctionDeclaration_copy != NULL);
    1044             : 
    1045             :   // Call the base class fixupCopy member function
    1046             :   // SgFunctionDeclaration::fixupCopy_scopes(copy,help);
    1047             : 
    1048             :   // Setup the scopes of the SgInitializedName objects in the paraleter list
    1049           0 :      ROSE_ASSERT(get_CtorInitializerList() != NULL);
    1050           0 :      get_CtorInitializerList()->fixupCopy_scopes(memberFunctionDeclaration_copy->get_CtorInitializerList(),help);
    1051             : 
    1052             :   // Call the base class fixupCopy member function
    1053           0 :      SgFunctionDeclaration::fixupCopy_scopes(copy,help);
    1054           0 :    }
    1055             : 
    1056             : 
    1057             : void
    1058           0 : SgTemplateDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1059             :    {
    1060             : #if DEBUG_FIXUP_COPY
    1061             :      printf ("\nInside of SgTemplateDeclaration::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1062             : #endif
    1063             : 
    1064           0 :      SgTemplateDeclaration* templateDeclaration_copy = isSgTemplateDeclaration(copy);
    1065           0 :      ROSE_ASSERT(templateDeclaration_copy != NULL);
    1066             : 
    1067           0 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1068             : 
    1069             : #if 1
    1070             :   // I don't think that this applies to the defining declaration...
    1071           0 :      if (this != this->get_definingDeclaration())
    1072             :         {
    1073           0 :           ROSE_ASSERT(templateDeclaration_copy->get_firstNondefiningDeclaration()->get_definingDeclaration() == templateDeclaration_copy->get_definingDeclaration());
    1074             : 
    1075             :        // DQ (10/20/2007): this is a problem with copytest2007_12.C, I think it should not be assered yet.
    1076             :        // We can't assert this yet since this is part fo the copy of the defining declaration within the processing of the non-defining declaration (recurssively called!)
    1077             :        // ROSE_ASSERT(templateDeclaration_copy->get_definingDeclaration()->get_firstNondefiningDeclaration() == templateDeclaration_copy->get_firstNondefiningDeclaration());
    1078             : 
    1079             :        // If we can get to this point then we can perform this additional test
    1080             :        // ROSE_ASSERT(templateDeclaration_copy->get_definingDeclaration()->get_scope() == templateDeclaration_copy->get_firstNondefiningDeclaration()->get_scope() );
    1081             :         }
    1082             : #endif
    1083           0 :    }
    1084             : 
    1085             : 
    1086             : void
    1087           0 : SgTemplateInstantiationDefn::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1088             :    {
    1089             : #if DEBUG_FIXUP_COPY
    1090             :      printf ("Inside of SgTemplateInstantiationDefn::fixupCopy_scopes() for class = %s class definition %p = %s copy = %p \n",this->get_declaration()->get_name().str(),this,this->class_name().c_str(),copy);
    1091             : #endif
    1092             : 
    1093           0 :      ROSE_ASSERT(this->get_declaration() != NULL);
    1094             : 
    1095             :   // Call the base class fixupCopy member function
    1096           0 :      SgClassDefinition::fixupCopy_scopes(copy,help);
    1097           0 :    }
    1098             : 
    1099             : 
    1100             : void
    1101           0 : SgTemplateInstantiationDecl::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1102             :    {
    1103             : #if DEBUG_FIXUP_COPY
    1104             :      printf ("\nIn SgTemplateInstantiationDecl::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1105             : #endif
    1106             : 
    1107           0 :      SgTemplateInstantiationDecl* templateClassDeclaration_copy = isSgTemplateInstantiationDecl(copy);
    1108           0 :      ROSE_ASSERT(templateClassDeclaration_copy != NULL);
    1109             : 
    1110             :   // Also call the base class version of the fixupCopycopy() member function
    1111           0 :      SgClassDeclaration::fixupCopy_scopes(copy,help);
    1112             : 
    1113             : #if 0
    1114             :      if (this->get_templateDeclaration() == NULL)
    1115             :         {
    1116             :           printf ("Error: this = %p = %s name = %s \n",this,this->class_name().c_str(),this->get_name().str());
    1117             :           this->get_file_info()->display("SgTemplateInstantiationDecl::fixupCopy_scopes(): this: debug");
    1118             : 
    1119             :           SgTemplateInstantiationDecl* nondefiningDeclaration = isSgTemplateInstantiationDecl(this->get_firstNondefiningDeclaration());
    1120             :           SgTemplateInstantiationDecl* definingDeclaration    = isSgTemplateInstantiationDecl(this->get_definingDeclaration());
    1121             : 
    1122             :           printf ("this->get_firstNondefiningDeclaration() = %p nondefiningDeclaration = %p \n",this->get_firstNondefiningDeclaration(),nondefiningDeclaration);
    1123             :           printf ("this->get_definingDeclaration()         = %p definingDeclaration    = %p \n",this->get_definingDeclaration(),definingDeclaration);
    1124             :           if (nondefiningDeclaration != NULL)
    1125             :              {
    1126             :                printf ("nondefiningDeclaration->get_templateDeclaration() = %p \n",nondefiningDeclaration->get_templateDeclaration());
    1127             :                if (nondefiningDeclaration->get_templateDeclaration() != NULL)
    1128             :                   {
    1129             :                  // DQ (3/7/2015): This is not the correct place to set this, but this is debugging code.
    1130             :                  // Also this is only an issue to EDG 4.7 and not EDG 4.9; and we are about retire EDG 4.7 support.
    1131             :                  // printf ("WARNING: setting templateDeclaration in SgTemplateInstantiationDecl::fixupCopy_scopes(): this = %p = %s name = %s \n",this,this->class_name().c_str(),this->get_name().str());
    1132             :                  // SgTemplateInstantiationDecl* nondefiningDeclaration = isSgTemplateInstantiationDecl(this->get_firstNondefiningDeclaration());
    1133             :                  // this->set_templateDeclaration(nondefiningDeclaration->get_templateDeclaration());
    1134             :                   }
    1135             :              }
    1136             :           if (definingDeclaration != NULL)
    1137             :              {
    1138             :                printf ("definingDeclaration->get_templateDeclaration() = %p \n",definingDeclaration->get_templateDeclaration());
    1139             :              }
    1140             :         }
    1141             : #endif
    1142           0 :      ROSE_ASSERT(this->get_templateDeclaration() != NULL);
    1143           0 :      ROSE_ASSERT(templateClassDeclaration_copy->get_templateDeclaration() != NULL);
    1144             : 
    1145             :   // FixupCopyDataMemberMacro(templateClassDeclaration_copy,SgTemplateDeclaration,get_templateDeclaration,set_templateDeclaration)
    1146           0 :      FixupCopyDataMemberMacro(templateClassDeclaration_copy,SgTemplateClassDeclaration,get_templateDeclaration,set_templateDeclaration)
    1147             : 
    1148             : #if 0
    1149             :   // DQ (11/6/2007): I have returned to sharing SgTemplateArgument objects, fix this up later.
    1150             : 
    1151             :   // DQ (11/5/2007): Until we use the SgTemplateArgumentList object directly, we have to handl the list explicitly.
    1152             :      SgTemplateArgumentPtrList::const_iterator templateArguments_iterator_original = this->get_templateArguments()->begin();
    1153             :      SgTemplateArgumentPtrList::iterator       templateArguments_iterator_copy     = templateClassDeclaration_copy->get_templateArguments()->begin();
    1154             :      while ( templateArguments_iterator_original != this->get_templateArguments()->end() )
    1155             :         {
    1156             :           ROSE_ASSERT(templateArguments_iterator_original != this->get_templateArguments()->end());
    1157             :           ROSE_ASSERT(templateArguments_iterator_copy     != templateClassDeclaration_copy->get_templateArguments()->end());
    1158             : 
    1159             :           (*templateArguments_iterator_original)->fixupCopy_scopes(*templateArguments_iterator_copy,help);
    1160             : 
    1161             :           templateArguments_iterator_original++;
    1162             :           templateArguments_iterator_copy++;
    1163             :         }
    1164             : #endif
    1165           0 :    }
    1166             : 
    1167             : void
    1168           0 : SgTemplateInstantiationMemberFunctionDecl::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1169             :    {
    1170             : #if DEBUG_FIXUP_COPY
    1171             :      printf ("\nIn SgTemplateInstantiationMemberFunctionDecl::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1172             : #endif
    1173             : 
    1174           0 :      ROSE_ASSERT(this != NULL);
    1175             : #if 0
    1176             :      printf ("\nIn SgTemplateInstantiationMemberFunctionDecl::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1177             : #endif
    1178           0 :      SgTemplateInstantiationMemberFunctionDecl* templateMemberFunctionDeclaration_copy = isSgTemplateInstantiationMemberFunctionDecl(copy);
    1179           0 :      ROSE_ASSERT(templateMemberFunctionDeclaration_copy != NULL);
    1180             : 
    1181             :   // Also call the base class version of the fixupCopycopy() member function
    1182           0 :      SgMemberFunctionDeclaration::fixupCopy_scopes(copy,help);
    1183             : 
    1184           0 :      if (this->get_templateDeclaration() == NULL)
    1185             :         {
    1186           0 :           printf ("this = %p templateMemberFunctionDeclaration_copy = %p name = %s \n",this,templateMemberFunctionDeclaration_copy,this->get_name().str());
    1187             :         }
    1188           0 :      ROSE_ASSERT(this->get_templateDeclaration() != NULL);
    1189           0 :      ROSE_ASSERT(templateMemberFunctionDeclaration_copy->get_templateDeclaration() != NULL);
    1190             : 
    1191             :   // FixupCopyDataMemberMacro(templateMemberFunctionDeclaration_copy,SgTemplateDeclaration,get_templateDeclaration,set_templateDeclaration)
    1192           0 :      FixupCopyDataMemberMacro(templateMemberFunctionDeclaration_copy,SgTemplateMemberFunctionDeclaration,get_templateDeclaration,set_templateDeclaration)
    1193             : 
    1194             : #if 0
    1195             :      printf ("this = %p this->get_templateDeclaration() = %p \n",this,this->get_templateDeclaration());
    1196             :      printf ("templateMemberFunctionDeclaration_copy = %p templateMemberFunctionDeclaration_copy->get_templateDeclaration() = %p \n",
    1197             :           templateMemberFunctionDeclaration_copy,templateMemberFunctionDeclaration_copy->get_templateDeclaration());
    1198             : #endif
    1199             : 
    1200             : #if 0
    1201             :   // DQ (11/6/2007): I have returned to sharing SgTemplateArgument objects, fix this up later.
    1202             : 
    1203             :   // DQ (11/5/2007): Until we use the SgTemplateArgumentList object directly, we have to handl the list explicitly.
    1204             :      SgTemplateArgumentPtrList::const_iterator templateArguments_iterator_original = this->get_templateArguments()->begin();
    1205             :      SgTemplateArgumentPtrList::iterator       templateArguments_iterator_copy     = templateMemberFunctionDeclaration_copy->get_templateArguments()->begin();
    1206             :      while ( templateArguments_iterator_original != this->get_templateArguments()->end() )
    1207             :         {
    1208             :           ROSE_ASSERT(templateArguments_iterator_original != this->get_templateArguments()->end());
    1209             :           ROSE_ASSERT(templateArguments_iterator_copy     != templateMemberFunctionDeclaration_copy->get_templateArguments()->end());
    1210             : 
    1211             :           (*templateArguments_iterator_original)->fixupCopy_scopes(*templateArguments_iterator_copy,help);
    1212             : 
    1213             :           templateArguments_iterator_original++;
    1214             :           templateArguments_iterator_copy++;
    1215             :         }
    1216             : #endif
    1217           0 :    }
    1218             : 
    1219             : 
    1220             : void
    1221           0 : SgTemplateInstantiationFunctionDecl::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1222             :    {
    1223             : #if DEBUG_FIXUP_COPY
    1224             :      printf ("\nIn SgTemplateInstantiationFunctionDecl::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1225             : #endif
    1226             : 
    1227             :   // DQ (12/28/2012): Added asseretion.
    1228           0 :      ROSE_ASSERT(this != NULL);
    1229             : 
    1230             : #if 0
    1231             :      printf ("\nIn SgTemplateInstantiationFunctionDecl::fixupCopy_scopes(): for function = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1232             : #endif
    1233             : 
    1234           0 :      SgTemplateInstantiationFunctionDecl* templateFunctionDeclaration_copy = isSgTemplateInstantiationFunctionDecl(copy);
    1235           0 :      ROSE_ASSERT(templateFunctionDeclaration_copy != NULL);
    1236             : 
    1237             :   // Also call the base class version of the fixupCopycopy() member function
    1238           0 :      SgFunctionDeclaration::fixupCopy_scopes(copy,help);
    1239             : 
    1240           0 :      ROSE_ASSERT(this->get_templateDeclaration() != NULL);
    1241           0 :      ROSE_ASSERT(templateFunctionDeclaration_copy->get_templateDeclaration() != NULL);
    1242             : 
    1243             :   // FixupCopyDataMemberMacro(templateFunctionDeclaration_copy,SgTemplateDeclaration,get_templateDeclaration,set_templateDeclaration)
    1244           0 :      FixupCopyDataMemberMacro(templateFunctionDeclaration_copy,SgTemplateFunctionDeclaration,get_templateDeclaration,set_templateDeclaration)
    1245             : 
    1246             : #if 0
    1247             :   // DQ (11/6/2007): I have returned to sharing SgTemplateArgument objects, fix this up later.
    1248             : 
    1249             :   // DQ (11/5/2007): Until we use the SgTemplateArgumentList object directly, we have to handl the list explicitly.
    1250             :      SgTemplateArgumentPtrList::const_iterator templateArguments_iterator_original = this->get_templateArguments()->begin();
    1251             :      SgTemplateArgumentPtrList::iterator       templateArguments_iterator_copy     = templateFunctionDeclaration_copy->get_templateArguments()->begin();
    1252             :      while ( templateArguments_iterator_original != this->get_templateArguments()->end() )
    1253             :         {
    1254             :           ROSE_ASSERT(templateArguments_iterator_original != this->get_templateArguments()->end());
    1255             :           ROSE_ASSERT(templateArguments_iterator_copy     != templateFunctionDeclaration_copy->get_templateArguments()->end());
    1256             : 
    1257             :           (*templateArguments_iterator_original)->fixupCopy_scopes(*templateArguments_iterator_copy,help);
    1258             : 
    1259             :           templateArguments_iterator_original++;
    1260             :           templateArguments_iterator_copy++;
    1261             :         }
    1262             : #endif
    1263           0 :    }
    1264             : 
    1265             : 
    1266             : void
    1267           3 : SgFunctionDefinition::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1268             :    {
    1269             : #if DEBUG_FIXUP_COPY
    1270             :      printf ("Inside of SgFunctionDefinition::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1271             : #endif
    1272             : 
    1273           3 :      SgFunctionDefinition* functionDefinition_copy = isSgFunctionDefinition(copy);
    1274           3 :      ROSE_ASSERT(functionDefinition_copy != NULL);
    1275             : 
    1276             :   // Setup the scopes of the SgInitializedName objects in the paraleter list
    1277           3 :      ROSE_ASSERT(get_body() != NULL);
    1278           3 :      get_body()->fixupCopy_scopes(functionDefinition_copy->get_body(),help);
    1279             : 
    1280             :   // Call the base class fixupCopy member function
    1281           3 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1282             : 
    1283             :   // printf ("\nLeaving SgFunctionDefinition::fixupCopy_scopes() for %p = %s copy = %p \n\n",this,this->class_name().c_str(),copy);
    1284           3 :    }
    1285             : 
    1286             : void
    1287          23 : SgVariableDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1288             :    {
    1289             : #if DEBUG_FIXUP_COPY
    1290             :      printf ("Inside of SgVariableDeclaration::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1291             : #endif
    1292             : 
    1293             :   // Also call the base class version of the fixupCopycopy() member function
    1294          23 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1295             : 
    1296          23 :      SgVariableDeclaration* variableDeclaration_copy = isSgVariableDeclaration(copy);
    1297          23 :      ROSE_ASSERT(variableDeclaration_copy != NULL);
    1298             : 
    1299             :   // DQ (10/14/2007): Handle the case of a type defined in the base type of the typedef (similar problem for SgVariableDeclaration).
    1300             :   // printf ("this = %p this->get_variableDeclarationContainsBaseTypeDefiningDeclaration() = %s \n",this,this->get_variableDeclarationContainsBaseTypeDefiningDeclaration() ? "true" : "false");
    1301          23 :      if (this->get_variableDeclarationContainsBaseTypeDefiningDeclaration() == true)
    1302             :         {
    1303           0 :           ROSE_ASSERT(variableDeclaration_copy->get_variableDeclarationContainsBaseTypeDefiningDeclaration() == true);
    1304           0 :           SgDeclarationStatement* baseTypeDeclaration_original = this->get_baseTypeDefiningDeclaration();
    1305           0 :           SgDeclarationStatement* baseTypeDeclaration_copy     = variableDeclaration_copy->get_baseTypeDefiningDeclaration();
    1306             : 
    1307             :        // printf ("baseTypeDeclaration_original = %p = %s \n",baseTypeDeclaration_original,baseTypeDeclaration_original->class_name().c_str());
    1308             :        // printf ("baseTypeDeclaration_copy = %p = %s \n",baseTypeDeclaration_copy,baseTypeDeclaration_copy->class_name().c_str());
    1309             : 
    1310             :        // DQ (10/17/2007): This is now fixed!
    1311             :        // I think that calling get_baseTypeDefiningDeclaration() is a problem because it calls compute_baseTypeDefiningDeclaration()
    1312             :        // which uses the symbol table and other infor which is not setup correctly.
    1313             :        // printf ("Need to compute the baseTypeDeclaration_copy better (perhaps we shoul look into the map of copies? \n");
    1314             :        // ROSE_ASSERT(false);
    1315             : 
    1316           0 :           ROSE_ASSERT(baseTypeDeclaration_original != NULL);
    1317           0 :           ROSE_ASSERT(baseTypeDeclaration_copy != NULL);
    1318             : 
    1319             :        // printf ("In SgVariableDeclaration::fixupCopy_scopes(): Calling fixupCopy on %p = %s \n",baseTypeDeclaration_original,baseTypeDeclaration_original->class_name().c_str());
    1320             : 
    1321           0 :           baseTypeDeclaration_original->fixupCopy_scopes(baseTypeDeclaration_copy,help);
    1322             :         }
    1323             : 
    1324          23 :      const SgInitializedNamePtrList & variableList_original = this->get_variables();
    1325          23 :      SgInitializedNamePtrList & variableList_copy           = variableDeclaration_copy->get_variables();
    1326             : 
    1327             :   // printf ("Inside of SgVariableDeclaration::fixupCopy_scopes(): variableList_original.size() = %ld \n",(long)variableList_original.size());
    1328             : 
    1329          23 :      ROSE_ASSERT(variableList_original.size() == variableList_copy.size());
    1330             : 
    1331          23 :      SgInitializedNamePtrList::const_iterator i_original = variableList_original.begin();
    1332          23 :      SgInitializedNamePtrList::iterator i_copy           = variableList_copy.begin();
    1333             : 
    1334             :   // Iterate over both lists to match up the correct pairs of SgInitializedName objects
    1335          46 :      while ( (i_original != variableList_original.end()) && (i_copy != variableList_copy.end()) )
    1336             :         {
    1337             :         //printf ("Looping over the initialized names in the variable declaration variable = %p = %s \n",(*i_copy),(*i_copy)->get_name().str());
    1338          23 :           ROSE_ASSERT ( (*i_copy)->get_declptr() != NULL);
    1339          23 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
    1340             : 
    1341          23 :           i_original++;
    1342          23 :           i_copy++;
    1343             :         }
    1344          23 :    }
    1345             : 
    1346             : void
    1347           0 : SgClassDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1348             :    {
    1349             :   // We need to call the fixupCopy function from the parent of a SgVariableDeclaration because the
    1350             :   // copy function in the parent of the variable declaration sets the parent of the SgVariableDeclaration
    1351             :   // and we need this parent in the fixupCopy function in the SgInitializedName.
    1352             : 
    1353             : #if DEBUG_FIXUP_COPY
    1354             :      printf ("Inside of SgClassDeclaration::fixupCopy_scopes() for class = %s = %p = %s copy = %p (defining = %p firstNondefining = %p) \n",
    1355             :           this->get_name().str(),this,this->class_name().c_str(),copy,this->get_definingDeclaration(),this->get_firstNondefiningDeclaration());
    1356             : #endif
    1357             : 
    1358           0 :      SgClassDeclaration* classDeclaration_copy = isSgClassDeclaration(copy);
    1359           0 :      ROSE_ASSERT(classDeclaration_copy != NULL);
    1360             : 
    1361           0 :      SgClassDefinition* classDefinition_original = this->get_definition();
    1362           0 :      SgClassDefinition* classDefinition_copy     = classDeclaration_copy->get_definition();
    1363             : 
    1364             :   // Call the base class fixupCopy member function
    1365           0 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1366             : 
    1367           0 :      if (isForward() == false)
    1368             :         {
    1369             :        // DQ (12/24/2012): Added assertion (debugging template support).
    1370           0 :           ROSE_ASSERT(classDefinition_original != NULL);
    1371           0 :           ROSE_ASSERT(classDefinition_copy != NULL);
    1372             : 
    1373           0 :           classDefinition_original->fixupCopy_scopes(classDefinition_copy,help);
    1374             :         }
    1375             : 
    1376           0 :      const SgClassDeclaration* classDeclaration_original = isSgClassDeclaration(this);
    1377             : 
    1378             : #if 0
    1379             :      printf ("SgClassDeclaration::fixupCopy_scopes(): classDeclaration_original->get_type()              = %p \n",classDeclaration_original->get_type());
    1380             :      printf ("SgClassDeclaration::fixupCopy_scopes(): classDeclaration_copy->get_type()                  = %p \n",classDeclaration_copy->get_type());
    1381             : #endif
    1382             : 
    1383             :   // DQ (3/15/2014): Check the types since they should be equivalent (setup intermediate variables).
    1384           0 :      SgClassDeclaration* classDeclaration_copy_firstNondefining = isSgClassDeclaration(classDeclaration_copy->get_firstNondefiningDeclaration());
    1385           0 :      SgClassDeclaration* classDeclaration_copy_defining         = isSgClassDeclaration(classDeclaration_copy->get_definingDeclaration());
    1386           0 :      ROSE_ASSERT(classDeclaration_copy_firstNondefining != NULL);
    1387             :   // ROSE_ASSERT(classDeclaration_copy_defining != NULL);
    1388             : 
    1389             :   // DQ (3/15/2014): Check the types since they should be equivalent (setup intermediate variables).
    1390           0 :      SgClassDeclaration* classDeclaration_original_firstNondefining = isSgClassDeclaration(classDeclaration_original->get_firstNondefiningDeclaration());
    1391           0 :      SgClassDeclaration* classDeclaration_original_defining         = isSgClassDeclaration(classDeclaration_original->get_definingDeclaration());
    1392           0 :      ROSE_ASSERT(classDeclaration_original_firstNondefining != NULL);
    1393             :   // ROSE_ASSERT(classDeclaration_original_defining != NULL);
    1394             : 
    1395             : #if 0
    1396             :      printf ("SgClassDeclaration::fixupCopy_scopes(): classDeclaration_copy_firstNondefining->get_type() = %p \n",classDeclaration_copy_firstNondefining->get_type());
    1397             :      printf ("SgClassDeclaration::fixupCopy_scopes(): classDeclaration_copy_defining->get_type()         = %p \n",classDeclaration_copy_defining->get_type());
    1398             : #endif
    1399             : 
    1400           0 :      SgClassType* classType = isSgClassType(classDeclaration_copy->get_type());
    1401           0 :      ROSE_ASSERT(classType != NULL);
    1402             : 
    1403           0 :      if (classDeclaration_copy_firstNondefining->get_type() != classType)
    1404             :         {
    1405             : #if DEBUG_FIXUP_COPY
    1406             :           printf ("   --- Reset the type on the classDeclaration_copy->get_firstNondefiningDeclaration() (to match the type in the copy) \n");
    1407             : #endif
    1408           0 :           classDeclaration_copy_firstNondefining->set_type(classType);
    1409             :         }
    1410             : 
    1411           0 :      if (classDeclaration_copy_defining != NULL && classDeclaration_copy_defining->get_type() != classType)
    1412             :         {
    1413             : #if DEBUG_FIXUP_COPY
    1414             :           printf ("   --- Reset the type on the classDeclaration_copy->get_definingDeclaration() \n");
    1415             : #endif
    1416           0 :           classDeclaration_copy_defining->set_type(classType);
    1417             :         }
    1418             : 
    1419             :   // DQ (3/15/2014): Check the types since they should be equivalent (error checking).
    1420           0 :      if (classDeclaration_copy_defining != NULL)
    1421             :         {
    1422             : #if 0
    1423             :           if (classDeclaration_copy_firstNondefining->get_type() != classDeclaration_copy_defining->get_type())
    1424             :              {
    1425             :                printf ("classDeclaration_copy->get_type()                  = %p = %s \n",classDeclaration_copy->get_type(),classDeclaration_copy->get_type()->class_name().c_str());
    1426             :                printf ("classDeclaration_copy_firstNondefining->get_type() = %p = %s \n",classDeclaration_copy_firstNondefining->get_type(),classDeclaration_copy_firstNondefining->get_type()->class_name().c_str());
    1427             :                printf ("classDeclaration_copy_defining->get_type()         = %p = %s \n",classDeclaration_copy_defining->get_type(),classDeclaration_copy_defining->get_type()->class_name().c_str());
    1428             :              }
    1429             : #endif
    1430           0 :           ROSE_ASSERT(classDeclaration_copy_firstNondefining->get_type() == classDeclaration_copy_defining->get_type());
    1431             :         }
    1432             : 
    1433             :   // DQ (3/17/2014): These types should be equivalent.
    1434             :   // DQ (3/15/2014): Check the types since they should be equivalent.
    1435           0 :      if (classDeclaration_original_defining != NULL)
    1436             :         {
    1437             :        // DQ (3/17/2014): Node that test2005_98.C fails this new test (so issue a warning for now).
    1438           0 :           if (classDeclaration_original_firstNondefining->get_type() != classDeclaration_original_defining->get_type())
    1439             :              {
    1440           0 :                printf ("Warning: Testing of classDeclaration_original: firstNondefining->get_type() != defining->get_type() \n");
    1441             :              }
    1442             :        // ROSE_ASSERT(classDeclaration_original_firstNondefining->get_type() == classDeclaration_original_defining->get_type());
    1443             :         }
    1444             : 
    1445             : #if 0
    1446             :      printf ("Warning: SgClassDeclaration::fixupCopy_scopes(): Need to check the types for equivalence \n");
    1447             :      ROSE_ABORT();
    1448             : #endif
    1449           0 :    }
    1450             : 
    1451             : void
    1452           0 : SgClassDefinition::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1453             :    {
    1454             :   // DQ (10/19/2007): Added support to fixup the base class names
    1455             : 
    1456           0 :      ROSE_ASSERT(this->get_declaration() != NULL);
    1457             : 
    1458             : #if DEBUG_FIXUP_COPY
    1459             :      printf ("Inside of SgClassDefinition::fixupCopy_scopes() for class = %s class definition %p = %s copy = %p \n",this->get_declaration()->get_name().str(),this,this->class_name().c_str(),copy);
    1460             : #endif
    1461             : 
    1462           0 :      SgClassDefinition* classDefinition_copy = isSgClassDefinition(copy);
    1463           0 :      ROSE_ASSERT(classDefinition_copy != NULL);
    1464             : 
    1465           0 :      SgBaseClassPtrList::const_iterator i_original = this->get_inheritances().begin();
    1466           0 :      SgBaseClassPtrList::iterator i_copy           = classDefinition_copy->get_inheritances().begin();
    1467           0 :      ROSE_ASSERT(this->get_inheritances().size() == classDefinition_copy->get_inheritances().size());
    1468             : 
    1469           0 :      while ( (i_original != this->get_inheritances().end()) && (i_copy != classDefinition_copy->get_inheritances().end()) )
    1470             :         {
    1471             :        // Check the parent pointer to make sure it is properly set
    1472           0 :           ROSE_ASSERT( (*i_original)->get_parent() != NULL);
    1473           0 :           ROSE_ASSERT( (*i_original)->get_parent() == this);
    1474             : 
    1475           0 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
    1476             : 
    1477           0 :           (*i_copy)->set_parent(classDefinition_copy);
    1478             : 
    1479           0 :           ROSE_ASSERT( (*i_copy)->get_parent() != NULL);
    1480           0 :           ROSE_ASSERT( (*i_copy)->get_parent() == classDefinition_copy);
    1481             : 
    1482           0 :           i_original++;
    1483           0 :           i_copy++;
    1484             :         }
    1485             : 
    1486           0 :      const SgDeclarationStatementPtrList & statementList_original = this->getDeclarationList();
    1487           0 :      const SgDeclarationStatementPtrList & statementList_copy     = classDefinition_copy->getDeclarationList();
    1488             : 
    1489           0 :      SgDeclarationStatementPtrList::const_iterator j_original = statementList_original.begin();
    1490           0 :      SgDeclarationStatementPtrList::const_iterator j_copy     = statementList_copy.begin();
    1491             : 
    1492             :   // Iterate over both lists to match up the correct pairs of SgStatement objects
    1493           0 :      while ( (j_original != statementList_original.end()) && (j_copy != statementList_copy.end()) )
    1494             :         {
    1495           0 :           (*j_original)->fixupCopy_scopes(*j_copy,help);
    1496             : 
    1497           0 :           j_original++;
    1498           0 :           j_copy++;
    1499             :         }
    1500             : 
    1501             :   // Call the base class fixupCopy member function
    1502           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1503             : 
    1504             :   // printf ("\nLeaving SgClassDefinition::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1505           0 :    }
    1506             : 
    1507             : 
    1508             : void
    1509           0 : SgBaseClass::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1510             :    {
    1511             :   // DQ (10/19/2007): Added support to fixup the base class names
    1512             : 
    1513             : #if DEBUG_FIXUP_COPY
    1514             :      printf ("Inside of SgBaseClass::fixupCopy_scopes() for baseclass = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1515             : #endif
    1516             : 
    1517           0 :      SgBaseClass* baseClass_copy = isSgBaseClass(copy);
    1518           0 :      ROSE_ASSERT(baseClass_copy != NULL);
    1519             : 
    1520           0 :      const SgNonrealBaseClass* nrBaseClass = isSgNonrealBaseClass(this);
    1521           0 :      SgNonrealBaseClass* nrBaseClass_copy = isSgNonrealBaseClass(copy);
    1522             : 
    1523           0 :      if (this->get_base_class() != NULL) {
    1524           0 :        ROSE_ASSERT(baseClass_copy->get_base_class());
    1525             : 
    1526           0 :        ROSE_ASSERT(nrBaseClass == NULL);
    1527           0 :        ROSE_ASSERT(nrBaseClass_copy == NULL);
    1528             : 
    1529           0 :        this->get_base_class()->fixupCopy_scopes(baseClass_copy->get_base_class(),help);
    1530           0 :      } else if (nrBaseClass != NULL) {
    1531           0 :        ROSE_ASSERT(nrBaseClass->get_base_class_nonreal() != NULL);
    1532             : 
    1533           0 :        ROSE_ASSERT(nrBaseClass_copy != NULL);
    1534           0 :        ROSE_ASSERT(nrBaseClass_copy->get_base_class_nonreal() != NULL);
    1535             : 
    1536           0 :        nrBaseClass->get_base_class_nonreal()->fixupCopy_scopes(nrBaseClass_copy->get_base_class_nonreal(),help);
    1537             :      } else {
    1538           0 :        ROSE_ABORT();
    1539             :      }
    1540           0 :    }
    1541             : 
    1542             : 
    1543             : void
    1544           0 : SgLabelStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1545             :    {
    1546             : #if DEBUG_FIXUP_COPY
    1547             :      printf ("Inside of SgLabelStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1548             : #endif
    1549             : 
    1550           0 :      SgLabelStatement* labelStatement_copy = isSgLabelStatement(copy);
    1551           0 :      ROSE_ASSERT(labelStatement_copy != NULL);
    1552             : 
    1553             :   // I don't think there is anything to do here since we already make sure that there is a new SgLabelSymbol
    1554             :   // and it is the SgGotoStatement that has to have it's reference to the label fixed up if the label and the
    1555             :   // goto statement have been copied.
    1556             : 
    1557             :   // DQ (10/25/2007): Added handling for the new explicit scope in SgLabelStatement
    1558           0 :      ROSE_ASSERT(this->hasExplicitScope() == true);
    1559             : 
    1560           0 :      FixupCopyDataMemberMacro(labelStatement_copy,SgScopeStatement,get_scope,set_scope)
    1561             : 
    1562             :   // Make sure that the copy sets the scopes to be the same type
    1563           0 :      ROSE_ASSERT(labelStatement_copy->get_scope()->variantT() == this->get_scope()->variantT());
    1564             : 
    1565             :   // Also call the base class version of the fixupCopycopy() member function
    1566           0 :      SgStatement::fixupCopy_scopes(copy,help);
    1567           0 :    }
    1568             : 
    1569             : void
    1570           0 : SgGotoStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1571             :    {
    1572             : #if DEBUG_FIXUP_COPY
    1573             :      printf ("Inside of SgGotoStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1574             : #endif
    1575             : 
    1576           0 :      SgGotoStatement* gotoStatement_copy = isSgGotoStatement(copy);
    1577           0 :      ROSE_ASSERT(gotoStatement_copy != NULL);
    1578             : 
    1579           0 :      SgLabelStatement* labelStatement_original = get_label();
    1580             : 
    1581           0 :      SgCopyHelp::copiedNodeMapTypeIterator i = help.get_copiedNodeMap().find(labelStatement_original);
    1582             : 
    1583             :   // printf ("Inside of SgGotoStatement::fixupCopy_scopes(): i != help.get_copiedNodeMap().end() = %s \n",(i != help.get_copiedNodeMap().end()) ? "true" : "false");
    1584             : 
    1585             :   // If the declaration is in the map then it is because we have copied it previously
    1586             :   // and thus it should be updated to reflect the copied declaration.
    1587           0 :      if (i != help.get_copiedNodeMap().end())
    1588             :         {
    1589           0 :           SgLabelStatement* labelStatement_copy = isSgLabelStatement(i->second);
    1590           0 :           ROSE_ASSERT(labelStatement_copy != NULL);
    1591           0 :           gotoStatement_copy->set_label(labelStatement_copy);
    1592             :         }
    1593             : 
    1594             :   // Also call the base class version of the fixupCopycopy() member function
    1595           0 :      SgStatement::fixupCopy_scopes(copy,help);
    1596           0 :    }
    1597             : 
    1598             : void
    1599           0 : SgTypedefDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1600             :    {
    1601             :   // We need to call the fixupCopy function from the parent of a SgTypedefDeclaration because the
    1602             :   // copy function in the parent of the variable declaration sets the parent of the SgVariableDeclaration
    1603             :   // and we need this parent in the fixupCopy function in the SgInitializedName.
    1604             : 
    1605             : #if DEBUG_FIXUP_COPY
    1606             :      printf ("Inside of SgTypedefDeclaration::fixupCopy_scopes() for typedef name = %s = %p = %s copy = %p \n",this->get_name().str(),this,this->class_name().c_str(),copy);
    1607             : #endif
    1608             : 
    1609             :   // Call the base class fixupCopy member function
    1610           0 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1611             : 
    1612             : #if 1
    1613           0 :      SgTypedefDeclaration* typedefDeclaration_copy = isSgTypedefDeclaration(copy);
    1614           0 :      ROSE_ASSERT(typedefDeclaration_copy != NULL);
    1615             : 
    1616             :   // DQ (10/14/2007): Handle the case of a type defined in the base type of the typedef (similar problem for SgVariableDeclaration).
    1617           0 :      if (this->get_typedefBaseTypeContainsDefiningDeclaration() == true)
    1618             :         {
    1619           0 :           ROSE_ASSERT(typedefDeclaration_copy->get_typedefBaseTypeContainsDefiningDeclaration() == true);
    1620           0 :           SgDeclarationStatement* baseTypeDeclaration_original = this->get_baseTypeDefiningDeclaration();
    1621           0 :           SgDeclarationStatement* baseTypeDeclaration_copy     = typedefDeclaration_copy->get_baseTypeDefiningDeclaration();
    1622           0 :           ROSE_ASSERT(baseTypeDeclaration_original != NULL);
    1623           0 :           ROSE_ASSERT(baseTypeDeclaration_copy != NULL);
    1624             : 
    1625           0 :           baseTypeDeclaration_original->fixupCopy_scopes(baseTypeDeclaration_copy,help);
    1626             :         }
    1627             :        else
    1628             :         {
    1629           0 :           if (this->get_declaration() != NULL)
    1630             :              {
    1631           0 :                ROSE_ASSERT(typedefDeclaration_copy->get_declaration() != NULL);
    1632           0 :                ROSE_ASSERT(typedefDeclaration_copy->get_declaration() != this->get_declaration());
    1633           0 :                this->get_declaration()->fixupCopy_scopes(typedefDeclaration_copy->get_declaration(),help);
    1634             :              }
    1635             :         }
    1636             : #else
    1637             :      SgTypedefDeclaration* typedefDeclaration_copy = isSgTypedefDeclaration(copy);
    1638             :      ROSE_ASSERT(typedefDeclaration_copy != NULL);
    1639             : 
    1640             :      ROSE_ASSERT(typedefDeclaration_copy->get_typedefBaseTypeContainsDefiningDeclaration() == true);
    1641             :      SgDeclarationStatement* baseTypeDeclaration_original = this->get_baseTypeDefiningDeclaration();
    1642             :      SgDeclarationStatement* baseTypeDeclaration_copy     = typedefDeclaration_copy->get_baseTypeDefiningDeclaration();
    1643             :      ROSE_ASSERT(baseTypeDeclaration_original != NULL);
    1644             :      ROSE_ASSERT(baseTypeDeclaration_copy != NULL);
    1645             : 
    1646             :      baseTypeDeclaration_original->fixupCopy_scopes(baseTypeDeclaration_copy,help);
    1647             : #endif
    1648           0 :    }
    1649             : 
    1650             : 
    1651             : void
    1652           0 : SgEnumDeclaration::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1653             :    {
    1654             : #if DEBUG_FIXUP_COPY
    1655             :      printf ("Inside of SgEnumDeclaration::fixupCopy_scopes() for %p = %s copy = %p (defining = %p firstNondefining = %p) \n",
    1656             :           this,this->class_name().c_str(),copy,this->get_definingDeclaration(),this->get_firstNondefiningDeclaration());
    1657             : #endif
    1658             : 
    1659             :   // Call the base class fixupCopy member function
    1660           0 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1661             : 
    1662           0 :      SgEnumDeclaration* enumDeclaration_copy = isSgEnumDeclaration(copy);
    1663           0 :      ROSE_ASSERT(enumDeclaration_copy != NULL);
    1664             : 
    1665             :   // DQ (10/17/2007): fixup the type used to make sure it has the declaration set the AST copy.
    1666           0 :      SgEnumType* enum_type_original = this->get_type();
    1667           0 :      ROSE_ASSERT(enum_type_original != NULL);
    1668             : 
    1669           0 :      SgEnumType* enum_type_copy = enumDeclaration_copy->get_type();
    1670           0 :      ROSE_ASSERT(enum_type_copy != NULL);
    1671             : 
    1672             :   // printf ("This is the non-defining declaration, so just fixup the SgEnumType = %p with the correct SgEnumDeclaration declaration! \n",enum_type_copy);
    1673             : 
    1674             :   // FixupCopyDataMemberMacro_local_debug(enum_type_copy,SgDeclarationStatement,get_declaration,set_declaration)
    1675           0 :      SgCopyHelp::copiedNodeMapTypeIterator i = help.get_copiedNodeMap().find(enum_type_original->get_declaration());
    1676             :   // printf ("SgCopyHelp::copiedNodeMapTypeIterator i != help.get_copiedNodeMap().end() = %s \n",i != help.get_copiedNodeMap().end() ? "true" : "false");
    1677           0 :      if (i != help.get_copiedNodeMap().end())
    1678             :         {
    1679           0 :           SgNode* associated_node_copy = i->second;
    1680           0 :           ROSE_ASSERT(associated_node_copy != NULL);
    1681           0 :           SgDeclarationStatement* local_copy = isSgDeclarationStatement(associated_node_copy);
    1682           0 :           ROSE_ASSERT(local_copy != NULL);
    1683             :        // printf ("Resetting using local_copy = %p = %s \n",local_copy,local_copy->class_name().c_str());
    1684           0 :           enum_type_copy->set_declaration(local_copy);
    1685             :         }
    1686             : 
    1687             :   // Now reset the enum fields.
    1688           0 :      const SgInitializedNamePtrList & enumFieldList_original = this->get_enumerators();
    1689           0 :      SgInitializedNamePtrList & enumFieldList_copy           = enumDeclaration_copy->get_enumerators();
    1690             : 
    1691           0 :      SgInitializedNamePtrList::const_iterator i_original = enumFieldList_original.begin();
    1692           0 :      SgInitializedNamePtrList::iterator i_copy           = enumFieldList_copy.begin();
    1693             : 
    1694             :   // Iterate over both lists to match up the correct pairs of SgInitializedName objects
    1695           0 :      while ( (i_original != enumFieldList_original.end()) && (i_copy != enumFieldList_copy.end()) )
    1696             :         {
    1697           0 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
    1698             : 
    1699           0 :           i_original++;
    1700           0 :           i_copy++;
    1701             :         }
    1702           0 :    }
    1703             : 
    1704             : 
    1705             : 
    1706             : 
    1707             : void
    1708           0 : SgNamespaceDeclarationStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1709             :    {
    1710             : #if DEBUG_FIXUP_COPY
    1711             :      printf ("Inside of SgNamespaceDeclarationStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1712             : #endif
    1713             : 
    1714             :   // Call the base class fixupCopy member function
    1715           0 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1716             : 
    1717           0 :      SgNamespaceDeclarationStatement* namespaceDeclaration_copy = isSgNamespaceDeclarationStatement(copy);
    1718           0 :      ROSE_ASSERT(namespaceDeclaration_copy != NULL);
    1719             : 
    1720             :   // printf ("namespaceDeclaration_copy->get_firstNondefiningDeclaration() = %p \n",namespaceDeclaration_copy->get_firstNondefiningDeclaration());
    1721           0 :      if (this->get_firstNondefiningDeclaration() == this)
    1722             :         {
    1723             :        // printf ("&&&&& Resetting copy's firstNondefiningDeclaration of SgNamespaceDeclarationStatement to copy \n");
    1724           0 :           namespaceDeclaration_copy->set_firstNondefiningDeclaration(namespaceDeclaration_copy);
    1725             :         }
    1726             : 
    1727           0 :      SgNamespaceDefinitionStatement* namespaceDefinition_original = this->get_definition();
    1728           0 :      SgNamespaceDefinitionStatement* namespaceDefinition_copy     = namespaceDeclaration_copy->get_definition();
    1729             : 
    1730           0 :      ROSE_ASSERT(namespaceDefinition_original != NULL);
    1731           0 :      ROSE_ASSERT(namespaceDefinition_copy != NULL);
    1732             : 
    1733           0 :      namespaceDefinition_original->fixupCopy_scopes(namespaceDefinition_copy,help);
    1734           0 :    }
    1735             : 
    1736             : 
    1737             : void
    1738           0 : SgNamespaceDefinitionStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1739             :    {
    1740             : #if DEBUG_FIXUP_COPY
    1741             :      printf ("Inside of SgNamespaceDefinitionStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1742             : #endif
    1743             : 
    1744           0 :      SgNamespaceDefinitionStatement* namespaceDefinition_copy = isSgNamespaceDefinitionStatement(copy);
    1745           0 :      ROSE_ASSERT(namespaceDefinition_copy != NULL);
    1746             : 
    1747           0 :      FixupCopyDataMemberMacro(namespaceDefinition_copy,SgNamespaceDeclarationStatement,get_namespaceDeclaration,set_namespaceDeclaration)
    1748             : 
    1749           0 :      const SgDeclarationStatementPtrList & statementList_original = this->getDeclarationList();
    1750           0 :      const SgDeclarationStatementPtrList & statementList_copy     = namespaceDefinition_copy->getDeclarationList();
    1751             : 
    1752           0 :      SgDeclarationStatementPtrList::const_iterator i_original = statementList_original.begin();
    1753           0 :      SgDeclarationStatementPtrList::const_iterator i_copy     = statementList_copy.begin();
    1754             : 
    1755             :   // Iterate over both lists to match up the correct pairs of SgStatement objects
    1756           0 :      while ( (i_original != statementList_original.end()) && (i_copy != statementList_copy.end()) )
    1757             :         {
    1758           0 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
    1759             : 
    1760           0 :           i_original++;
    1761           0 :           i_copy++;
    1762             :         }
    1763             : 
    1764             :   // Call the base class fixupCopy member function
    1765           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1766           0 :    }
    1767             : 
    1768             : 
    1769             : void
    1770           0 : SgTemplateInstantiationDirectiveStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1771             :    {
    1772             : #if DEBUG_FIXUP_COPY
    1773             :      printf ("Inside of SgTemplateInstantiationDirectiveStatement::fixupCopy_scopes() for %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    1774             : #endif
    1775             : 
    1776           0 :      SgTemplateInstantiationDirectiveStatement* templateInstantiationDirectiveStatement_copy = isSgTemplateInstantiationDirectiveStatement(copy);
    1777             : 
    1778             :   // Call the base class fixupCopy member function
    1779           0 :      SgDeclarationStatement::fixupCopy_scopes(copy,help);
    1780             : 
    1781           0 :      ROSE_ASSERT(this->get_declaration() != NULL);
    1782             : 
    1783             : #if 0
    1784             :   // DQ (10/15/2007): This is a simpler approach using the map stored in the SgCopyHelp object.
    1785             :      SgCopyHelp::copiedNodeMapTypeIterator i = help.get_copiedNodeMap().find(this->get_declaration());
    1786             :      if (i != help.get_copiedNodeMap().end())
    1787             :         {
    1788             :        // Use the associated value from the map as the scope.
    1789             :           SgNode* node_copy = i->second;
    1790             :           ROSE_ASSERT(node_copy != NULL);
    1791             :           SgDeclarationStatement* declarationStatement_copy = isSgDeclarationStatement(node_copy);
    1792             :           templateInstantiationDirectiveStatement_copy->set_declaration(declarationStatement_copy);
    1793             :         }
    1794             :        else
    1795             :         {
    1796             :        // Else set the scope in the copyDeclarationStatement to be the same as this->get_scope()
    1797             :        // printf ("In SgTemplateInstantiationDirectiveStatement::fixupCopy_scopes() this = %p = %s this->get_parent() = %p = %s \n",
    1798             :        //      this,this->class_name().c_str(),this->get_declaration(),this->get_declaration()->class_name().c_str());
    1799             :           templateInstantiationDirectiveStatement_copy->set_declaration(this->get_declaration());
    1800             :         }
    1801             : #else
    1802           0 :      FixupCopyDataMemberMacro(templateInstantiationDirectiveStatement_copy,SgDeclarationStatement,get_declaration,set_declaration)
    1803             : #endif
    1804             : 
    1805             :   // DQ (11/7/2007): Call fixup on the declaration stored internally (a copy, not shared).
    1806           0 :      SgDeclarationStatement* declaration_copy = templateInstantiationDirectiveStatement_copy->get_declaration();
    1807           0 :      ROSE_ASSERT(declaration_copy != NULL);
    1808           0 :      this->get_declaration()->fixupCopy_scopes(declaration_copy,help);
    1809           0 :    }
    1810             : 
    1811             : 
    1812             : 
    1813             : void
    1814           0 : SgProject::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1815             :    {
    1816             : #if DEBUG_FIXUP_COPY
    1817             :      printf ("Inside of SgProject::fixupCopy_scopes() \n");
    1818             : #endif
    1819             : 
    1820           0 :      SgProject* project_copy = isSgProject(copy);
    1821           0 :      ROSE_ASSERT(project_copy != NULL);
    1822             : 
    1823             :   // Call fixup on all fo the files (SgFile objects)
    1824           0 :      for (int i = 0; i < numberOfFiles(); i++)
    1825             :         {
    1826           0 :           SgFile & file = get_file(i);
    1827           0 :           SgFile & file_copy = project_copy->get_file(i);
    1828           0 :           file.fixupCopy_scopes(&file_copy,help);
    1829             :         }
    1830           0 :    }
    1831             : 
    1832             : void
    1833           0 : SgSourceFile::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1834             :    {
    1835             : #if DEBUG_FIXUP_COPY
    1836             :      printf ("Inside of SgSourceFile::fixupCopy_scopes() \n");
    1837             : #endif
    1838             : 
    1839           0 :      SgSourceFile* file_copy = isSgSourceFile(copy);
    1840           0 :      ROSE_ASSERT(file_copy != NULL);
    1841             : 
    1842             :   // Call fixup on the global scope
    1843           0 :      ROSE_ASSERT(get_globalScope() != NULL);
    1844           0 :      ROSE_ASSERT(file_copy->get_globalScope() != NULL);
    1845           0 :      get_globalScope()->fixupCopy_scopes(file_copy->get_globalScope(),help);
    1846           0 :    }
    1847             : 
    1848             : 
    1849             : 
    1850             : void
    1851           0 : SgIfStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1852             :    {
    1853             : #if DEBUG_FIXUP_COPY
    1854             :      printf ("Inside of SgIfStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1855             : #endif
    1856             : 
    1857             :   // printf ("Inside of SgIfStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1858             : 
    1859             :   // SgStatement::fixupCopy_scopes(copy,help);
    1860           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1861             : 
    1862           0 :      SgIfStmt* ifStatement_copy = isSgIfStmt(copy);
    1863           0 :      ROSE_ASSERT(ifStatement_copy != NULL);
    1864             : 
    1865             :   // The symbol table should not have been setup yet!
    1866             :   // ROSE_ASSERT(ifStatement_copy->get_symbol_table()->size() == 0);
    1867             : 
    1868           0 :      this->get_conditional()->fixupCopy_scopes(ifStatement_copy->get_conditional(),help);
    1869             : 
    1870             : #if 0
    1871             :      ROSE_ASSERT(ifStatement_copy->get_true_body() != NULL);
    1872             :      ROSE_ASSERT(ifStatement_copy->get_true_body()->get_symbol_table() != NULL);
    1873             :      ROSE_ASSERT(ifStatement_copy->get_true_body()->get_symbol_table()->size()  == 0);
    1874             : 
    1875             :      ROSE_ASSERT(ifStatement_copy->get_false_body() != NULL);
    1876             :      ROSE_ASSERT(ifStatement_copy->get_false_body()->get_symbol_table() != NULL);
    1877             :      ROSE_ASSERT(ifStatement_copy->get_false_body()->get_symbol_table()->size()  == 0);
    1878             : 
    1879             :      const SgVariableDeclaration* variableDeclarationCondition = isSgVariableDeclaration(this->get_conditional());
    1880             :      if (variableDeclarationCondition != NULL)
    1881             :         {
    1882             :        // There is a variable declaration in the conditional, it needs to be added to the symbol table.
    1883             :           printf ("There is a variable declaration in the conditional, it needs to be added to the symbol table \n");
    1884             :           ROSE_ABORT();
    1885             :         }
    1886             : #endif
    1887             : 
    1888           0 :      SgStatement* thsTruBody = this->get_true_body();
    1889           0 :      ROSE_ASSERT(thsTruBody != NULL);
    1890           0 :      SgStatement* ifStmtCopyTruBody = ifStatement_copy->get_true_body();
    1891           0 :      ROSE_ASSERT(ifStmtCopyTruBody != NULL);
    1892           0 :      SgScopeStatement* scopeIfStmtCopyTruBody = isSgScopeStatement(ifStmtCopyTruBody);
    1893           0 :      if (scopeIfStmtCopyTruBody != NULL)
    1894             :         {
    1895             :        // DQ (5/21/2013): Restrict direct access to the symbol table.
    1896             :        // ROSE_ASSERT(scopeIfStmtCopyTruBody->get_symbol_table() != NULL);
    1897             :        // ROSE_ASSERT(scopeIfStmtCopyTruBody->get_symbol_table()->size()  == 0);
    1898           0 :           if (scopeIfStmtCopyTruBody->symbol_table_size() != 0)
    1899             :              {
    1900           0 :                printf ("Warning: (fails for g++ 4.2): scopeIfStmtCopyTruBody->symbol_table_size() = %zu \n",scopeIfStmtCopyTruBody->symbol_table_size());
    1901             :             // ifStmtCopyTruBody->get_file_info()->display("ifStatement_copy->get_true_body(): debug");
    1902             :              }
    1903             :        // DQ (3/3/12): This fails for the g++ version 4.2.4 compiler (newer versions of g++ pass fine).
    1904             :        // ROSE_ASSERT(scopeIfStmtCopyTruBody->symbol_table_size() == 0);
    1905             :         }
    1906             : 
    1907             :   // printf ("\nProcess the TRUE body of the SgIfStmt \n\n");
    1908             : 
    1909           0 :      thsTruBody->fixupCopy_scopes(ifStmtCopyTruBody,help);
    1910             : 
    1911           0 :      ROSE_ASSERT((this->get_false_body() != NULL) == (ifStatement_copy->get_false_body() != NULL));
    1912           0 :      if (isSgScopeStatement(ifStatement_copy->get_false_body()) != NULL) {
    1913             :      // DQ (5/21/2013): Restrict direct access to the symbol table.
    1914             :      // ROSE_ASSERT(isSgScopeStatement(ifStatement_copy->get_false_body())->get_symbol_table()->size() == 0);
    1915             :      // ROSE_ASSERT(isSgScopeStatement(ifStatement_copy->get_false_body())->get_symbol_table() != NULL);
    1916           0 :         SgScopeStatement* scopeStmnt = isSgScopeStatement(ifStatement_copy->get_false_body());
    1917           0 :         if (scopeStmnt->symbol_table_size() != 0) {
    1918           0 :            printf ("Warning: (fails for g++ 4.2): isSgScopeStatement(ifStatement_copy->get_false_body())->symbol_table_size() = %zu \n",scopeStmnt->symbol_table_size());
    1919             :         // ifStatement_copy->get_true_body()->get_file_info()->display("ifStatement_copy->get_false_body(): debug");
    1920             :         }
    1921             :      // DQ (3/3/12): This fails for the g++ version 4.2.4 compiler (newer versions of g++ pass fine).
    1922             :      // ROSE_ASSERT(scopeStmnt->symbol_table_size() == 0);
    1923             :      }
    1924             : 
    1925             :   // printf ("\nProcess the FALSE body of the SgIfStmt \n\n");
    1926             : 
    1927           0 :      if (this->get_false_body() != NULL) {
    1928           0 :        this->get_false_body()->fixupCopy_scopes(ifStatement_copy->get_false_body(),help);
    1929             :      }
    1930             : 
    1931             :   // printf ("\nLeaving SgIfStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1932           0 :    }
    1933             : 
    1934             : void
    1935           2 : SgForStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1936             :    {
    1937             : #if DEBUG_FIXUP_COPY
    1938             :      printf ("Inside of SgForStatement::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1939             : #endif
    1940             : 
    1941           2 :      SgForStatement* forStatement_copy = isSgForStatement(copy);
    1942           2 :      ROSE_ASSERT(forStatement_copy != NULL);
    1943             : 
    1944             :   // This could generate a vaiable declaration, so wait to build the sysmbol table.
    1945           2 :      ROSE_ASSERT(this->get_for_init_stmt() != NULL);
    1946           2 :      this->get_for_init_stmt()->fixupCopy_scopes(forStatement_copy->get_for_init_stmt(),help);
    1947             : 
    1948             :   // DQ (11/1/2007): Force the symbol table to be setup so that references can be made to it later.
    1949             :   // If we built it too early then the scope (on The SgInitializedName objects) have not be setup,
    1950             :   // and if we build it too late then we don't have the symbols in place to reset the references.
    1951             :   // printf ("Calling SgScopeStatement::fixupCopy_scopes() \n");
    1952           2 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1953             :   // printf ("DONE: SgScopeStatement::fixupCopy_scopes() \n");
    1954             : 
    1955             :   // This could generate a vaiable declaration, so wait to build the sysmbol table.
    1956           2 :      ROSE_ASSERT(this->get_test() != NULL);
    1957           2 :      this->get_test()->fixupCopy_scopes(forStatement_copy->get_test(),help);
    1958             : 
    1959           2 :      ROSE_ASSERT(this->get_increment() != NULL);
    1960           2 :      this->get_increment()->fixupCopy_scopes(forStatement_copy->get_increment(),help);
    1961             : 
    1962           2 :      ROSE_ASSERT(this->get_loop_body() != NULL);
    1963           2 :      this->get_loop_body()->fixupCopy_scopes(forStatement_copy->get_loop_body(),help);
    1964             : 
    1965             : #if 0
    1966             :   // SgScopeStatement::fixupCopy_scopes(copy,help);
    1967             :      printf ("Calling SgScopeStatement::fixupCopy_scopes() (2nd time) \n");
    1968             :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1969             :      printf ("DONE: SgScopeStatement::fixupCopy_scopes() (2nd time) \n");
    1970             : #endif
    1971           2 :    }
    1972             : 
    1973             : void
    1974           0 : SgRangeBasedForStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    1975             :    {
    1976             : #if DEBUG_FIXUP_COPY
    1977             :      printf ("Inside of SgRangeBasedForStatement::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    1978             : #endif
    1979             : 
    1980           0 :      SgRangeBasedForStatement* forStatement_copy = isSgRangeBasedForStatement(copy);
    1981           0 :      ROSE_ASSERT(forStatement_copy != NULL);
    1982             : 
    1983             :   // This could generate a vaiable declaration, so wait to build the sysmbol table.
    1984           0 :      ROSE_ASSERT(this->get_iterator_declaration() != NULL);
    1985           0 :      this->get_iterator_declaration()->fixupCopy_scopes(forStatement_copy->get_iterator_declaration(),help);
    1986             : 
    1987           0 :      ROSE_ASSERT(this->get_range_declaration() != NULL);
    1988           0 :      this->get_range_declaration()->fixupCopy_scopes(forStatement_copy->get_range_declaration(),help);
    1989             : 
    1990             :   // DQ (11/1/2007): Force the symbol table to be setup so that references can be made to it later.
    1991             :   // If we built it too early then the scope (on The SgInitializedName objects) have not be setup,
    1992             :   // and if we build it too late then we don't have the symbols in place to reset the references.
    1993             :   // printf ("Calling SgScopeStatement::fixupCopy_scopes() \n");
    1994           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    1995             :   // printf ("DONE: SgScopeStatement::fixupCopy_scopes() \n");
    1996             : 
    1997           0 :      ROSE_ASSERT(this->get_begin_declaration() != NULL);
    1998           0 :      this->get_begin_declaration()->fixupCopy_scopes(forStatement_copy->get_begin_declaration(),help);
    1999             : 
    2000           0 :      ROSE_ASSERT(this->get_end_declaration() != NULL);
    2001           0 :      this->get_end_declaration()->fixupCopy_scopes(forStatement_copy->get_end_declaration(),help);
    2002             : 
    2003           0 :      ROSE_ASSERT(this->get_not_equal_expression() != NULL);
    2004           0 :      this->get_not_equal_expression()->fixupCopy_scopes(forStatement_copy->get_not_equal_expression(),help);
    2005             : 
    2006           0 :      ROSE_ASSERT(this->get_increment_expression() != NULL);
    2007           0 :      this->get_increment_expression()->fixupCopy_scopes(forStatement_copy->get_increment_expression(),help);
    2008             : 
    2009           0 :      ROSE_ASSERT(this->get_loop_body() != NULL);
    2010           0 :      this->get_loop_body()->fixupCopy_scopes(forStatement_copy->get_loop_body(),help);
    2011             : 
    2012             : #if 0
    2013             :   // SgScopeStatement::fixupCopy_scopes(copy,help);
    2014             :      printf ("Calling SgScopeStatement::fixupCopy_scopes() (2nd time) \n");
    2015             :      SgScopeStatement::fixupCopy_scopes(copy,help);
    2016             :      printf ("DONE: SgScopeStatement::fixupCopy_scopes() (2nd time) \n");
    2017             : #endif
    2018           0 :    }
    2019             : 
    2020             : void
    2021           2 : SgForInitStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2022             :    {
    2023             : #if DEBUG_FIXUP_COPY
    2024             :      printf ("Inside of SgForInitStatement::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2025             : #endif
    2026             : 
    2027           2 :      SgStatement::fixupCopy_scopes(copy,help);
    2028             : 
    2029           2 :      SgForInitStatement* forStatement_copy = isSgForInitStatement(copy);
    2030           2 :      ROSE_ASSERT(forStatement_copy != NULL);
    2031             : 
    2032             :   // printf ("SgForInitStatement::fixupCopy_scopes(): Sorry not implemented \n");
    2033             : 
    2034           2 :      const SgStatementPtrList & statementList_original = this->get_init_stmt();
    2035           2 :      const SgStatementPtrList & statementList_copy     = forStatement_copy->get_init_stmt();
    2036             : 
    2037           2 :      SgStatementPtrList::const_iterator i_original = statementList_original.begin();
    2038           2 :      SgStatementPtrList::const_iterator i_copy     = statementList_copy.begin();
    2039             : 
    2040             :   // Iterate over both lists to match up the correct pairs of SgStatement objects
    2041           4 :      while ( (i_original != statementList_original.end()) && (i_copy != statementList_copy.end()) )
    2042             :         {
    2043             :         // printf ("In SgForInitStatement::fixupCopy_scopes(): Calling fixup for *i_copy = %p = %s \n",(*i_copy),(*i_copy)->class_name().c_str());
    2044           2 :           (*i_original)->fixupCopy_scopes(*i_copy,help);
    2045             : 
    2046           2 :           i_original++;
    2047           2 :           i_copy++;
    2048             :         }
    2049             : 
    2050             :   // Relavant data member is: SgStatementPtrList        p_init_stmt
    2051           2 :    }
    2052             : 
    2053             : void
    2054           0 : SgCatchStatementSeq::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2055             :    {
    2056             : #if DEBUG_FIXUP_COPY
    2057             :      printf ("Inside of SgCatchStatementSeq::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2058             : #endif
    2059             : 
    2060           0 :      SgStatement::fixupCopy_scopes(copy,help);
    2061             : 
    2062           0 :      SgCatchStatementSeq* catchStatement_copy = isSgCatchStatementSeq(copy);
    2063           0 :      ROSE_ASSERT(catchStatement_copy != NULL);
    2064             : 
    2065           0 :      printf ("SgCatchStatementSeq::fixupCopy_scopes(): Sorry not implemented \n");
    2066             : 
    2067             :   // The relavant data member here is a SgStatementPtrList      p_catch_statement_seq
    2068             : 
    2069             :   // ROSE_ASSERT(this->get_body() != NULL);
    2070             :   // this->get_body()->fixupCopy_scopes(catchStatement_copy->get_body(),help);
    2071           0 :    }
    2072             : 
    2073             : void
    2074           0 : SgWhileStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2075             :    {
    2076             : #if DEBUG_FIXUP_COPY
    2077             :      printf ("Inside of SgWhileStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2078             : #endif
    2079             : 
    2080           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    2081             : 
    2082           0 :      SgWhileStmt* whileStatement_copy = isSgWhileStmt(copy);
    2083           0 :      ROSE_ASSERT(whileStatement_copy != NULL);
    2084             : 
    2085           0 :      ROSE_ASSERT(this->get_condition() != NULL);
    2086           0 :      this->get_condition()->fixupCopy_scopes(whileStatement_copy->get_condition(),help);
    2087             : 
    2088           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2089           0 :      this->get_body()->fixupCopy_scopes(whileStatement_copy->get_body(),help);
    2090           0 :    }
    2091             : 
    2092             : void
    2093           0 : SgDoWhileStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2094             :    {
    2095             : #if DEBUG_FIXUP_COPY
    2096             :      printf ("Inside of SgDoWhileStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2097             : #endif
    2098             : 
    2099           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    2100             : 
    2101           0 :      SgDoWhileStmt* doWhileStatement_copy = isSgDoWhileStmt(copy);
    2102           0 :      ROSE_ASSERT(doWhileStatement_copy != NULL);
    2103             : 
    2104           0 :      ROSE_ASSERT(this->get_condition() != NULL);
    2105           0 :      this->get_condition()->fixupCopy_scopes(doWhileStatement_copy->get_condition(),help);
    2106             : 
    2107           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2108           0 :      this->get_body()->fixupCopy_scopes(doWhileStatement_copy->get_body(),help);
    2109           0 :    }
    2110             : 
    2111             : 
    2112             : void
    2113           0 : SgSwitchStatement::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2114             :    {
    2115             : #if DEBUG_FIXUP_COPY
    2116             :      printf ("Inside of SgSwitchStatement::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2117             : #endif
    2118             : 
    2119           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    2120             : 
    2121           0 :      SgSwitchStatement* switchStatement_copy = isSgSwitchStatement(copy);
    2122           0 :      ROSE_ASSERT(switchStatement_copy != NULL);
    2123             : 
    2124           0 :      ROSE_ASSERT(this->get_item_selector() != NULL);
    2125           0 :      this->get_item_selector()->fixupCopy_scopes(switchStatement_copy->get_item_selector(),help);
    2126             : 
    2127           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2128           0 :      this->get_body()->fixupCopy_scopes(switchStatement_copy->get_body(),help);
    2129           0 :    }
    2130             : 
    2131             : 
    2132             : 
    2133             : void
    2134           0 : SgTryStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2135             :    {
    2136             : #if DEBUG_FIXUP_COPY
    2137             :      printf ("Inside of SgTryStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2138             : #endif
    2139             : 
    2140           0 :      SgStatement::fixupCopy_scopes(copy,help);
    2141             : 
    2142           0 :      SgTryStmt* tryStatement_copy = isSgTryStmt(copy);
    2143           0 :      ROSE_ASSERT(tryStatement_copy != NULL);
    2144             : 
    2145           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2146           0 :      this->get_body()->fixupCopy_scopes(tryStatement_copy->get_body(),help);
    2147           0 :    }
    2148             : 
    2149             : void
    2150           0 : SgCatchOptionStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2151             :    {
    2152             : #if DEBUG_FIXUP_COPY
    2153             :      printf ("Inside of SgCatchOptionStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2154             : #endif
    2155             : 
    2156           0 :      printf ("SgCatchOptionStmt::fixupCopy_scopes(): Sorry not implemented \n");
    2157             : 
    2158           0 :      SgScopeStatement::fixupCopy_scopes(copy,help);
    2159             : 
    2160           0 :      SgCatchOptionStmt* catchOptionStatement_copy = isSgCatchOptionStmt(copy);
    2161           0 :      ROSE_ASSERT(catchOptionStatement_copy != NULL);
    2162             : 
    2163           0 :      ROSE_ASSERT(this->get_trystmt() != NULL);
    2164             :   // I think this might cause endless recursion, so comment out for now!
    2165             :   // this->get_trystmt()->fixupCopy_scopes(catchOptionStatement_copy->get_trystmt(),help);
    2166             : 
    2167           0 :      ROSE_ASSERT(this->get_condition() != NULL);
    2168           0 :      this->get_condition()->fixupCopy_scopes(catchOptionStatement_copy->get_condition(),help);
    2169             : 
    2170           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2171           0 :      this->get_body()->fixupCopy_scopes(catchOptionStatement_copy->get_body(),help);
    2172           0 :    }
    2173             : 
    2174             : void
    2175           0 : SgCaseOptionStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2176             :    {
    2177             : #if DEBUG_FIXUP_COPY
    2178             :      printf ("Inside of SgCaseOptionStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2179             : #endif
    2180             : 
    2181           0 :      SgStatement::fixupCopy_scopes(copy,help);
    2182             : 
    2183           0 :      SgCaseOptionStmt* caseOptionStatement_copy = isSgCaseOptionStmt(copy);
    2184           0 :      ROSE_ASSERT(caseOptionStatement_copy != NULL);
    2185             : 
    2186           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2187           0 :      this->get_body()->fixupCopy_scopes(caseOptionStatement_copy->get_body(),help);
    2188           0 :    }
    2189             : 
    2190             : void
    2191           0 : SgDefaultOptionStmt::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2192             :    {
    2193             : #if DEBUG_FIXUP_COPY
    2194             :      printf ("Inside of SgDefaultOptionStmt::fixupCopy_scopes() this = %p = %s  copy = %p \n",this,this->class_name().c_str(),copy);
    2195             : #endif
    2196             : 
    2197           0 :      SgStatement::fixupCopy_scopes(copy,help);
    2198             : 
    2199           0 :      SgDefaultOptionStmt* defaultOptionStatement_copy = isSgDefaultOptionStmt(copy);
    2200           0 :      ROSE_ASSERT(defaultOptionStatement_copy != NULL);
    2201             : 
    2202           0 :      ROSE_ASSERT(this->get_body() != NULL);
    2203           0 :      this->get_body()->fixupCopy_scopes(defaultOptionStatement_copy->get_body(),help);
    2204           0 :    }
    2205             : 
    2206             : void
    2207           0 : SgTemplateArgument::fixupCopy_scopes(SgNode* copy, SgCopyHelp & help) const
    2208             :    {
    2209           0 :      SgTemplateArgument* templateArgument_copy = isSgTemplateArgument(copy);
    2210           0 :      ROSE_ASSERT(templateArgument_copy != NULL);
    2211             : 
    2212             : #if DEBUG_FIXUP_COPY
    2213             :      printf ("\nIn SgTemplateArgument::fixupCopy_scopes(): this = %p = %s copy = %p \n",this,this->class_name().c_str(),copy);
    2214             : #endif
    2215           0 :    }
    2216             : 
    2217             : 

Generated by: LCOV version 1.14