r226626 - Sema: err_after_alias is unreachable, remove it
Richard Smith
richard at metafoo.co.uk
Tue Jan 20 17:24:12 PST 2015
On Tue, Jan 20, 2015 at 4:52 PM, David Majnemer
<david.majnemer at gmail.com> wrote:
> Author: majnemer
> Date: Tue Jan 20 18:52:17 2015
> New Revision: 226626
>
> URL: http://llvm.org/viewvc/llvm-project?rev=226626&view=rev
> Log:
> Sema: err_after_alias is unreachable, remove it
>
> Examples this would have catched are now handled by the attribute
> verification code.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/Sema/alias-redefinition.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=226626&r1=226625&r2=226626&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jan 20 18:52:17 2015
> @@ -3902,8 +3902,6 @@ def warn_missing_variable_declarations :
> def err_static_data_member_reinitialization :
> Error<"static data member %0 already has an initializer">;
> def err_redefinition : Error<"redefinition of %0">;
> -def err_alias_after_tentative :
> - Error<"alias definition of %0 after tentative definition">;
> def err_alias_is_definition :
> Error<"definition %0 cannot also be an alias">;
> def err_definition_of_implicitly_declared_member : Error<
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=226626&r1=226625&r2=226626&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 20 18:52:17 2015
> @@ -2223,11 +2223,7 @@ static void checkNewAttributesAfterDef(S
> S.CheckForFunctionRedefinition(FD, cast<FunctionDecl>(Def));
> else {
> VarDecl *VD = cast<VarDecl>(New);
> - unsigned Diag = cast<VarDecl>(Def)->isThisDeclarationADefinition() ==
> - VarDecl::TentativeDefinition
> - ? diag::err_alias_after_tentative
> - : diag::err_redefinition;
> - S.Diag(VD->getLocation(), Diag) << VD->getDeclName();
> + S.Diag(VD->getLocation(), diag::err_redefinition) << VD->getDeclName();
> S.Diag(Def->getLocation(), diag::note_previous_definition);
> VD->setInvalidDecl();
> }
>
> Modified: cfe/trunk/test/Sema/alias-redefinition.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/alias-redefinition.c?rev=226626&r1=226625&r2=226626&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/alias-redefinition.c (original)
> +++ cfe/trunk/test/Sema/alias-redefinition.c Tue Jan 20 18:52:17 2015
> @@ -28,3 +28,7 @@ static int var2 __attribute((alias("v2")
>
> extern int var3 __attribute__((alias("C"))); // expected-note{{previous definition is here}}
> int var3 = 3; // expected-error{{redefinition of 'var3'}}
> +
> +int v4;
> +int var4;
> +int var4 __attribute((alias("v4"))); // expected-error {{definition 'var4' cannot also be an alias}}
What about:
int var4;
extern int var4 __attribute__((alias("v4")));
?
More information about the cfe-commits
mailing list