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 | 2a01f5d426c6bb0ef57c0a018942f6f6b179827a (patch) | |
tree | 6484b1be92360933abdd7d03a8b1110d6c0aa76f /clang/lib/Analysis/ThreadSafety.cpp | |
parent | 23720cc66c3b639b2c4c1399e9f994dc14c5814b (diff) | |
download | bcm5719-llvm-2a01f5d426c6bb0ef57c0a018942f6f6b179827a.tar.gz bcm5719-llvm-2a01f5d426c6bb0ef57c0a018942f6f6b179827a.zip |
Replace CFGElement llvm::cast support to be well-defined.
See r175462 for another example/more details.
llvm-svn: 175796
Diffstat (limited to 'clang/lib/Analysis/ThreadSafety.cpp')
-rw-r--r-- | clang/lib/Analysis/ThreadSafety.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 20d8f97e2d2..2e3abc07b7c 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/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; } |