ROSE 0.11.145.247
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
52
58template <Object otag, typename API> using symref_t = symbol_t<otag> * API::*;
59
60template <>
61struct object_helper<Object::a_namespace> {
64 using type_t = void;
65
66 using ref_t = void;
67
68 static constexpr bool is_template_symbol_variant(VariantT v) { return v == false; }
70};
71
72template <>
73struct object_helper<Object::a_class> {
75 using symbol_t = SgClassSymbol;
76 using type_t = SgClassType;
77
78 using ref_t = type_t;
79
80 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateClassSymbol; }
82};
83
84template <>
85struct object_helper<Object::a_typedef> {
88 using type_t = SgTypedefType;
89
90 using ref_t = type_t;
91
92 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateTypedefSymbol; }
94};
95
96template <>
97struct object_helper<Object::a_variable> {
100 using type_t = void;
101
102 using ref_t = SgVarRefExp;
103
104 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateVariableSymbol; }
106 SgInitializedName * iname = d->get_variables()[0];
108 }
109};
110
111template <>
112struct object_helper<Object::a_function> {
115 using type_t = void;
116
117 using ref_t = SgFunctionRefExp;
118
119 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateFunctionSymbol || v == V_SgTemplateMemberFunctionSymbol; }
121};
122
123} }
124
125#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.
SgSymbol * search_for_symbol_from_symbol_table() const
User interface for retrieving the associated symbol from the declaration.
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 notion of a declared variable.
SgSymbol * search_for_symbol_from_symbol_table() const
User interface for retrieving the associated symbol. It searches through the possible chain of prev_d...
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.
const SgInitializedNamePtrList & get_variables() const
Access function for p_variables.
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:58
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
constexpr auto search_for_symbol_from_symbol_table
This function returns the symbol associated with a declaration /tparam otag an Object kind.
Definition Object.h:51
The ROSE library.