From ac406052f7b980f8caa6b07b4a8d0867d53852c4 Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 30 Oct 2009 00:37:20 +0000 Subject: [PATCH] Include pointee type information in the diagnostic for creating bad pointers or arrays. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85550 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticSemaKinds.td | 8 ++++---- lib/Sema/SemaType.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index c5e86e7761..1ce4d91a17 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1330,17 +1330,17 @@ def err_flexible_array_init_nonempty : Error< def err_flexible_array_init_needs_braces : Error< "flexible array requires brace-enclosed initializer">; def err_illegal_decl_array_of_functions : Error< - "'%0' declared as array of functions">; + "'%0' declared as array of functions of type %1">; def err_illegal_decl_array_incomplete_type : Error< "array has incomplete element type %0">; def err_illegal_decl_array_of_references : Error< - "'%0' declared as array of references">; + "'%0' declared as array of references of type %1">; def err_array_star_outside_prototype : Error< "star modifier used outside of function prototype">; def err_illegal_decl_pointer_to_reference : Error< - "'%0' declared as a pointer to a reference">; + "'%0' declared as a pointer to a reference of type %1">; def err_illegal_decl_mempointer_to_reference : Error< - "'%0' declared as a member pointer to a reference">; + "'%0' declared as a member pointer to a reference of type %1">; def err_illegal_decl_mempointer_to_void : Error< "'%0' declared as a member pointer to void">; def err_illegal_decl_mempointer_in_nonclass : Error< diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index c135f43209..d2652c9864 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -472,7 +472,7 @@ QualType Sema::BuildPointerType(QualType T, unsigned Quals, if (T->isReferenceType()) { // C++ 8.3.2p4: There shall be no ... pointers to references ... Diag(Loc, diag::err_illegal_decl_pointer_to_reference) - << getPrintableNameForEntity(Entity); + << getPrintableNameForEntity(Entity) << T; return QualType(); } @@ -600,14 +600,14 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, if (T->isFunctionType()) { Diag(Loc, diag::err_illegal_decl_array_of_functions) - << getPrintableNameForEntity(Entity); + << getPrintableNameForEntity(Entity) << T; return QualType(); } // C++ 8.3.2p4: There shall be no ... arrays of references ... if (T->isReferenceType()) { Diag(Loc, diag::err_illegal_decl_array_of_references) - << getPrintableNameForEntity(Entity); + << getPrintableNameForEntity(Entity) << T; return QualType(); } @@ -811,7 +811,7 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class, // with reference type, or "cv void." if (T->isReferenceType()) { Diag(Loc, diag::err_illegal_decl_mempointer_to_reference) - << (Entity? Entity.getAsString() : "type name"); + << (Entity? Entity.getAsString() : "type name") << T; return QualType(); } -- 2.40.0