diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-12-01 16:10:38 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-12-01 16:10:38 +0000 |
| commit | 1a099ba4db7021e8851ebbe0ad360118a7e0c27e (patch) | |
| tree | d174cdc07133e8921704e732d8d7a94cb8a6e2be /clang | |
| parent | ec0e36616333f332534d6759a07dabf596c04b70 (diff) | |
| download | bcm5719-llvm-1a099ba4db7021e8851ebbe0ad360118a7e0c27e.tar.gz bcm5719-llvm-1a099ba4db7021e8851ebbe0ad360118a7e0c27e.zip | |
Improve the diagnostic when the fixed underlying type of a
redeclaration of an enum type differs from that of the original
declaration, from Daniel Wallin
llvm-svn: 120577
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 3c5c9b32e50..eb386fccee5 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -879,7 +879,7 @@ def ext_enumerator_too_large : ExtWarn< def err_enumerator_wrapped : Error< "enumerator value %0 is not representable in the underlying type %1">; def err_enum_redeclare_type_mismatch : Error< - "enumeration redeclared with different underlying type">; + "enumeration redeclared with different underlying type %0 (was %1)">; def err_enum_redeclare_fixed_mismatch : Error< "enumeration previously declared with %select{non|}0fixed underlying type">; def err_enum_redeclare_scoped_mismatch : Error< diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a3b8b8ec30f..786a13f1d34 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5961,7 +5961,10 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, T = QualType(EnumUnderlying.get<const Type*>(), 0); if (!Context.hasSameUnqualifiedType(T, PrevEnum->getIntegerType())) { - Diag(KWLoc, diag::err_enum_redeclare_type_mismatch); + Diag(NameLoc.isValid() ? NameLoc : KWLoc, + diag::err_enum_redeclare_type_mismatch) + << T + << PrevEnum->getIntegerType(); Diag(PrevTagDecl->getLocation(), diag::note_previous_use); return PrevTagDecl; } |

