Index: clang/lib/Analysis/LiveVariables.cpp =================================================================== --- clang/lib/Analysis/LiveVariables.cpp +++ clang/lib/Analysis/LiveVariables.cpp @@ -13,6 +13,7 @@ #include "clang/Analysis/Analyses/LiveVariables.h" #include "clang/AST/Stmt.h" #include "clang/AST/StmtVisitor.h" +#include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/CFG.h" #include "clang/Analysis/FlowSensitive/DataflowWorklist.h" @@ -502,6 +503,9 @@ CFG *cfg = AC.getCFG(); if (!cfg) return nullptr; + assert(AC.getAnalysis() && + "If the CFG exists, we should be able to create a post order view of " + "it!"); // The analysis currently has scalability issues for very large CFGs. // Bail out if it looks too large. @@ -510,13 +514,12 @@ LiveVariablesImpl *LV = new LiveVariablesImpl(AC, killAtAssign); - // Construct the dataflow worklist. Enqueue the exit block as the + // Construct the dataflow worklist. Enqueue the exit block as the // start of the analysis. BackwardDataflowWorklist worklist(*cfg, AC); llvm::BitVector everAnalyzedBlock(cfg->getNumBlockIDs()); - // FIXME: we should enqueue using post order. - for (const CFGBlock *B : cfg->nodes()) { + for (const CFGBlock *B : *AC.getAnalysis()) { worklist.enqueueBlock(B); }