[libclc] r199687 - Fix build broken by LLVM commit r199279

Tom Stellard thomas.stellard at amd.com
Mon Jan 20 12:28:48 PST 2014


Author: tstellar
Date: Mon Jan 20 14:28:48 2014
New Revision: 199687

URL: http://llvm.org/viewvc/llvm-project?rev=199687&view=rev
Log:
Fix build broken by LLVM commit r199279

Patch by: Udo van den Heuvel

Tom Stellard:
  - Added ifdef and error handling

Modified:
    libclc/trunk/utils/prepare-builtins.cpp

Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=199687&r1=199686&r2=199687&view=diff
==============================================================================
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Mon Jan 20 14:28:48 2014
@@ -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) {





More information about the cfe-commits mailing list