diff options
author | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2010-03-02 23:58:54 +0000 |
---|---|---|
committer | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2010-03-02 23:58:54 +0000 |
commit | df7df075b723e926e51555bf5aff6e231279a479 (patch) | |
tree | 81d043d94f964ed4a33b62f3ea6572da6ff3c439 /lib/Bitcode | |
parent | fb444af5c9901271dc115a3197d7fa9ef4187fdd (diff) | |
download | external_llvm-df7df075b723e926e51555bf5aff6e231279a479.zip external_llvm-df7df075b723e926e51555bf5aff6e231279a479.tar.gz external_llvm-df7df075b723e926e51555bf5aff6e231279a479.tar.bz2 |
Add Module functions in place of module providers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r-- | lib/Bitcode/Reader/BitReader.cpp | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/lib/Bitcode/Reader/BitReader.cpp b/lib/Bitcode/Reader/BitReader.cpp index 7537435..15844c0 100644 --- a/lib/Bitcode/Reader/BitReader.cpp +++ b/lib/Bitcode/Reader/BitReader.cpp @@ -45,26 +45,44 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, /* Reads a module from the specified path, returning via the OutModule parameter a module provider which performs lazy deserialization. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ -LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, - LLVMModuleProviderRef *OutMP, - char **OutMessage) { - return LLVMGetBitcodeModuleProviderInContext(wrap(&getGlobalContext()), - MemBuf, OutMP, OutMessage); -} - -LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef, - LLVMMemoryBufferRef MemBuf, - LLVMModuleProviderRef *OutMP, - char **OutMessage) { +LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, + LLVMMemoryBufferRef MemBuf, + LLVMModuleRef *OutM, + char **OutMessage) { std::string Message; - *OutMP = reinterpret_cast<LLVMModuleProviderRef>( - getLazyBitcodeModule(unwrap(MemBuf), *unwrap(ContextRef), &Message)); - if (!*OutMP) { + *OutM = wrap(getLazyBitcodeModule(unwrap(MemBuf), *unwrap(ContextRef), + &Message)); + if (!*OutM) { if (OutMessage) *OutMessage = strdup(Message.c_str()); return 1; } return 0; + +} + +LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, + char **OutMessage) { + return LLVMGetBitcodeModuleInContext(LLVMGetGlobalContext(), MemBuf, OutM, + OutMessage); +} + +/* Deprecated: Use LLVMGetBitcodeModuleInContext instead. */ +LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef, + LLVMMemoryBufferRef MemBuf, + LLVMModuleProviderRef *OutMP, + char **OutMessage) { + return LLVMGetBitcodeModuleInContext(ContextRef, MemBuf, + reinterpret_cast<LLVMModuleRef*>(OutMP), + OutMessage); +} + +/* Deprecated: Use LLVMGetBitcodeModule instead. */ +LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, + LLVMModuleProviderRef *OutMP, + char **OutMessage) { + return LLVMGetBitcodeModuleProviderInContext(LLVMGetGlobalContext(), MemBuf, + OutMP, OutMessage); } |