[llvm-branch-commits] [cfe-branch] r167775 - in /cfe/branches/release_32: ./ lib/Sema/AnalysisBasedWarnings.cpp test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp test/SemaCXX/warn-unreachable.cpp
Ted Kremenek
kremenek at apple.com
Mon Nov 12 15:01:51 PST 2012
Author: kremenek
Date: Mon Nov 12 17:01:51 2012
New Revision: 167775
URL: http://llvm.org/viewvc/llvm-project?rev=167775&view=rev
Log:
Merge in r167749, per discussion on cfe-dev that we want -Wimplicit-fallthrough to only be active for C++11
until we come up with a language annotation for this warning that works outside of C++11.
Modified:
cfe/branches/release_32/ (props changed)
cfe/branches/release_32/lib/Sema/AnalysisBasedWarnings.cpp
cfe/branches/release_32/test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp
cfe/branches/release_32/test/SemaCXX/warn-unreachable.cpp (props changed)
Propchange: cfe/branches/release_32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 12 17:01:51 2012
@@ -1,2 +1,3 @@
/cfe/branches/type-system-rewrite:134693-134817
+/cfe/trunk:167749
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_32/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/lib/Sema/AnalysisBasedWarnings.cpp?rev=167775&r1=167774&r2=167775&view=diff
==============================================================================
--- cfe/branches/release_32/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/branches/release_32/lib/Sema/AnalysisBasedWarnings.cpp Mon Nov 12 17:01:51 2012
@@ -818,6 +818,18 @@
static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
bool PerFunction) {
+ // Only perform this analysis when using C++11. There is no good workflow
+ // for this warning when not using C++11. There is no good way to silence
+ // the warning (no attribute is available) unless we are using C++11's support
+ // for generalized attributes. Once could use pragmas to silence the warning,
+ // but as a general solution that is gross and not in the spirit of this
+ // warning.
+ //
+ // NOTE: This an intermediate solution. There are on-going discussions on
+ // how to properly support this warning outside of C++11 with an annotation.
+ if (!AC.getASTContext().getLangOpts().CPlusPlus0x)
+ return;
+
FallthroughMapper FM(S);
FM.TraverseStmt(AC.getBody());
Modified: cfe/branches/release_32/test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp?rev=167775&r1=167774&r2=167775&view=diff
==============================================================================
--- cfe/branches/release_32/test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp (original)
+++ cfe/branches/release_32/test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp Mon Nov 12 17:01:51 2012
@@ -1,5 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wimplicit-fallthrough %s
+// XFAIL: *
+// NOTE: This test is marked XFAIL until we come up with a good language design
+// for a worfklow to use this warning outside of C++11.
int fallthrough(int n) {
switch (n / 10) {
Propchange: cfe/branches/release_32/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 12 17:01:51 2012
@@ -1,2 +1,2 @@
/cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,167749
More information about the llvm-branch-commits
mailing list