diff options
author | DeLesley Hutchins <delesley@google.com> | 2012-09-19 19:49:40 +0000 |
---|---|---|
committer | DeLesley Hutchins <delesley@google.com> | 2012-09-19 19:49:40 +0000 |
commit | 2a237e03c407ff55bd8639b18658a8751955f1db (patch) | |
tree | 14fa21e8de674b541e636f8ae38d6dd4f0c97264 /lib/Analysis/ThreadSafety.cpp | |
parent | 5b280f28351bbdc103cc50d3b0f52f92d286fa0a (diff) |
Thread-safety analysis: Fix warning when EXCLUSIVE_LOCKS_REQUIRED
is placed on a function that has no path to the exit block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ThreadSafety.cpp')
-rw-r--r-- | lib/Analysis/ThreadSafety.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index e7d9a2d642..036d0b8888 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/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()]; |