From a75023d60fc22cef8c5c0e6ea79758233f4d2e2d Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 6 Dec 2008 20:05:35 +0000 Subject: [PATCH] Simplify some diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60626 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticKinds.def | 8 ++++---- lib/Sema/SemaDeclCXX.cpp | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 0205789bd8..0fcc4d9385 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -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") diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index ab8ae72427..bedf3f7d6b 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -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(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(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; } } -- 2.40.0