-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclang_shim.h
More file actions
57 lines (43 loc) · 1.12 KB
/
clang_shim.h
File metadata and controls
57 lines (43 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef SX_CLANG_SHIM_H
#define SX_CLANG_SHIM_H
#include <llvm-c/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/* --- Header parsing --- */
typedef struct {
const char *name;
const char *type_spelling;
} SxCParamInfo;
typedef struct {
const char *name;
const char *return_type;
SxCParamInfo *params;
int num_params;
const char *source_file;
unsigned source_line;
} SxCFunctionInfo;
typedef struct {
SxCFunctionInfo *functions;
int num_functions;
} SxCHeaderInfo;
SxCHeaderInfo *sx_clang_parse_header(
const char *filename,
const char **args, int num_args,
char **out_error);
void sx_clang_free_header_info(SxCHeaderInfo *info);
/* --- C source compilation to LLVM module --- */
LLVMModuleRef sx_clang_compile_to_module(
LLVMContextRef ctx,
const char *filename,
const char **args, int num_args,
char **out_error);
/* --- C source compilation to native object code --- */
LLVMMemoryBufferRef sx_clang_compile_to_object(
const char *filename,
const char **args, int num_args,
char **out_error);
#ifdef __cplusplus
}
#endif
#endif /* SX_CLANG_SHIM_H */