mirror of
https://github.com/obfuscator-llvm/obfuscator
synced 2026-06-08 16:28:34 +00:00
Initial import of LLVM 3.3
This commit is contained in:
@@ -9,10 +9,11 @@
|
||||
|
||||
#include "llvm-c/BitReader.h"
|
||||
#include "llvm/Bitcode/ReaderWriter.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -30,7 +31,7 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
|
||||
LLVMModuleRef *OutModule,
|
||||
char **OutMessage) {
|
||||
std::string Message;
|
||||
|
||||
|
||||
*OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef),
|
||||
&Message));
|
||||
if (!*OutModule) {
|
||||
@@ -38,19 +39,19 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
|
||||
*OutMessage = strdup(Message.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
Optionally returns a human-readable error message via OutMessage. */
|
||||
LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutM,
|
||||
char **OutMessage) {
|
||||
std::string Message;
|
||||
|
||||
|
||||
*OutM = wrap(getLazyBitcodeModule(unwrap(MemBuf), *unwrap(ContextRef),
|
||||
&Message));
|
||||
if (!*OutM) {
|
||||
@@ -58,7 +59,7 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
|
||||
*OutMessage = strdup(Message.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user