Thread safety analysis: handle CFG blocks which call functions marked as noreturn.

llvm-svn: 151944
This commit is contained in:
DeLesley Hutchins 2012-03-02 22:02:58 +00:00
parent ccec40d9b7
commit a2587ef26d
2 changed files with 21 additions and 0 deletions

View File

@ -1526,6 +1526,10 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
if (*PI == 0 || !VisitedBlocks.alreadySet(*PI))
continue;
// Ignore edges from blocks that can't return.
if ((*PI)->hasNoReturnElement())
continue;
// If the previous block ended in a 'continue' or 'break' statement, then
// a difference in locksets is probably due to a bug in that block, rather
// than in some other predecessor. In that case, keep the other

View File

@ -2114,3 +2114,20 @@ class Foo {
} // end namespace InvalidNonStatic
namespace NoReturnTest {
bool condition();
void fatal() __attribute__((noreturn));
Mutex mu_;
void test1() {
MutexLock lock(&mu_);
if (condition()) {
fatal();
return;
}
}
};