[cfe-commits] r123603 - in /cfe/trunk: lib/Sema/AnalysisBasedWarnings.cpp test/SemaCXX/warn-missing-noreturn.cpp
Anders Carlsson
andersca at mac.com
Sun Jan 16 14:12:43 PST 2011
Author: andersca
Date: Sun Jan 16 16:12:43 2011
New Revision: 123603
URL: http://llvm.org/viewvc/llvm-project?rev=123603&view=rev
Log:
Fix a bug where the -Wmissing-noreturn would always treat constructors with base or member initializers as noreturn.
Modified:
cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
cfe/trunk/test/SemaCXX/warn-missing-noreturn.cpp
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=123603&r1=123602&r2=123603&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Sun Jan 16 16:12:43 2011
@@ -131,6 +131,12 @@
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;
Modified: cfe/trunk/test/SemaCXX/warn-missing-noreturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-missing-noreturn.cpp?rev=123603&r1=123602&r2=123603&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-missing-noreturn.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-missing-noreturn.cpp Sun Jan 16 16:12:43 2011
@@ -50,3 +50,20 @@
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()) { }
+ };
+
+}
More information about the cfe-commits
mailing list