Fix regression in -Wreturn-type caused by not
handling all CFGElement kinds. While writing
the test case, it turned out that return-noreturn.cpp
wasn't actually testing anything since it has the wrong -W
flag. That uncovered another regression with
the handling of destructors marked noreturn. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124238 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index 4866c8f..2f02e15 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -132,21 +132,12 @@
continue;
}
CFGElement CE = B[B.size()-1];
- if (CFGInitializer CI = CE.getAs<CFGInitializer>()) {
- // A base or member initializer.
+
+ if (!isa<CFGStmt>(CE)) {
HasPlainEdge = true;
continue;
}
- if (CFGMemberDtor MD = CE.getAs<CFGMemberDtor>()) {
- // A member destructor.
- HasPlainEdge = true;
- continue;
- }
- if (CFGBaseDtor BD = CE.getAs<CFGBaseDtor>()) {
- // A base destructor.
- HasPlainEdge = true;
- continue;
- }
+
CFGStmt CS = CE.getAs<CFGStmt>();
if (!CS.isValid())
continue;