DebugLocs without a scope should fail the verification.
[opencl/llvm.git] / lib / IR / DebugInfo.cpp
index 0dd46b7619c33acadc9f86d683f3021dcac9b22e..9003fff707128c3e2cfa06767c52a45d25b8bd06 100644 (file)
@@ -527,15 +527,15 @@ bool DISubprogram::Verify() const {
         while ((IA = DL.getInlinedAt()))
           DL = DebugLoc::getFromDILocation(IA);
         DL.getScopeAndInlinedAt(Scope, IA);
-        assert(Scope && "debug location has no scope");
+        if (!Scope)
+          return false;
         assert(!IA);
         while (!DIDescriptor(Scope).isSubprogram()) {
           DILexicalBlockFile D(Scope);
           Scope = D.isLexicalBlockFile()
                       ? D.getScope()
                       : DebugLoc::getFromDILexicalBlock(Scope).getScope();
-          if (!Scope)
-            llvm_unreachable("lexical block file has no scope");
+          assert(Scope && "lexical block file has no scope");
         }
         if (!DISubprogram(Scope).describes(F))
           return false;