summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-01-20 20:28:48 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-01-20 20:28:48 +0000
commitd9a654573ace0405ca1c7ef8d3dc2bdd43d8052f (patch)
tree4f47386f0e7f26644a31756030463b31087be834 /utils
parent0e431f5decdf24b4661c59d8c5a59730175d4e48 (diff)
Fix build broken by LLVM commit r199279
Patch by: Udo van den Heuvel Tom Stellard: - Added ifdef and error handling git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@199687 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/prepare-builtins.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index 4ad21e8..bf85644 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -9,6 +9,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
+#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Config/config.h"
@@ -34,8 +35,16 @@ int main(int argc, char **argv) {
OwningPtr<MemoryBuffer> BufferPtr;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
ErrorMessage = ec.message();
- else
+ else {
+#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
+ ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
+ if (error_code ec = ModuleOrErr.getError())
+ ErrorMessage = ec.message();
+ M.reset(ModuleOrErr.get());
+#else
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
+#endif
+ }
}
if (M.get() == 0) {