diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-06 11:31:06 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-06 11:31:06 +0000 |
commit | 8c44db50d646ae0d42c6473e096934c72fecdfd5 (patch) | |
tree | 4042eef7834e4fcb599fcb99b4cc3915e9338b53 | |
parent | 6e97a69200518ae26e64742b315dd8181ebda8e4 (diff) | |
download | bcm5719-llvm-8c44db50d646ae0d42c6473e096934c72fecdfd5.tar.gz bcm5719-llvm-8c44db50d646ae0d42c6473e096934c72fecdfd5.zip |
Diagnose enum redeclarations properly
In all three checks, the note indicates a previous declaration and never a 'use'.
Before:
enum-scoped.cpp:92:6: note: previous use is here
enum Redeclare6 : int;
^
After:
enum-scoped.cpp:92:6: note: previous declaration is here
enum Redeclare6 : int;
^
llvm-svn: 198600
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 | ||||
-rw-r--r-- | clang/test/SemaCXX/enum-scoped.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bdb8bbac72a..c17510ae8a7 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -10248,7 +10248,7 @@ bool Sema::CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, if (IsScoped != Prev->isScoped()) { Diag(EnumLoc, diag::err_enum_redeclare_scoped_mismatch) << Prev->isScoped(); - Diag(Prev->getLocation(), diag::note_previous_use); + Diag(Prev->getLocation(), diag::note_previous_declaration); return true; } @@ -10259,13 +10259,13 @@ bool Sema::CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, Prev->getIntegerType())) { Diag(EnumLoc, diag::err_enum_redeclare_type_mismatch) << EnumUnderlyingTy << Prev->getIntegerType(); - Diag(Prev->getLocation(), diag::note_previous_use); + Diag(Prev->getLocation(), diag::note_previous_declaration); return true; } } else if (IsFixed != Prev->isFixed()) { Diag(EnumLoc, diag::err_enum_redeclare_fixed_mismatch) << Prev->isFixed(); - Diag(Prev->getLocation(), diag::note_previous_use); + Diag(Prev->getLocation(), diag::note_previous_declaration); return true; } diff --git a/clang/test/SemaCXX/enum-scoped.cpp b/clang/test/SemaCXX/enum-scoped.cpp index b4aad18b17c..890fc05cf85 100644 --- a/clang/test/SemaCXX/enum-scoped.cpp +++ b/clang/test/SemaCXX/enum-scoped.cpp @@ -78,22 +78,22 @@ Complete2 complete2; // All the redeclarations below are done twice on purpose. Tests that the type // of the declaration isn't changed. -enum class Redeclare2; // expected-note{{previous use is here}} expected-note{{previous use is here}} +enum class Redeclare2; // expected-note{{previous declaration is here}} expected-note{{previous declaration is here}} enum Redeclare2; // expected-error{{previously declared as scoped}} enum Redeclare2; // expected-error{{previously declared as scoped}} -enum Redeclare3 : int; // expected-note{{previous use is here}} expected-note{{previous use is here}} +enum Redeclare3 : int; // expected-note{{previous declaration is here}} expected-note{{previous declaration is here}} enum Redeclare3; // expected-error{{previously declared with fixed underlying type}} enum Redeclare3; // expected-error{{previously declared with fixed underlying type}} enum class Redeclare5; enum class Redeclare5 : int; // ok -enum Redeclare6 : int; // expected-note{{previous use is here}} expected-note{{previous use is here}} +enum Redeclare6 : int; // expected-note{{previous declaration is here}} expected-note{{previous declaration is here}} enum Redeclare6 : short; // expected-error{{redeclared with different underlying type}} enum Redeclare6 : short; // expected-error{{redeclared with different underlying type}} -enum class Redeclare7; // expected-note{{previous use is here}} expected-note{{previous use is here}} +enum class Redeclare7; // expected-note{{previous declaration is here}} expected-note{{previous declaration is here}} enum class Redeclare7 : short; // expected-error{{redeclared with different underlying type}} enum class Redeclare7 : short; // expected-error{{redeclared with different underlying type}} |