ROSE  0.11.83.1
Object.h
1 #ifndef Rose_CodeGen_Object_h
2 #define Rose_CodeGen_Object_h
3 
4 // FIXME it is a problem with MSVC ("cannot access protected member")
5 //#include "Rose/Traits/Describe.h"
6 #include "sage3basic.hhh"
7 
8 namespace Rose { namespace CodeGen {
9 
11 enum class Object {
12  a_namespace,
13  a_class,
14  a_typedef,
15  a_variable,
16  a_function
17 };
18 
19 template <Object otag>
21 
26 template <Object otag> using symbol_t = typename object_helper<otag>::symbol_t;
27 
32 template <Object otag> using reference_t = typename object_helper<otag>::ref_t;
33 
38 template <Object otag> using declaration_t = typename object_helper<otag>::decl_t;
39 
45 
46 template <>
47 struct object_helper<Object::a_namespace> {
50  using type_t = void;
51 
52  using ref_t = void;
53 
54  static constexpr bool is_template_symbol_variant(VariantT v) { return v == false; }
55 };
56 
57 template <>
58 struct object_helper<Object::a_class> {
59  using decl_t = SgClassDeclaration;
60  using symbol_t = SgClassSymbol;
61  using type_t = SgClassType;
62 
63  using ref_t = type_t;
64 
65  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateClassSymbol; }
66 };
67 
68 template <>
69 struct object_helper<Object::a_typedef> {
70  using decl_t = SgClassDeclaration;
71  using symbol_t = SgTypedefSymbol;
72  using type_t = SgTypedefType;
73 
74  using ref_t = type_t;
75 
76  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateTypedefSymbol; }
77 };
78 
79 template <>
80 struct object_helper<Object::a_variable> {
82  using symbol_t = SgVariableSymbol;
83  using type_t = void;
84 
85  using ref_t = SgVarRefExp;
86 
87  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateVariableSymbol; }
88 };
89 
90 template <>
91 struct object_helper<Object::a_function> {
93  using symbol_t = SgFunctionSymbol;
94  using type_t = void;
95 
96  using ref_t = SgFunctionRefExp;
97 
98  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateFunctionSymbol || v == V_SgTemplateMemberFunctionSymbol; }
99 };
100 
101 } }
102 
103 #endif /* Rose_CodeGen_Object_h */
This class represents the concept of a class declaration statement. It includes the concept of an ins...
constexpr auto is_template_symbol_variant
This function returns whether the node variant is a template symbol for an Object kind /tparam otag a...
Definition: Object.h:44
This class represents the concept of a class name within the compiler.
This class represents the concept of a function declaration statement.
typename object_helper< otag >::symbol_t symbol_t
The SgSymbol specialization for an Object kind /tparam otag an Object kind.
Definition: Object.h:26
Main namespace for the ROSE library.
Object
The five kind of objects manipulated by Rose::CodeGen::API and associated Rose::CodeGen::Factory.
Definition: Object.h:11
This class represents the concept of a namespace name within the compiler.
This class represents the concept of a variable name within the compiler (a shared container for the ...
This class represents the concept of a C++ namespace declaration.
typename object_helper< otag >::decl_t declaration_t
The SgDeclarationStatement specialization for an Object kind /tparam otag an Object kind...
Definition: Object.h:38
This class represents the variable refernece in expressions.
This class represents the function being called and must be assembled in the SgFunctionCall with the ...
typename object_helper< otag >::ref_t reference_t
The SgReference specialization for an Object kind /tparam otag an Object kind.
Definition: Object.h:32
This class represents the concept of a C or C++ variable declaration.