[cfe-commits] r120577 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp
Douglas Gregor
dgregor at apple.com
Wed Dec 1 08:10:38 PST 2010
Author: dgregor
Date: Wed Dec 1 10:10:38 2010
New Revision: 120577
URL: http://llvm.org/viewvc/llvm-project?rev=120577&view=rev
Log:
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
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=120577&r1=120576&r2=120577&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Dec 1 10:10:38 2010
@@ -879,7 +879,7 @@
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<
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=120577&r1=120576&r2=120577&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Dec 1 10:10:38 2010
@@ -5961,7 +5961,10 @@
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;
}
More information about the cfe-commits
mailing list