ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fixupCopy.h
Go to the documentation of this file.
1 // DQ (10/15/2007): This controls the output of debugging information within the fixupCopy() member function of many IR nodes.
2 // These member functions are used to handle custom IR node specific details of correcting references made by the AST copy
3 // mechanism between the original AST and the copy of the AST.
4 // DQ (11/29/2009): Note that MSVC does not support use of "false" in macros, so use "0" instead.
5 #define DEBUG_FIXUP_COPY 0
6 #define DEBUG_FIXUP_COPY_OUTPUT_MAP 0
7 
8 void outputMap ( SgCopyHelp & help );
9 
10 // DQ (10/16/2007): This is a macro to simplify the code associated with fixing up data member in the AST copy.
11 #if DEBUG_FIXUP_COPY
12 #define FixupCopyDataMemberMacro(IR_node_copy,IR_node_type,get_accessFunctionName,set_accessFunctionName) \
13  ROSE_ASSERT(this != NULL); \
14  if (IR_node_copy->get_accessFunctionName() == this->get_accessFunctionName()) \
15  { \
16  SgCopyHelp::copiedNodeMapTypeIterator i = help.get_copiedNodeMap().find(this->get_accessFunctionName()); \
17  printf ("SgCopyHelp::copiedNodeMapTypeIterator i != help.get_copiedNodeMap().end() = %s (using %s()) \n",i != help.get_copiedNodeMap().end() ? "true" : "false",#get_accessFunctionName); \
18  if (i != help.get_copiedNodeMap().end()) \
19  { \
20  SgNode* associated_node_copy = i->second; \
21  ROSE_ASSERT(associated_node_copy != NULL); \
22  IR_node_type* local_copy = is##IR_node_type(associated_node_copy); \
23  ROSE_ASSERT(local_copy != NULL); \
24  printf ("Resetting using %s->%s(local_copy) = %p = %s \n",#IR_node_copy,#set_accessFunctionName,local_copy,local_copy->class_name().c_str()); \
25  IR_node_copy->set_accessFunctionName(local_copy); \
26  } \
27  ROSE_ASSERT(IR_node_copy != NULL); \
28  ROSE_ASSERT(IR_node_copy->get_accessFunctionName() != NULL); \
29  ROSE_ASSERT(this->get_accessFunctionName() != NULL); \
30  ROSE_ASSERT(IR_node_copy->get_accessFunctionName()->variantT() == this->get_accessFunctionName()->variantT()); \
31  } \
32  else \
33  { \
34  printf ("%s->%s() = %p != this->%s() = %p (so %s is already set for %p) \n",#IR_node_copy,#get_accessFunctionName,IR_node_copy,#get_accessFunctionName,this,#get_accessFunctionName,IR_node_copy); \
35  }
36 #else
37 #define FixupCopyDataMemberMacro(IR_node_copy,IR_node_type,get_accessFunctionName,set_accessFunctionName) \
38  if (IR_node_copy->get_accessFunctionName() == this->get_accessFunctionName()) \
39  { \
40  SgCopyHelp::copiedNodeMapTypeIterator i = help.get_copiedNodeMap().find(this->get_accessFunctionName()); \
41  if (i != help.get_copiedNodeMap().end()) \
42  { \
43  SgNode* associated_node_copy = i->second; \
44  ROSE_ASSERT(associated_node_copy != NULL); \
45  IR_node_type* local_copy = is##IR_node_type(associated_node_copy); \
46  ROSE_ASSERT(local_copy != NULL); \
47  IR_node_copy->set_accessFunctionName(local_copy); \
48  } \
49  ROSE_ASSERT(IR_node_copy->get_accessFunctionName()->variantT() == this->get_accessFunctionName()->variantT()); \
50  }
51 #endif
52