Remove the CFGElement "Invalid" state.
Use Optional<CFG*> where invalid states were needed previously. In the one case
where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy
CFGAutomaticObjDtor.
Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek
and Doug Gregor.
Post commit code review feedback on r175796 by Ted Kremenek.
llvm-svn: 175938
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index 2e3abc0..7bb54d6 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -1397,8 +1397,8 @@
for (CFGBlock::const_reverse_iterator BI = CurrBlock->rbegin(),
BE = CurrBlock->rend(); BI != BE; ++BI) {
// FIXME: Handle other CFGElement kinds.
- if (CFGStmt CS = BI->getAs<CFGStmt>()) {
- CurrBlockInfo->ExitLoc = CS.getStmt()->getLocStart();
+ if (Optional<CFGStmt> CS = BI->getAs<CFGStmt>()) {
+ CurrBlockInfo->ExitLoc = CS->getStmt()->getLocStart();
break;
}
}
@@ -1410,8 +1410,8 @@
for (CFGBlock::const_iterator BI = CurrBlock->begin(),
BE = CurrBlock->end(); BI != BE; ++BI) {
// FIXME: Handle other CFGElement kinds.
- if (CFGStmt CS = BI->getAs<CFGStmt>()) {
- CurrBlockInfo->EntryLoc = CS.getStmt()->getLocStart();
+ if (Optional<CFGStmt> CS = BI->getAs<CFGStmt>()) {
+ CurrBlockInfo->EntryLoc = CS->getStmt()->getLocStart();
break;
}
}
@@ -2234,8 +2234,8 @@
return false;
CFGElement Last = B->back();
- if (CFGStmt S = Last.getAs<CFGStmt>()) {
- if (isa<CXXThrowExpr>(S.getStmt()))
+ if (Optional<CFGStmt> S = Last.getAs<CFGStmt>()) {
+ if (isa<CXXThrowExpr>(S->getStmt()))
return true;
}
return false;