ROSE  0.11.145.0
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 
51 template <Object otag, typename API> using symref_t = symbol_t<otag> * API::*;
52 
53 template <>
54 struct object_helper<Object::a_namespace> {
57  using type_t = void;
58 
59  using ref_t = void;
60 
61  static constexpr bool is_template_symbol_variant(VariantT v) { return v == false; }
62 };
63 
64 template <>
65 struct object_helper<Object::a_class> {
66  using decl_t = SgClassDeclaration;
67  using symbol_t = SgClassSymbol;
68  using type_t = SgClassType;
69 
70  using ref_t = type_t;
71 
72  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateClassSymbol; }
73 };
74 
75 template <>
76 struct object_helper<Object::a_typedef> {
78  using symbol_t = SgTypedefSymbol;
79  using type_t = SgTypedefType;
80 
81  using ref_t = type_t;
82 
83  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateTypedefSymbol; }
84 };
85 
86 template <>
87 struct object_helper<Object::a_variable> {
89  using symbol_t = SgVariableSymbol;
90  using type_t = void;
91 
92  using ref_t = SgVarRefExp;
93 
94  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateVariableSymbol; }
95 };
96 
97 template <>
98 struct object_helper<Object::a_function> {
100  using symbol_t = SgFunctionSymbol;
101  using type_t = void;
102 
103  using ref_t = SgFunctionRefExp;
104 
105  static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateFunctionSymbol || v == V_SgTemplateMemberFunctionSymbol; }
106 };
107 
108 } }
109 
110 #endif
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
permits to gather types and symbols to extract an API from a set of headers.
Definition: API.h:17
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
symbol_t< otag > *API::* symref_t
Pointer to an API member /tparam otag an Object kind /tparam API.
Definition: Object.h:51
This class represents the concept of a namespace name within the compiler.
This class represents the notion of a typedef declaration.
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.