Program Listing for File resetParentPointers.h

Program Listing for File resetParentPointers.h#

Return to documentation for file (src/frontend/SageIII/astPostProcessing/resetParentPointers.h)

#ifndef RESET_PARENT_POINTERS_H
#define RESET_PARENT_POINTERS_H

 // DQ (3/4/2003)
 void resetParentPointers ( SgNode* node, SgNode* parent = NULL );

#if 0
 // DQ (3/4/2003)
void resetParentPointers ( SgFile* node ) ROSE_DEPRECATED_FUNCTION;
#endif

/*
  All fixes implemented in this file are temporary.
  Changes necessary to remove it are:
  - ROSE/ROSETTA/Grammar/Support.code : remove: temporaryAstFixes(this);
  - ROSE/SAGE/Makefile.am : remove AstFixes.h and AstFixes.C
  - ROSE/SAGE/AstFixes.[hC] : remove files
*/

// *******************************************************************************************
// DQ (3/5/2003): Need to have this in the header file so that the static member data
// modifiedNodeInformationList can be accessed within ROSE translators (this might change later).
// *******************************************************************************************
#include "AstNodeVisitMapping.h"

class ResetParentPointersInheritedAttribute
   {
     public:

          ResetParentPointersInheritedAttribute(): parentNode(NULL) {}

       // DQ (8/1/2019): Copy constructor.
          ResetParentPointersInheritedAttribute(const ResetParentPointersInheritedAttribute & X ) { parentNode = X.parentNode; }

          SgNode* parentNode;
   };

class ResetParentPointers : public SgTopDownProcessing<ResetParentPointersInheritedAttribute>
   {
     public:
       // static std::list<std::string> modifiedNodeInformationList;

          ResetParentPointersInheritedAttribute
               evaluateInheritedAttribute(SgNode* node, ResetParentPointersInheritedAttribute inheritedAttribute);

          void traceBackToRoot ( SgNode* node );

          void resetParentPointersInType (SgType* typeNode, SgNode* previousNode );

          void resetParentPointersInDeclaration (SgDeclarationStatement* declaration, SgNode* inputParent);

          void resetParentPointersInTemplateArgumentList ( const SgTemplateArgumentPtrList& templateArgList );
   };


void topLevelResetParentPointer ( SgNode* node );


void resetParentPointersOfClassOrNamespaceDeclarations ( SgNode* node );

class ResetParentPointersOfClassAndNamespaceDeclarations : public SgSimpleProcessing
   {
     public:
          void visit (SgNode* node);
   };


void resetFileInfoParentPointersInMemoryPool();

class ResetFileInfoParentPointersInMemoryPool : public ROSE_VisitTraversal
   {
     public:
          virtual ~ResetFileInfoParentPointersInMemoryPool() {};

          void visit (SgNode* node);
   };

// DQ (8/23/2012): Modified to take a SgNode so that we could compute the global scope for use in setting
// parents of template instantiations that have not be placed into the AST but exist in the memory pool.
// void resetParentPointersInMemoryPool();
void resetParentPointersInMemoryPool(SgNode* node);

class ResetParentPointersInMemoryPool : public ROSE_VisitTraversal
   {
     public:
          SgGlobal* globalScope;

       // DQ (8/23/2012): Added a constructor to take SgGlobal so that we will have it available to use
       // for setting parents of SgTemplateInstatiations that are not in the AST but in the memory pool.
          ResetParentPointersInMemoryPool(SgGlobal* n) : globalScope(n) {};

          virtual ~ResetParentPointersInMemoryPool() {};
          void visit (SgNode* node);
   };

// endif for RESET_PARENT_POINTERS_H
#endif