[cfe-commits] r142565 - in /cfe/trunk: include/clang/Basic/ExpressionTraits.h lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Thu Oct 20 07:49:02 PDT 2011


On Oct 19, 2011, at 7:10 PM, David Blaikie wrote:

> Author: dblaikie
> Date: Wed Oct 19 21:10:55 2011
> New Revision: 142565
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=142565&view=rev
> Log:
> Add a fixit to remove storage specifiers on anonymous enums.
> 
> Modified:
>    cfe/trunk/include/clang/Basic/ExpressionTraits.h
>    cfe/trunk/lib/Sema/SemaDecl.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/ExpressionTraits.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/ExpressionTraits.h?rev=142565&r1=142564&r2=142565&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/ExpressionTraits.h (original)
> +++ cfe/trunk/include/clang/Basic/ExpressionTraits.h Wed Oct 19 21:10:55 2011
> @@ -1,4 +1,4 @@
> -//===--- ExpressionTraits.h - C++ Expression Traits Support Enumerations --===//
> +//===- ExpressionTraits.h - C++ Expression Traits Support Enums -*- C++ -*-===//
> //
> //                     The LLVM Compiler Infrastructure
> //
> 
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=142565&r1=142564&r2=142565&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 19 21:10:55 2011
> @@ -2666,7 +2666,8 @@
>       else if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified &&
>                isa<RecordDecl>(Owner)) {
>         Diag(DS.getStorageClassSpecLoc(),
> -             diag::err_anonymous_union_with_storage_spec);
> +             diag::err_anonymous_union_with_storage_spec)
> +          << FixItHint::CreateRemoval(DS.getStorageClassSpecLoc());
>         Invalid = true;
> 
>         // Recover by removing the storage specifier.


When we emit a Fix-It for an error, we need to recover exactly as if the user had written the code we're telling them to fix (so we see any errors caused by bad Fix-Its). In this case, that means we must not set the Invalid bit; it already appears that we correctly drop the storage specifier.

	- Doug



More information about the cfe-commits mailing list