diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-02-21 20:58:29 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-02-21 20:58:29 +0000 |
commit | fdf6a279c9a75c778eba382d9a156697092982a1 (patch) | |
tree | e67bc01445260b8cd78ddfd21f1a9f4fe059ac79 /lib/Analysis/ThreadSafety.cpp | |
parent | 05f8ff134d5f270bd7bfe4aaef491bd3febddea1 (diff) |
Replace CFGElement llvm::cast support to be well-defined.
See r175462 for another example/more details.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175796 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ThreadSafety.cpp')
-rw-r--r-- | lib/Analysis/ThreadSafety.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index 20d8f97e2d..2e3abc07b7 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/lib/Analysis/ThreadSafety.cpp @@ -1350,8 +1350,8 @@ void LocalVariableMap::traverseCFG(CFG *CFGraph, BE = CurrBlock->end(); BI != BE; ++BI) { switch (BI->getKind()) { case CFGElement::Statement: { - const CFGStmt *CS = cast<CFGStmt>(&*BI); - VMapBuilder.Visit(const_cast<Stmt*>(CS->getStmt())); + CFGStmt CS = BI->castAs<CFGStmt>(); + VMapBuilder.Visit(const_cast<Stmt*>(CS.getStmt())); break; } default: @@ -1397,8 +1397,8 @@ static void findBlockLocations(CFG *CFGraph, for (CFGBlock::const_reverse_iterator BI = CurrBlock->rbegin(), BE = CurrBlock->rend(); BI != BE; ++BI) { // FIXME: Handle other CFGElement kinds. - if (const CFGStmt *CS = dyn_cast<CFGStmt>(&*BI)) { - CurrBlockInfo->ExitLoc = CS->getStmt()->getLocStart(); + if (CFGStmt CS = BI->getAs<CFGStmt>()) { + CurrBlockInfo->ExitLoc = CS.getStmt()->getLocStart(); break; } } @@ -1410,8 +1410,8 @@ static void findBlockLocations(CFG *CFGraph, for (CFGBlock::const_iterator BI = CurrBlock->begin(), BE = CurrBlock->end(); BI != BE; ++BI) { // FIXME: Handle other CFGElement kinds. - if (const CFGStmt *CS = dyn_cast<CFGStmt>(&*BI)) { - CurrBlockInfo->EntryLoc = CS->getStmt()->getLocStart(); + if (CFGStmt CS = BI->getAs<CFGStmt>()) { + CurrBlockInfo->EntryLoc = CS.getStmt()->getLocStart(); break; } } @@ -2234,8 +2234,8 @@ inline bool neverReturns(const CFGBlock* B) { return false; CFGElement Last = B->back(); - if (CFGStmt* S = dyn_cast<CFGStmt>(&Last)) { - if (isa<CXXThrowExpr>(S->getStmt())) + if (CFGStmt S = Last.getAs<CFGStmt>()) { + if (isa<CXXThrowExpr>(S.getStmt())) return true; } return false; @@ -2444,22 +2444,22 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { BE = CurrBlock->end(); BI != BE; ++BI) { switch (BI->getKind()) { case CFGElement::Statement: { - const CFGStmt *CS = cast<CFGStmt>(&*BI); - LocksetBuilder.Visit(const_cast<Stmt*>(CS->getStmt())); + CFGStmt CS = BI->castAs<CFGStmt>(); + LocksetBuilder.Visit(const_cast<Stmt*>(CS.getStmt())); break; } // Ignore BaseDtor, MemberDtor, and TemporaryDtor for now. case CFGElement::AutomaticObjectDtor: { - const CFGAutomaticObjDtor *AD = cast<CFGAutomaticObjDtor>(&*BI); - CXXDestructorDecl *DD = const_cast<CXXDestructorDecl*>( - AD->getDestructorDecl(AC.getASTContext())); + CFGAutomaticObjDtor AD = BI->castAs<CFGAutomaticObjDtor>(); + CXXDestructorDecl *DD = const_cast<CXXDestructorDecl *>( + AD.getDestructorDecl(AC.getASTContext())); if (!DD->hasAttrs()) break; // Create a dummy expression, - VarDecl *VD = const_cast<VarDecl*>(AD->getVarDecl()); + VarDecl *VD = const_cast<VarDecl*>(AD.getVarDecl()); DeclRefExpr DRE(VD, false, VD->getType(), VK_LValue, - AD->getTriggerStmt()->getLocEnd()); + AD.getTriggerStmt()->getLocEnd()); LocksetBuilder.handleCall(&DRE, DD); break; } |