about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--tools/kleaver/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp
index 17a91907..07baee24 100644
--- a/tools/kleaver/main.cpp
+++ b/tools/kleaver/main.cpp
@@ -457,12 +457,22 @@ int main(int argc, char **argv) {
 
   std::string ErrorStr;
   
+#if LLVM_VERSION_CODE < LLVM_VERSION(3,5)
   OwningPtr<MemoryBuffer> MB;
   error_code ec=MemoryBuffer::getFileOrSTDIN(InputFile.c_str(), MB);
   if (ec) {
     llvm::errs() << argv[0] << ": error: " << ec.message() << "\n";
     return 1;
   }
+#else
+  auto MBResult = MemoryBuffer::getFileOrSTDIN(InputFile.c_str());
+  if (!MBResult) {
+    llvm::errs() << argv[0] << ": error: " << MBResult.getError().message()
+                 << "\n";
+    return 1;
+  }
+  std::unique_ptr<MemoryBuffer> &MB = *MBResult;
+#endif
   
   ExprBuilder *Builder = 0;
   switch (BuilderKind) {