Rose2xaif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AssignmentLHSTypeTraversal.hpp
Go to the documentation of this file.
1 #ifndef _ASSIGNMENTLHSTYPETRAVERSAL_HPP_
2 #define _ASSIGNMENTLHSTYPETRAVERSAL_HPP_
3 
4 #include <fstream>
5 #include <set>
6 #include "util/Utils.hpp"
9 
10 
11 namespace rose2xaif {
12  namespace SgXAIF {
13  class SynthesizedTypeInfo: public SgSynthesizedAttribute {
14  public:
16  {type = 0;}
18  {}
19  void add(int value=1){
20  type +=value;
21  }
22  void subtract(int value=-1){
23  type-=value;
24  }
25  int getType(){
26  return type;
27  }
28  void setType(int value){
29  type = value;
30  }
32  return (type>0);
33  }
35  return !isPointerAssignement();
36  }
37  /*
38  * Type is an integer that holds the number of 'ranks' an expression is removed from being a scalar
39  * For a scalar, type is 0.
40  * For a pointer to a scalar type is 1.
41  * For a pointer to a pointer, the type is one plus the type of the pointee.
42  * For expressions, the type is determined by the operators on the SgVarRefExp. For example,
43  * applying the & operator to a scalar increments its type by 1.
44  */
45  private:
46  int type;
47  };
48 
49  class AssignmentLHSTypeTraversal : public SgBottomUpProcessing<SynthesizedTypeInfo> {
50  public:
51  SynthesizedTypeInfo evaluateSynthesizedAttribute(SgNode*, SynthesizedAttributesList st);
52  SynthesizedTypeInfo determineTypeOf(SgVarRefExp* theVarRefExp_p, SynthesizedAttributesList st);
53  //int getPointerSymbolRank(SgVariableSymbol * theSgVariableSymbol_p);
54  };
55 
56  }
57 }
58 #endif