[PATCH 10/11] Check for an empty error log.

Andreas Simbuerger simbuerg at googlemail.com
Sun Jun 8 17:42:32 PDT 2014


Fixes #19976.

The error log does not contain an error, in case we reject a candidate
without generating a diagnostic message by using invalid<>(...).
---
 lib/Analysis/ScopDetection.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/Analysis/ScopDetection.cpp b/lib/Analysis/ScopDetection.cpp
index a15ca19..2730d81 100644
--- a/lib/Analysis/ScopDetection.cpp
+++ b/lib/Analysis/ScopDetection.cpp
@@ -219,7 +219,14 @@ std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
   // Get the first error we found. Even in keep-going mode, this is the first
   // reason that caused the candidate to be rejected.
   RejectLog Errors = Logs.at(R);
-  return (*Errors.begin())->getMessage();
+
+  // This can happen when we marked a region invalid, but didn't track
+  // an error for it.
+  if (Errors.size() == 0)
+    return "";
+
+  RejectReasonPtr RR = *Errors.begin();
+  return RR->getMessage();
 }
 
 bool ScopDetection::isValidCFG(BasicBlock &BB,
-- 
2.0.0




More information about the llvm-commits mailing list