]> granicus.if.org Git - clang/commitdiff
Add null check in CFGBuilder::VisitStmt() to make CFG construction
authorTed Kremenek <kremenek@apple.com>
Fri, 30 Apr 2010 22:25:53 +0000 (22:25 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 30 Apr 2010 22:25:53 +0000 (22:25 +0000)
more resilient to bad code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102793 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp

index 7c7504a1d82707448eea3990508f63f1b41398b7..7f71e0acf7a3e839b103ea1d1b17b5234c23118a 100644 (file)
@@ -338,6 +338,10 @@ bool CFGBuilder::FinishBlock(CFGBlock* B) {
 ///   DeclStmts (which may contain nested control-flow).
 CFGBlock* CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) {
 tryAgain:
+  if (!S) {
+    badCFG = true;
+    return 0;
+  }
   switch (S->getStmtClass()) {
     default:
       return VisitStmt(S, asc);