Fix ICE in consumed analysis when CFG is null.
authorDeLesley Hutchins <delesley@google.com>
Tue, 10 Sep 2013 23:10:10 +0000 (23:10 +0000)
committerDeLesley Hutchins <delesley@google.com>
Tue, 10 Sep 2013 23:10:10 +0000 (23:10 +0000)
llvm-svn: 190447

clang/lib/Analysis/Consumed.cpp

index b540d75..7cd0290 100644 (file)
@@ -1103,12 +1103,16 @@ bool ConsumedAnalyzer::splitState(const CFGBlock *CurrBlock,
 
 void ConsumedAnalyzer::run(AnalysisDeclContext &AC) {
   const FunctionDecl *D = dyn_cast_or_null<FunctionDecl>(AC.getDecl());
+  if (!D)
+    return;
   
-  if (!D) return;
+  CFG *CFGraph = AC.getCFG();
+  if (!CFGraph)
+    return;
   
   determineExpectedReturnState(AC, D);
   
-  BlockInfo = ConsumedBlockInfo(AC.getCFG());
+  BlockInfo = ConsumedBlockInfo(CFGraph);
   
   PostOrderCFGView *SortedGraph = AC.getAnalysis<PostOrderCFGView>();