@@ -21,15 +21,14 @@ namespace Cpp {
21
21
using TCppFunction_t = void *;
22
22
using TCppConstFunction_t = const void *;
23
23
using TCppFuncAddr_t = void *;
24
- using TCppSema_t = void *;
25
24
using TInterp_t = void *;
26
25
using TCppObject_t = void *;
27
26
// / A class modeling function calls for functions produced by the interpreter
28
27
// / in compiled code. It provides an information if we are calling a standard
29
28
// / function, constructor or destructor.
30
29
class JitCall {
31
30
public:
32
- friend JitCall MakeFunctionCallable (TInterp_t, TCppConstFunction_t);
31
+ friend JitCall MakeFunctionCallable (TCppConstFunction_t);
33
32
enum Kind : char {
34
33
kUnknown = 0 ,
35
34
kGenericCall ,
@@ -160,29 +159,27 @@ namespace Cpp {
160
159
161
160
TCppIndex_t GetEnumConstantValue (TCppScope_t scope);
162
161
163
- size_t GetSizeOfType (TCppSema_t sema, TCppType_t type);
162
+ size_t GetSizeOfType (TCppType_t type);
164
163
165
164
bool IsVariable (TCppScope_t scope);
166
165
167
166
std::string GetName (TCppType_t klass);
168
167
169
- std::string GetCompleteName (TCppSema_t sema, TCppType_t klass);
168
+ std::string GetCompleteName (TCppType_t klass);
170
169
171
170
std::string GetQualifiedName (TCppType_t klass);
172
171
173
- std::string GetQualifiedCompleteName (TCppSema_t sema, TCppType_t klass);
172
+ std::string GetQualifiedCompleteName (TCppType_t klass);
174
173
175
174
std::vector<TCppScope_t> GetUsingNamespaces (TCppScope_t scope);
176
175
177
- TCppScope_t GetGlobalScope (TCppSema_t sema );
176
+ TCppScope_t GetGlobalScope ();
178
177
179
- TCppScope_t GetScope (TCppSema_t sema, const std::string &name,
180
- TCppScope_t parent = 0 );
178
+ TCppScope_t GetScope (const std::string &name, TCppScope_t parent = 0 );
181
179
182
- TCppScope_t GetScopeFromCompleteName (TCppSema_t sema,
183
- const std::string &name);
180
+ TCppScope_t GetScopeFromCompleteName (const std::string &name);
184
181
185
- TCppScope_t GetNamed (TCppSema_t sema, const std::string &name,
182
+ TCppScope_t GetNamed (const std::string &name,
186
183
TCppScope_t parent = nullptr );
187
184
188
185
TCppScope_t GetParentScope (TCppScope_t scope);
@@ -193,26 +190,23 @@ namespace Cpp {
193
190
194
191
TCppScope_t GetBaseClass (TCppType_t klass, TCppIndex_t ibase);
195
192
196
- bool IsSubclass (TInterp_t interp, TCppScope_t derived, TCppScope_t base);
193
+ bool IsSubclass (TCppScope_t derived, TCppScope_t base);
197
194
198
- int64_t GetBaseClassOffset (TCppSema_t sema, TCppScope_t derived,
199
- TCppScope_t base);
195
+ int64_t GetBaseClassOffset (TCppScope_t derived, TCppScope_t base);
200
196
201
- std::vector<TCppFunction_t> GetClassMethods (TCppSema_t sema,
202
- TCppScope_t klass);
197
+ std::vector<TCppFunction_t> GetClassMethods (TCppScope_t klass);
203
198
204
199
// /\returns if a class has a default constructor.
205
200
bool HasDefaultConstructor (TCppScope_t scope);
206
201
207
202
// /\returns the default constructor of a class if any.
208
- TCppFunction_t GetDefaultConstructor (TCppSema_t sema, TCppScope_t scope);
203
+ TCppFunction_t GetDefaultConstructor (TCppScope_t scope);
209
204
210
205
// /\returns the class destructor.
211
- TCppFunction_t GetDestructor (TCppSema_t sema, TCppScope_t scope);
206
+ TCppFunction_t GetDestructor (TCppScope_t scope);
212
207
213
- std::vector<TCppFunction_t> GetFunctionsUsingName (TCppSema_t sema,
214
- TCppScope_t scope,
215
- const std::string &name);
208
+ std::vector<TCppFunction_t> GetFunctionsUsingName (
209
+ TCppScope_t scope, const std::string& name);
216
210
217
211
TCppType_t GetFunctionReturnType (TCppFunction_t func);
218
212
@@ -231,8 +225,8 @@ namespace Cpp {
231
225
232
226
bool IsTemplatedFunction (TCppFunction_t func);
233
227
234
- bool ExistsFunctionTemplate (TCppSema_t sema, const std::string & name,
235
- TCppScope_t parent = 0 );
228
+ bool ExistsFunctionTemplate (const std::string& name,
229
+ TCppScope_t parent = 0 );
236
230
237
231
bool IsMethod (TCppConstFunction_t method);
238
232
@@ -248,18 +242,17 @@ namespace Cpp {
248
242
249
243
bool IsStaticMethod (TCppFunction_t method);
250
244
251
- TCppFuncAddr_t GetFunctionAddress (TInterp_t interp, TCppFunction_t method);
245
+ TCppFuncAddr_t GetFunctionAddress (TCppFunction_t method);
252
246
253
247
bool IsVirtualMethod (TCppFunction_t method);
254
248
255
249
std::vector<TCppScope_t> GetDatamembers (TCppScope_t scope);
256
250
257
- TCppScope_t LookupDatamember (TCppSema_t sema, const std::string &name,
258
- TCppScope_t parent);
251
+ TCppScope_t LookupDatamember (const std::string& name, TCppScope_t parent);
259
252
260
253
TCppType_t GetVariableType (TCppScope_t var);
261
254
262
- intptr_t GetVariableOffset (TInterp_t interp, TCppScope_t var);
255
+ intptr_t GetVariableOffset (TCppScope_t var);
263
256
264
257
bool IsPublicVariable (TCppScope_t var);
265
258
@@ -273,26 +266,26 @@ namespace Cpp {
273
266
274
267
bool IsRecordType (TCppType_t type);
275
268
276
- bool IsPODType (TCppSema_t sema, TCppType_t type);
269
+ bool IsPODType (TCppType_t type);
277
270
278
271
TCppType_t GetUnderlyingType (TCppType_t type);
279
272
280
273
std::string GetTypeAsString (TCppType_t type);
281
274
282
275
TCppType_t GetCanonicalType (TCppType_t type);
283
276
284
- TCppType_t GetType (TCppSema_t sema, const std::string &type);
277
+ TCppType_t GetType (const std::string &type);
285
278
286
- TCppType_t GetComplexType (TCppSema_t sema, TCppType_t element_type);
279
+ TCppType_t GetComplexType (TCppType_t element_type);
287
280
288
281
TCppType_t GetTypeFromScope (TCppScope_t klass);
289
282
290
283
// / Check if a C++ type derives from another.
291
- bool IsTypeDerivedFrom (TInterp_t interp, TCppType_t derived, TCppType_t base);
284
+ bool IsTypeDerivedFrom (TCppType_t derived, TCppType_t base);
292
285
293
286
// / Creates a trampoline function by using the interpreter and returns a
294
287
// / uniform interface to call it from compiled code.
295
- JitCall MakeFunctionCallable (TInterp_t interp, TCppConstFunction_t func);
288
+ JitCall MakeFunctionCallable (TCppConstFunction_t func);
296
289
297
290
// / Checks if a function declared is of const type or not
298
291
bool IsConstMethod (TCppFunction_t method);
@@ -310,41 +303,40 @@ namespace Cpp {
310
303
// / adds additional arguments to the interpreter.
311
304
TInterp_t CreateInterpreter (const std::vector<const char *> &Args = {});
312
305
313
- TCppSema_t GetSema (TInterp_t interp);
306
+ // /\returns the current interpreter instance, if any.
307
+ TInterp_t GetInterpreter ();
314
308
315
- void AddSearchPath (TInterp_t interp, const char *dir, bool isUser = true ,
316
- bool prepend = false );
309
+ void AddSearchPath (const char *dir, bool isUser = true , bool prepend = false );
317
310
318
311
// / Returns the resource-dir path.
319
- const char * GetResourceDir (TInterp_t interp );
312
+ const char * GetResourceDir ();
320
313
321
- void AddIncludePath (TInterp_t interp, const char *dir);
314
+ void AddIncludePath (const char *dir);
322
315
323
- TCppIndex_t Declare (TInterp_t interp, const char *code, bool silent = false );
316
+ TCppIndex_t Declare (const char *code, bool silent = false );
324
317
325
318
// / Declares and runs a code snippet in \c code.
326
319
// /\returns 0 on success
327
- int Process (TInterp_t interp, const char *code);
320
+ int Process (const char *code);
328
321
329
322
// / Declares, runs and returns the execution result as a intptr_t.
330
323
// /\returns the expression results as a intptr_t.
331
- intptr_t Evaluate (TInterp_t interp, const char *code,
332
- bool *HadError = nullptr );
324
+ intptr_t Evaluate (const char *code, bool *HadError = nullptr );
333
325
334
- const std::string LookupLibrary (TInterp_t interp, const char *lib_name);
326
+ const std::string LookupLibrary (const char *lib_name);
335
327
336
- bool LoadLibrary (TInterp_t interp, const char *lib_path, bool lookup = true );
328
+ bool LoadLibrary (const char *lib_path, bool lookup = true );
337
329
338
- std::string ObjToString (TInterp_t interp, const char *type, void *obj);
330
+ std::string ObjToString (const char *type, void *obj);
339
331
340
332
struct TemplateArgInfo {
341
333
TCppScope_t m_Type;
342
334
const char * m_IntegralValue;
343
335
TemplateArgInfo (TCppScope_t type, const char * integral_value = nullptr )
344
336
: m_Type(type), m_IntegralValue(integral_value) {}
345
337
};
346
- TCppScope_t InstantiateClassTemplate (TInterp_t interp, TCppScope_t tmpl,
347
- TemplateArgInfo * template_args,
338
+ TCppScope_t InstantiateClassTemplate (TCppScope_t tmpl,
339
+ TemplateArgInfo* template_args,
348
340
size_t template_args_size);
349
341
350
342
std::vector<std::string> GetAllCppNames (TCppScope_t scope);
@@ -367,12 +359,12 @@ namespace Cpp {
367
359
368
360
// / Creates an object of class \c scope and calls its default constructor. If
369
361
// / \c arena is set it uses placement new.
370
- TCppObject_t Construct (TInterp_t interp, TCppScope_t scope,
371
- void * arena = nullptr );
362
+ TCppObject_t Construct (TCppScope_t scope,
363
+ void * arena = nullptr );
372
364
373
365
// / Calls the destructor of object of type \c type. When withFree is true it
374
366
// / calls operator delete/free.
375
- void Destruct (TInterp_t interp, TCppObject_t This, TCppScope_t type,
367
+ void Destruct (TCppObject_t This, TCppScope_t type,
376
368
bool withFree = true );
377
369
} // end namespace Cpp
378
370
0 commit comments