#include #include #include #include #include #include #include "llvm_wrapper.h" extern "C" LLVMModuleRef llvm_parse_bitcode(const unsigned char * bitcode, unsigned bitcode_len) { llvm::OwningPtr M; llvm::StringRef str((const char*)bitcode, bitcode_len); llvm::MemoryBuffer* buffer = llvm::MemoryBuffer::getMemBufferCopy(str); llvm::SMDiagnostic Err; M.reset(llvm::ParseIR(buffer, Err, llvm::getGlobalContext())); return wrap(M.take()); }