Initial revision.
[cl-llvm.git] / llvm-extras.cpp
blobb04a08b835cf7fd4a1f64e31d709ef1401504d56
1 #include <llvm-c/Target.h>
2 #include <llvm/ModuleProvider.h>
3 #include <llvm/Support/SourceMgr.h>
4 #include <llvm/Support/raw_ostream.h>
5 #include <llvm/Assembly/Parser.h>
7 extern "C" {
8 // Declare here so the inline definition gets into the lib. Why is
9 // there an inline function in a binding header anyways. :(
10 int CLLLVM_LLVMInitializeNativeTarget() {
11 LLVMInitializeNativeTarget();
14 LLVMModuleRef CLLLVM_LLVMModuleProviderGetModule(LLVMModuleProviderRef modprovider) {
15 return llvm::wrap(llvm::unwrap(modprovider)->getModule());
18 LLVMModuleRef CLLLVM_LLVMParseAssemblyString(const char *AsmString,
19 LLVMModuleRef M,
20 LLVMContextRef Context) {
21 class llvm::SMDiagnostic Error;
22 LLVMModuleRef res =
23 llvm::wrap(llvm::ParseAssemblyString(AsmString, llvm::unwrap(M), Error, *llvm::unwrap(Context)));
24 Error.Print("sbcl", llvm::errs());