]> granicus.if.org Git - clang/commitdiff
Teach 'ExecutionContinues' (part of BugReporter's diagnostic generation) about BlockD...
authorTed Kremenek <kremenek@apple.com>
Fri, 4 Dec 2009 20:34:31 +0000 (20:34 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 4 Dec 2009 20:34:31 +0000 (20:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90584 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BugReporter.cpp

index c26a60af9c85d89fd3fd38dfece585d599415fbc..e6482698dd43d94dd3a1cac626ff39349646245f 100644 (file)
@@ -204,10 +204,19 @@ PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream& os,
     os << "Execution continues on line "
        << getSourceManager().getInstantiationLineNumber(Loc.asLocation())
        << '.';
-  else
-    os << "Execution jumps to the end of the "
-       << (isa<ObjCMethodDecl>(N->getLocationContext()->getDecl()) ?
-             "method" : "function") << '.';
+  else {
+    os << "Execution jumps to the end of the ";
+    const Decl *D = N->getLocationContext()->getDecl();
+    if (isa<ObjCMethodDecl>(D))
+      os << "method";
+    else if (isa<FunctionDecl>(D))
+      os << "function";
+    else {
+      assert(isa<BlockDecl>(D));
+      os << "anonymous block";
+    }
+    os << '.';
+  }
 
   return Loc;
 }