Include pointee type information in the diagnostic for creating bad pointers or

arrays.

llvm-svn: 85550
This commit is contained in:
John McCall 2009-10-30 00:37:20 +00:00
parent 126193a9b5
commit 41b215eef6
2 changed files with 8 additions and 8 deletions

View File

@ -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<

View File

@ -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();
}