From c72c57c9e9b69944e3e009cd5e209634839581d3 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 8 Apr 2013 18:45:10 +0000 Subject: Vendor import of clang trunk r178860: http://llvm.org/svn/llvm-project/cfe/trunk@178860 --- lib/Analysis/LiveVariables.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'lib/Analysis/LiveVariables.cpp') diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 38f8199..b43892a 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -1,15 +1,25 @@ -#include "clang/Analysis/Analyses/LiveVariables.h" -#include "clang/Analysis/Analyses/PostOrderCFGView.h" +//=- LiveVariables.cpp - Live Variable Analysis for Source CFGs ----------*-==// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements Live Variables analysis for source-level CFGs. +// +//===----------------------------------------------------------------------===// +#include "clang/Analysis/Analyses/LiveVariables.h" #include "clang/AST/Stmt.h" -#include "clang/Analysis/CFG.h" -#include "clang/Analysis/AnalysisContext.h" #include "clang/AST/StmtVisitor.h" - -#include "llvm/ADT/PostOrderIterator.h" +#include "clang/Analysis/Analyses/PostOrderCFGView.h" +#include "clang/Analysis/AnalysisContext.h" +#include "clang/Analysis/CFG.h" #include "llvm/ADT/DenseMap.h" - -#include +#include "llvm/ADT/PostOrderIterator.h" +#include "llvm/Support/raw_ostream.h" #include #include @@ -464,15 +474,16 @@ LiveVariablesImpl::runOnBlock(const CFGBlock *block, ei = block->rend(); it != ei; ++it) { const CFGElement &elem = *it; - if (const CFGAutomaticObjDtor *Dtor = dyn_cast(&elem)){ + if (Optional Dtor = + elem.getAs()) { val.liveDecls = DSetFact.add(val.liveDecls, Dtor->getVarDecl()); continue; } - if (!isa(elem)) + if (!elem.getAs()) continue; - const Stmt *S = cast(elem).getStmt(); + const Stmt *S = elem.castAs().getStmt(); TF.Visit(const_cast(S)); stmtsToLiveness[S] = val; } @@ -524,8 +535,9 @@ LiveVariables::computeLiveness(AnalysisDeclContext &AC, if (killAtAssign) for (CFGBlock::const_iterator bi = block->begin(), be = block->end(); bi != be; ++bi) { - if (const CFGStmt *cs = bi->getAs()) { - if (const BinaryOperator *BO = dyn_cast(cs->getStmt())) { + if (Optional cs = bi->getAs()) { + if (const BinaryOperator *BO = + dyn_cast(cs->getStmt())) { if (BO->getOpcode() == BO_Assign) { if (const DeclRefExpr *DR = dyn_cast(BO->getLHS()->IgnoreParens())) { -- cgit v1.1