llvm.org GIT mirror llvm / 7d2166a
Make it possible to include llvm-c without including C++ headers. Patch by Filip Pizlo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178713 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 6 years ago
6 changed file(s) with 36 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
1616
1717 #include "llvm/Support/DataTypes.h"
1818
19 #ifdef __cplusplus
20
19 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
2120 /* Need these includes to support the LLVM 'cast' template for the C++ 'wrap'
2221 and 'unwrap' conversion functions. */
2322 #include "llvm/IR/IRBuilder.h"
2423 #include "llvm/IR/Module.h"
2524 #include "llvm/PassRegistry.h"
26
25 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
26
27 #ifdef __cplusplus
2728 extern "C" {
2829 #endif
2930
26682669
26692670 #ifdef __cplusplus
26702671 }
2671
2672 #endif
2673
2674 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
26722675 namespace llvm {
26732676 class MemoryBuffer;
26742677 class PassManagerBase;
27622765 }
27632766 }
27642767
2765 #endif /* !defined(__cplusplus) */
2766
2767 #endif /* !defined(LLVM_C_CORE_H) */
2768 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
2769
2770 #endif /* defined(LLVM_C_CORE_H) */
137137
138138 #ifdef __cplusplus
139139 }
140 #endif
140141
142 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
141143 namespace llvm {
142144 struct GenericValue;
143145 class ExecutionEngine;
156158
157159 #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS
158160 }
159
160 #endif /* defined(__cplusplus) */
161 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
161162
162163 #endif
2121 #include "llvm-c/Core.h"
2222 #include "llvm/Config/llvm-config.h"
2323
24 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
25 #include "llvm/Object/ObjectFile.h"
26 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
27
2428 #ifdef __cplusplus
25 #include "llvm/Object/ObjectFile.h"
26
2729 extern "C" {
2830 #endif
2931
98100
99101 #ifdef __cplusplus
100102 }
103 #endif
101104
105 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
102106 namespace llvm {
103107 namespace object {
104108 inline ObjectFile *unwrap(LLVMObjectFileRef OF) {
141145
142146 }
143147 }
148 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
144149
145 #endif /* defined(__cplusplus) */
146150
147151 #endif
148152
234234
235235 #ifdef __cplusplus
236236 }
237
237 #endif
238
239 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
238240 namespace llvm {
239241 class DataLayout;
240242 class TargetLibraryInfo;
256258 return reinterpret_cast(X);
257259 }
258260 }
259
260 #endif /* defined(__cplusplus) */
261
262 #endif
261 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
262
263 #endif
118118
119119 #ifdef __cplusplus
120120 }
121 #endif
121122
123 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
122124 namespace llvm {
123125 class TargetMachine;
124126 class Target;
137139 return reinterpret_cast(const_cast(P));
138140 }
139141 }
140 #endif
142 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
141143
142144 #endif
1717
1818 typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;
1919
20 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
21 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
22 #endif
23
2024 #ifdef __cplusplus
21 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
2225 extern "C" {
2326 #endif
2427
8588
8689 #ifdef __cplusplus
8790 }
91 #endif
8892
93 #if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
8994 namespace llvm {
9095 inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {
9196 return reinterpret_cast(P);
95100 return reinterpret_cast(P);
96101 }
97102 }
98 #endif
103 #endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
99104
100105 #endif