Fix a bug where the -Wmissing-noreturn would always treat constructors with base or member initializers as noreturn.

llvm-svn: 123603
This commit is contained in:
Anders Carlsson 2011-01-16 22:12:43 +00:00
parent 36ecb1f208
commit 128ddbf412
2 changed files with 23 additions and 0 deletions

View File

@ -131,6 +131,12 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) {
continue;
}
CFGElement CE = B[B.size()-1];
if (CFGInitializer CI = CE.getAs<CFGInitializer>()) {
// A base or member initializer.
HasPlainEdge = true;
continue;
}
CFGStmt CS = CE.getAs<CFGStmt>();
if (!CS.isValid())
continue;

View File

@ -50,3 +50,20 @@ void f_R7880658(R7880658 f, R7880658 l) { // no-warning
for (; f != l; ++f) {
}
}
namespace test2 {
bool g();
void *h() __attribute__((noreturn));
void *j();
struct A {
void *f;
A() : f(0) { }
A(int) : f(h()) { } // expected-warning {{function could be attribute 'noreturn'}}
A(char) : f(j()) { }
A(bool b) : f(b ? h() : j()) { }
};
}