Unbreak buildbots where the debug info test was crashing due to unchecked error.
authorGreg Clayton <gclayton@apple.com>
Thu, 8 Dec 2016 02:11:03 +0000 (02:11 +0000)
committerGreg Clayton <gclayton@apple.com>
Thu, 8 Dec 2016 02:11:03 +0000 (02:11 +0000)
llvm-svn: 289017

llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

index ea796b4..47709ff 100644 (file)
@@ -51,14 +51,15 @@ Triple getHostTripleForAddrSize(uint8_t AddrSize) {
 /// \returns true if there were errors, false otherwise.
 template <typename T>
 static bool HandleExpectedError(T &Expected) {
-  if (!Expected)
-    return false;
   std::string ErrorMsg;
   handleAllErrors(Expected.takeError(), [&](const llvm::ErrorInfoBase &EI) {
     ErrorMsg = EI.message();
   });
-  ::testing::AssertionFailure() << "error: " << ErrorMsg;
-  return true;
+  if (!ErrorMsg.empty()) {
+    ::testing::AssertionFailure() << "error: " << ErrorMsg;
+    return true;
+  }
+  return false;
 }
 
 template <uint16_t Version, class AddrType, class RefAddrType>