Start to clean things up to get into a state usable by others.
[cl-llvm.git] / src / llvm-extras.cpp
blob273d5e7e4247eedd36b8e2e00204f536f542d81c
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>
8 extern "C" {
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,
22 LLVMModuleRef M,
23 LLVMContextRef Context) {
24 class llvm::SMDiagnostic Error;
25 LLVMModuleRef res =
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)));