3
3
4
4
#include " chimera/binding.h"
5
5
6
+ #include < map>
7
+ #include < memory>
8
+ #include < set>
6
9
#include < clang/AST/DeclBase.h>
7
10
#include < clang/AST/Mangle.h>
8
11
#include < clang/Frontend/CompilerInstance.h>
9
- #include < map>
10
- #include < memory>
11
12
#include < mstch/mstch.hpp>
12
- #include < set>
13
13
#include < yaml-cpp/yaml.h>
14
14
15
15
namespace chimera
@@ -23,9 +23,8 @@ class Function;
23
23
class Variable ;
24
24
class Namespace ;
25
25
26
- } // mstch
27
- } // chimera
28
-
26
+ } // namespace mstch
27
+ } // namespace chimera
29
28
30
29
namespace chimera
31
30
{
@@ -35,13 +34,13 @@ class CompiledConfiguration;
35
34
class Configuration
36
35
{
37
36
public:
38
- Configuration (const Configuration&) = delete ;
39
- Configuration &operator =(const Configuration&) = delete ;
37
+ Configuration (const Configuration &) = delete ;
38
+ Configuration &operator =(const Configuration &) = delete ;
40
39
41
40
/* *
42
41
* Get the chimera configuration singleton for this process.
43
42
*/
44
- static Configuration& GetInstance ();
43
+ static Configuration & GetInstance ();
45
44
46
45
/* *
47
46
* Load the specified file to use as the YAML configuration.
@@ -81,28 +80,28 @@ class Configuration
81
80
/* *
82
81
* Process the configuration settings against the current AST.
83
82
*/
84
- std::unique_ptr<CompiledConfiguration>
85
- Process ( clang::CompilerInstance *ci) const ;
83
+ std::unique_ptr<CompiledConfiguration> Process (
84
+ clang::CompilerInstance *ci) const ;
86
85
87
86
/* *
88
87
* Get the root node of the YAML configuration structure.
89
88
*/
90
- const YAML::Node& GetRoot () const ;
89
+ const YAML::Node & GetRoot () const ;
91
90
92
91
/* *
93
92
* Get the filename of the loaded YAML configuration file, if it exists.
94
93
*/
95
- const std::string& GetConfigFilename () const ;
94
+ const std::string & GetConfigFilename () const ;
96
95
97
96
/* *
98
97
* Get the desired output path for bindings.
99
98
*/
100
- const std::string& GetOutputPath () const ;
99
+ const std::string & GetOutputPath () const ;
101
100
102
101
/* *
103
102
* Get the desired output python module name for top-level binding.
104
103
*/
105
- const std::string& GetOutputModuleName () const ;
104
+ const std::string & GetOutputModuleName () const ;
106
105
107
106
private:
108
107
Configuration ();
@@ -123,14 +122,14 @@ class CompiledConfiguration
123
122
{
124
123
public:
125
124
virtual ~CompiledConfiguration ();
126
- CompiledConfiguration (const CompiledConfiguration&) = delete ;
127
- CompiledConfiguration &operator =(const CompiledConfiguration&) = delete ;
125
+ CompiledConfiguration (const CompiledConfiguration &) = delete ;
126
+ CompiledConfiguration &operator =(const CompiledConfiguration &) = delete ;
128
127
129
128
/* *
130
129
* Adds a namespace to an ordered set of traversed namespaces.
131
130
* This set can later be rendered in a template.
132
131
*/
133
- void AddTraversedNamespace (const clang::NamespaceDecl* decl);
132
+ void AddTraversedNamespace (const clang::NamespaceDecl * decl);
134
133
135
134
/* *
136
135
* Return list of namespace declarations that should be included.
@@ -139,24 +138,25 @@ class CompiledConfiguration
139
138
* is desirable since parent namespaces will naturally be lexically
140
139
* ordered before their children.
141
140
*/
142
- const std::set<const clang::NamespaceDecl*>& GetNamespacesIncluded () const ;
141
+ const std::set<const clang::NamespaceDecl *> & GetNamespacesIncluded () const ;
143
142
144
143
/* *
145
144
* Returns list of namespace declarations that should be skipped.
146
145
*/
147
- const std::set<const clang::NamespaceDecl*>& GetNamespacesSuppressed () const ;
146
+ const std::set<const clang::NamespaceDecl *> &GetNamespacesSuppressed ()
147
+ const ;
148
148
149
149
/* *
150
150
* Get the YAML configuration associated with a specific declaration,
151
151
* or return an empty YAML node if no configuration was found.
152
152
*/
153
- const YAML::Node& GetDeclaration (const clang::Decl *decl) const ;
153
+ const YAML::Node & GetDeclaration (const clang::Decl *decl) const ;
154
154
155
155
/* *
156
156
* Get the YAML configuration associated with a specific qualified type,
157
157
* or return an empty YAML node if no configuration was found.
158
158
*/
159
- const YAML::Node& GetType (const clang::QualType type) const ;
159
+ const YAML::Node & GetType (const clang::QualType type) const ;
160
160
161
161
/* *
162
162
* Gets the compiler instance used by this configuration.
@@ -198,7 +198,8 @@ class CompiledConfiguration
198
198
199
199
/* *
200
200
* Render a particular mstch template based on some declaration.
201
- * This context must contain a "mangled_name" from which to create the filename.
201
+ * This context must contain a "mangled_name" from which to create the
202
+ * filename.
202
203
*/
203
204
bool Render (const std::shared_ptr<chimera::mstch::CXXRecord> context);
204
205
bool Render (const std::shared_ptr<chimera::mstch::Enum> context);
@@ -220,13 +221,13 @@ class CompiledConfiguration
220
221
chimera::binding::Definition bindingDefinition_;
221
222
clang::CompilerInstance *ci_;
222
223
std::vector<std::pair<const clang::QualType, YAML::Node>> types_;
223
- std::map<const clang::Decl*, YAML::Node> declarations_;
224
- std::set<const clang::NamespaceDecl*> namespacesIncluded_;
225
- std::set<const clang::NamespaceDecl*> namespacesSuppressed_;
224
+ std::map<const clang::Decl *, YAML::Node> declarations_;
225
+ std::set<const clang::NamespaceDecl *> namespacesIncluded_;
226
+ std::set<const clang::NamespaceDecl *> namespacesSuppressed_;
226
227
227
228
std::vector<std::string> binding_names_;
228
229
std::vector<std::shared_ptr<chimera::mstch::Namespace>> binding_namespaces_;
229
- std::set<const clang::NamespaceDecl*> binding_namespace_decls_;
230
+ std::set<const clang::NamespaceDecl *> binding_namespace_decls_;
230
231
231
232
friend class Configuration ;
232
233
};
0 commit comments