Simplify some diagnostics.

llvm-svn: 60626
This commit is contained in:
Anders Carlsson 2008-12-06 20:05:35 +00:00
parent 62293f4d97
commit 233a60d03e
2 changed files with 11 additions and 11 deletions

View File

@ -734,13 +734,13 @@ DIAG(err_mutable_nonmember, ERROR,
DIAG(err_virtual_non_function, ERROR,
"'virtual' can only appear on non-static member functions")
DIAG(err_not_bitfield_type, ERROR,
"cannot declare '%0' to be a bit-field type")
"cannot declare %0 to be a bit-field type")
DIAG(err_static_not_bitfield, ERROR,
"static member '%0' cannot be a bit-field")
"static member %0 cannot be a bit-field")
DIAG(err_not_integral_type_bitfield, ERROR,
"bit-field '%0' with non-integral type")
"bit-field %0 with non-integral type")
DIAG(err_member_initialization, ERROR,
"'%0' can only be initialized if it is a static const integral data member")
"%0 can only be initialized if it is a static const integral data member")
DIAG(err_implicit_object_parameter_init, ERROR,
"cannot initialize object parameter of type %0 with an expression of type %1")

View File

@ -525,14 +525,14 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
// FIXME: Emit diagnostic about only constructors taking base initializers
// or something similar, when constructor support is in place.
Diag(Loc, diag::err_not_bitfield_type)
<< Name.getAsString() << BitWidth->getSourceRange();
<< Name << BitWidth->getSourceRange();
InvalidDecl = true;
} else if (isInstField) {
// C++ 9.6p3: A bit-field shall have integral or enumeration type.
if (!cast<FieldDecl>(Member)->getType()->isIntegralType()) {
Diag(Loc, diag::err_not_integral_type_bitfield)
<< Name.getAsString() << BitWidth->getSourceRange();
<< Name << BitWidth->getSourceRange();
InvalidDecl = true;
}
@ -540,13 +540,13 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
// A function typedef ("typedef int f(); f a;").
// C++ 9.6p3: A bit-field shall have integral or enumeration type.
Diag(Loc, diag::err_not_integral_type_bitfield)
<< Name.getAsString() << BitWidth->getSourceRange();
<< Name << BitWidth->getSourceRange();
InvalidDecl = true;
} else if (isa<TypedefDecl>(Member)) {
// "cannot declare 'A' to be a bit-field type"
Diag(Loc, diag::err_not_bitfield_type)
<< Name.getAsString() << BitWidth->getSourceRange();
<< Name << BitWidth->getSourceRange();
InvalidDecl = true;
} else {
@ -555,7 +555,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
// C++ 9.6p3: A bit-field shall not be a static member.
// "static member 'A' cannot be a bit-field"
Diag(Loc, diag::err_static_not_bitfield)
<< Name.getAsString() << BitWidth->getSourceRange();
<< Name << BitWidth->getSourceRange();
InvalidDecl = true;
}
}
@ -577,14 +577,14 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
} else {
// not const integral.
Diag(Loc, diag::err_member_initialization)
<< Name.getAsString() << Init->getSourceRange();
<< Name << Init->getSourceRange();
InvalidDecl = true;
}
} else {
// not static member.
Diag(Loc, diag::err_member_initialization)
<< Name.getAsString() << Init->getSourceRange();
<< Name << Init->getSourceRange();
InvalidDecl = true;
}
}