r178543 - Fixed "fallthrough annotation does not directly precede switch label" warning in

Jordan Rose jordan_rose at apple.com
Tue Apr 2 09:16:42 PDT 2013


Is there any reason why this can't go in one of the existing test files? We try not to increase the number of test files at a whim because each one has a nonzero startup time.

On Apr 2, 2013, at 8:20 , Alexander Kornienko <alexfh at google.com> wrote:

> Author: alexfh
> Date: Tue Apr  2 10:20:32 2013
> New Revision: 178543
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=178543&view=rev
> Log:
> Fixed "fallthrough annotation does not directly precede switch label" warning in
> case when [[clang::fallthrough]]; is used in a method of a local class.
> 
> Added:
>    cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-regression.cpp
> Modified:
>    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
> 
> Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=178543&r1=178542&r2=178543&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
> +++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Tue Apr  2 10:20:32 2013
> @@ -817,6 +817,10 @@ namespace {
>       return true;
>     }
> 
> +    // We don't want to traverse local type declarations. We analyze their
> +    // methods separately.
> +    bool TraverseDecl(Decl *D) { return true; }
> +
>   private:
> 
>     static const AttributedStmt *asFallThroughAttr(const Stmt *S) {
> 
> Added: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-regression.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-regression.cpp?rev=178543&view=auto
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-regression.cpp (added)
> +++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-regression.cpp Tue Apr  2 10:20:32 2013
> @@ -0,0 +1,17 @@
> +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough %s
> +
> +void f() {
> +  class C {
> +    void f(int x) {
> +      switch (x) {
> +        case 0:
> +          x++;
> +          [[clang::fallthrough]]; // expected-no-diagnostics
> +        case 1:
> +          x++;
> +          break;
> +      }
> +    }
> +  };
> +}
> +
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list