1 #include <llvm-c/Target.h>
2 #include <llvm/Target/TargetData.h>
3 #include <llvm/ModuleProvider.h>
4 #include <llvm/Support/SourceMgr.h>
5 #include <llvm/Support/raw_ostream.h>
6 #include <llvm/Assembly/Parser.h>
9 // Declare here so the inline definition gets into the lib. Why is
10 // there an inline function in a binding header anyways. :(
11 int CLLLVM_LLVMInitializeNativeTarget() {
12 LLVMInitializeNativeTarget();
15 // Functions missing in the LLVM C API
17 LLVMModuleRef
CLLLVM_LLVMModuleProviderGetModule(LLVMModuleProviderRef modprovider
) {
18 return llvm::wrap(llvm::unwrap(modprovider
)->getModule());
21 LLVMModuleRef
CLLLVM_LLVMParseAssemblyString(const char *AsmString
,
23 LLVMContextRef Context
) {
24 class llvm::SMDiagnostic Error
;
26 llvm::wrap(llvm::ParseAssemblyString(AsmString
, llvm::unwrap(M
), Error
, *llvm::unwrap(Context
)));
27 Error
.Print("sbcl", llvm::errs());
30 LLVMTypeRef
CLLLVM_LLVMIntPtrTypeInContext(LLVMContextRef Context
, LLVMTargetDataRef TD
) {
31 return llvm::wrap(llvm::unwrap(TD
)->getIntPtrType(*llvm::unwrap(Context
)));