forked from OSchip/llvm-project
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:
parent
36ecb1f208
commit
128ddbf412
|
@ -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;
|
||||
|
|
|
@ -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()) { }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue