Convert FindFunctionInStream to return an error_code.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 5 Nov 2013 17:16:08 +0000 (17:16 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 5 Nov 2013 17:16:08 +0000 (17:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194084 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Reader/BitcodeReader.h

index f2039d4ed66de705fb056a74d1601ddffdf96e85..3dd8f0b27925b2334dd8377e55c81529e80e11e3 100644 (file)
@@ -3049,17 +3049,18 @@ OutOfRecordLoop:
   return error_code::success();
 }
 
-/// FindFunctionInStream - Find the function body in the bitcode stream
-bool BitcodeReader::FindFunctionInStream(Function *F,
+/// Find the function body in the bitcode stream
+error_code BitcodeReader::FindFunctionInStream(Function *F,
        DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator) {
   while (DeferredFunctionInfoIterator->second == 0) {
     if (Stream.AtEndOfStream())
       return Error(CouldNotFindFunctionInStream);
     // ParseModule will parse the next body in the stream and set its
     // position in the DeferredFunctionInfo map.
-    if (ParseModule(true)) return true;
+    if (error_code EC = ParseModule(true))
+      return EC;
   }
-  return false;
+  return error_code::success();
 }
 
 //===----------------------------------------------------------------------===//
index 0a8bb0147d7050bd7beb7735da67f79c3a2a7aa7..b03658ba11ce372c231c7d9526d8995e7ea02c04 100644 (file)
@@ -366,7 +366,7 @@ private:
   error_code InitStream();
   error_code InitStreamFromBuffer();
   error_code InitLazyStream();
-  bool FindFunctionInStream(Function *F,
+  error_code FindFunctionInStream(Function *F,
          DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator);
 };