Fix potential null deference in CFG printer.
authorTed Kremenek <kremenek@apple.com>
Fri, 12 Oct 2012 22:56:31 +0000 (22:56 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 12 Oct 2012 22:56:31 +0000 (22:56 +0000)
llvm-svn: 165836

clang/lib/Analysis/CFG.cpp

index 4d63345..94c005f 100644 (file)
@@ -3865,8 +3865,8 @@ static void print_block(raw_ostream &OS, const CFG* cfg,
 
     if (Helper) Helper->setBlockID(-1);
 
-    CFGBlockTerminatorPrint TPrinter(OS, Helper,
-                                     PrintingPolicy(Helper->getLangOpts()));
+    PrintingPolicy PP(Helper ? Helper->getLangOpts() : LangOptions());
+    CFGBlockTerminatorPrint TPrinter(OS, Helper, PP);
     TPrinter.Visit(const_cast<Stmt*>(B.getTerminator().getStmt()));
     OS << '\n';