ROSE 0.11.145.147
Object.h
1#ifndef ROSE_CodeGen_Object_H
2#define ROSE_CodeGen_Object_H
3#include <RoseFirst.h>
4
5// FIXME it is a problem with MSVC ("cannot access protected member")
6//#include "Rose/Traits/Describe.h"
7#include "sage3basic.hhh"
8
9namespace Rose { namespace CodeGen {
10
12enum class Object {
13 a_namespace,
14 a_class,
15 a_typedef,
16 a_variable,
17 a_function
18};
19
20template <Object otag>
22
27template <Object otag> using symbol_t = typename object_helper<otag>::symbol_t;
28
33template <Object otag> using reference_t = typename object_helper<otag>::ref_t;
34
39template <Object otag> using declaration_t = typename object_helper<otag>::decl_t;
40
46
52template <Object otag, typename API> using symref_t = symbol_t<otag> * API::*;
53
54template <>
55struct object_helper<Object::a_namespace> {
58 using type_t = void;
59
60 using ref_t = void;
61
62 static constexpr bool is_template_symbol_variant(VariantT v) { return v == false; }
63};
64
65template <>
66struct object_helper<Object::a_class> {
68 using symbol_t = SgClassSymbol;
69 using type_t = SgClassType;
70
71 using ref_t = type_t;
72
73 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateClassSymbol; }
74};
75
76template <>
77struct object_helper<Object::a_typedef> {
80 using type_t = SgTypedefType;
81
82 using ref_t = type_t;
83
84 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateTypedefSymbol; }
85};
86
87template <>
88struct object_helper<Object::a_variable> {
91 using type_t = void;
92
93 using ref_t = SgVarRefExp;
94
95 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateVariableSymbol; }
96};
97
98template <>
99struct object_helper<Object::a_function> {
102 using type_t = void;
103
104 using ref_t = SgFunctionRefExp;
105
106 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateFunctionSymbol || v == V_SgTemplateMemberFunctionSymbol; }
107};
108
109} }
110
111#endif
permits to gather types and symbols to extract an API from a set of headers.
Definition API.h:17
This class represents the concept of a class declaration statement. It includes the concept of an ins...
This class represents the concept of a class name within the compiler.
This class represents the concept of a function declaration statement.
This class represents the function being called and must be assembled in the SgFunctionCall with the ...
This class represents the concept of a C++ namespace declaration.
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 variable refernece in expressions.
This class represents the concept of a C or C++ variable declaration.
This class represents the concept of a variable name within the compiler (a shared container for the ...
typename object_helper< otag >::symbol_t symbol_t
The SgSymbol specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:27
symbol_t< otag > *API::* symref_t
Pointer to an API member /tparam otag an Object kind /tparam API.
Definition Object.h:52
typename object_helper< otag >::decl_t declaration_t
The SgDeclarationStatement specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:39
typename object_helper< otag >::ref_t reference_t
The SgReference specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:33
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:45
Object
The five kind of objects manipulated by Rose::CodeGen::API and associated Rose::CodeGen::Factory.
Definition Object.h:12
The ROSE library.