ROSE 0.11.145.354
Object.h
1#ifndef ROSE_Source_Generation_Object_H
2#define ROSE_Source_Generation_Object_H
3
4#include <RoseFirst.h>
5
6// FIXME it is a problem with MSVC ("cannot access protected member")
7//#include "Rose/Traits/Describe.h"
8#include "sage3basic.hhh"
9
10namespace Rose { namespace Source { namespace Generation {
11
13enum class Object {
14 a_namespace,
15 a_class,
16 a_typedef,
17 a_variable,
18 a_function
19};
20
21template <Object otag>
23
28template <Object otag> using symbol_t = typename object_helper<otag>::symbol_t;
29
34template <Object otag> using reference_t = typename object_helper<otag>::ref_t;
35
40template <Object otag> using declaration_t = typename object_helper<otag>::decl_t;
41
47
53
59template <Object otag, typename API> using symref_t = symbol_t<otag> * API::*;
60
61template <>
62struct object_helper<Object::a_namespace> {
65 using type_t = void;
66
67 using ref_t = void;
68
69 static constexpr bool is_template_symbol_variant(VariantT v) { return v == false; }
71};
72
73template <>
74struct object_helper<Object::a_class> {
76 using symbol_t = SgClassSymbol;
77 using type_t = SgClassType;
78
79 using ref_t = type_t;
80
81 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateClassSymbol; }
83};
84
85template <>
86struct object_helper<Object::a_typedef> {
89 using type_t = SgTypedefType;
90
91 using ref_t = type_t;
92
93 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateTypedefSymbol; }
95};
96
97template <>
98struct object_helper<Object::a_variable> {
101 using type_t = void;
102
103 using ref_t = SgVarRefExp;
104
105 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateVariableSymbol; }
107 SgInitializedName * iname = d->get_variables()[0];
109 }
110};
111
112template <>
113struct object_helper<Object::a_function> {
116 using type_t = void;
117
118 using ref_t = SgFunctionRefExp;
119
120 static constexpr bool is_template_symbol_variant(VariantT v) { return v == V_SgTemplateFunctionSymbol || v == V_SgTemplateMemberFunctionSymbol; }
122};
123
124} } }
125
126#endif /* ROSE_Source_Generation_Object_H */
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 >::ref_t reference_t
The SgReference specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:34
Object
The five kind of objects manipulated by Rose::CodeGen::API and associated Rose::CodeGen::Factory.
Definition Object.h:13
symbol_t< otag > *API::* symref_t
Pointer to an API member /tparam otag an Object kind /tparam API.
Definition Object.h:59
typename object_helper< otag >::decl_t declaration_t
The SgDeclarationStatement specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:40
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:52
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:46
typename object_helper< otag >::symbol_t symbol_t
The SgSymbol specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:28
The ROSE library.