summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ThreadSafety.cpp
diff options
context:
space:
mode:
authorDeLesley Hutchins <delesley@google.com>2012-09-19 19:49:40 +0000
committerDeLesley Hutchins <delesley@google.com>2012-09-19 19:49:40 +0000
commit132f8f6959c718c41522753ea288b0243feab2b0 (patch)
tree37610f7266bfeadf3521d76a067ee88c49fb2cd7 /clang/lib/Analysis/ThreadSafety.cpp
parent8372539543a5004e31756cdf6baccb668895f3cf (diff)
downloadbcm5719-llvm-132f8f6959c718c41522753ea288b0243feab2b0.tar.gz
bcm5719-llvm-132f8f6959c718c41522753ea288b0243feab2b0.zip
Thread-safety analysis: Fix warning when EXCLUSIVE_LOCKS_REQUIRED
is placed on a function that has no path to the exit block. llvm-svn: 164244
Diffstat (limited to 'clang/lib/Analysis/ThreadSafety.cpp')
-rw-r--r--clang/lib/Analysis/ThreadSafety.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index e7d9a2d642c..036d0b8888a 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -2374,6 +2374,20 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
}
}
+
+ // Check to make sure that the exit block is reachable
+ bool ExitUnreachable = true;
+ for (CFGBlock::const_pred_iterator PI = CFGraph->getExit().pred_begin(),
+ PE = CFGraph->getExit().pred_end(); PI != PE; ++PI) {
+ if (!(*PI)->hasNoReturnElement()) {
+ ExitUnreachable = false;
+ break;
+ }
+ }
+ // Skip the final check if the exit block is unreachable.
+ if (ExitUnreachable)
+ return;
+
CFGBlockInfo *Initial = &BlockInfo[CFGraph->getEntry().getBlockID()];
CFGBlockInfo *Final = &BlockInfo[CFGraph->getExit().getBlockID()];
OpenPOWER on IntegriCloud