Skip to content

Commit 8a63b15

Browse files
committed
Fix build broken by LLVM commit r199279
Patch by: Udo van den Heuvel Tom Stellard: - Added ifdef and error handling llvm-svn: 199687
1 parent 9cacbab commit 8a63b15

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

libclc/utils/prepare-builtins.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "llvm/Support/MemoryBuffer.h"
1010
#include "llvm/Support/raw_ostream.h"
1111
#include "llvm/Support/system_error.h"
12+
#include "llvm/Support/ErrorOr.h"
1213
#include "llvm/Support/ToolOutputFile.h"
1314
#include "llvm/Config/config.h"
1415

@@ -34,8 +35,16 @@ int main(int argc, char **argv) {
3435
OwningPtr<MemoryBuffer> BufferPtr;
3536
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
3637
ErrorMessage = ec.message();
37-
else
38+
else {
39+
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
40+
ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
41+
if (error_code ec = ModuleOrErr.getError())
42+
ErrorMessage = ec.message();
43+
M.reset(ModuleOrErr.get());
44+
#else
3845
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
46+
#endif
47+
}
3948
}
4049

4150
if (M.get() == 0) {

0 commit comments

Comments
 (0)