[cfe-commits] r142566 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Thu Oct 20 07:50:05 PDT 2011


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

> Author: dblaikie
> Date: Wed Oct 19 21:49:08 2011
> New Revision: 142566
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=142566&view=rev
> Log:
> FixIt insert 'static' for anonymous unions at global or namespace scope.
> 
> Modified:
>    cfe/trunk/lib/Sema/SemaDecl.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=142566&r1=142565&r2=142566&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 19 21:49:08 2011
> @@ -2653,7 +2653,8 @@
>           (isa<TranslationUnitDecl>(Owner) ||
>            (isa<NamespaceDecl>(Owner) &&
>             cast<NamespaceDecl>(Owner)->getDeclName()))) {
> -        Diag(Record->getLocation(), diag::err_anonymous_union_not_static);
> +        Diag(Record->getLocation(), diag::err_anonymous_union_not_static)
> +          << FixItHint::CreateInsertion(Record->getLocation(), "static ");
>         Invalid = true;
> 
>         // Recover by adding 'static'.

Same comment as before: we must not set Invalid here, because we need to behave exactly as if the 'static' were there.

	- Doug



More information about the cfe-commits mailing list