[cfe-commits] r158545 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/AnalysisBasedWarnings.cpp test/SemaCXX/switch-implicit-fallthrough-per-method.cpp

Sean Hunt scshunt at csclub.uwaterloo.ca
Fri Jun 15 14:22:06 PDT 2012


Author: coppro
Date: Fri Jun 15 16:22:05 2012
New Revision: 158545

URL: http://llvm.org/viewvc/llvm-project?rev=158545&view=rev
Log:
Stop referring to functions as methods in per-function fallthrough-checking.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
    cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=158545&r1=158544&r2=158545&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Jun 15 16:22:05 2012
@@ -209,9 +209,10 @@
 def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
 def SwitchEnum     : DiagGroup<"switch-enum">;
 def Switch         : DiagGroup<"switch">;
-def ImplicitFallthroughPerMethod : DiagGroup<"implicit-fallthrough-per-method">;
+def ImplicitFallthroughPerFunction :
+  DiagGroup<"implicit-fallthrough-per-function">;
 def ImplicitFallthrough  : DiagGroup<"implicit-fallthrough",
-                                     [ImplicitFallthroughPerMethod]>;
+                                     [ImplicitFallthroughPerFunction]>;
 def Trigraphs      : DiagGroup<"trigraphs">;
 
 def : DiagGroup<"type-limits">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=158545&r1=158544&r2=158545&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jun 15 16:22:05 2012
@@ -5316,9 +5316,9 @@
 def warn_unannotated_fallthrough : Warning<
   "unannotated fall-through between switch labels">,
   InGroup<ImplicitFallthrough>, DefaultIgnore;
-def warn_unannotated_fallthrough_per_method : Warning<
-  "unannotated fall-through between switch labels in partly annotated method">,
-  InGroup<ImplicitFallthroughPerMethod>, DefaultIgnore;
+def warn_unannotated_fallthrough_per_function : Warning<
+  "unannotated fall-through between switch labels in partly-annotated "
+  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
 def note_insert_fallthrough_fixit : Note<
   "insert '[[clang::fallthrough]];' to silence this warning">;
 def note_insert_break_fixit : Note<

Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=158545&r1=158544&r2=158545&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Fri Jun 15 16:22:05 2012
@@ -821,14 +821,14 @@
 }
 
 static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
-                                            bool PerMethod) {
+                                            bool PerFunction) {
   FallthroughMapper FM(S);
   FM.TraverseStmt(AC.getBody());
 
   if (!FM.foundSwitchStatements())
     return;
 
-  if (PerMethod && FM.getFallthroughStmts().empty())
+  if (PerFunction && FM.getFallthroughStmts().empty())
     return;
 
   CFG *Cfg = AC.getCFG();
@@ -849,8 +849,8 @@
       continue;
 
     S.Diag(Label->getLocStart(),
-        PerMethod ? diag::warn_unannotated_fallthrough_per_method
-                  : diag::warn_unannotated_fallthrough);
+        PerFunction ? diag::warn_unannotated_fallthrough_per_function
+                    : diag::warn_unannotated_fallthrough);
 
     if (!AnnotatedCnt) {
       SourceLocation L = Label->getLocStart();
@@ -1339,10 +1339,10 @@
   bool FallThroughDiagFull =
       Diags.getDiagnosticLevel(diag::warn_unannotated_fallthrough,
                                D->getLocStart()) != DiagnosticsEngine::Ignored;
-  bool FallThroughDiagPerMethod =
-      Diags.getDiagnosticLevel(diag::warn_unannotated_fallthrough_per_method,
+  bool FallThroughDiagPerFunction =
+      Diags.getDiagnosticLevel(diag::warn_unannotated_fallthrough_per_function,
                                D->getLocStart()) != DiagnosticsEngine::Ignored;
-  if (FallThroughDiagFull || FallThroughDiagPerMethod) {
+  if (FallThroughDiagFull || FallThroughDiagPerFunction) {
     DiagnoseSwitchLabelsFallthrough(S, AC, !FallThroughDiagFull);
   }
 

Modified: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp?rev=158545&r1=158544&r2=158545&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp (original)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp Fri Jun 15 16:22:05 2012
@@ -1,18 +1,18 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough-per-method %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough-per-function %s
 
 
 int fallthrough(int n) {
   switch (n / 10) {
     case 0:
       n += 100;
-    case 1:  // expected-warning{{unannotated fall-through between switch labels in partly annotated method}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
+    case 1:  // expected-warning{{unannotated fall-through}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
       switch (n) {
       case 111:
         n += 111;
         [[clang::fallthrough]];
       case 112:
         n += 112;
-      case 113:  // expected-warning{{unannotated fall-through between switch labels in partly annotated method}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
+      case 113:  // expected-warning{{unannotated fall-through}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
         n += 113;
         break    ;
       }





More information about the cfe-commits mailing list