Author: Aaron Ballman Date: 2020-03-14T17:01:45-04:00 New Revision: dab43c85920cd80b919265936e319f9583c8b4e8
URL: https://github.com/llvm/llvm-project/commit/dab43c85920cd80b919265936e319f9583c8b4e8 DIFF: https://github.com/llvm/llvm-project/commit/dab43c85920cd80b919265936e319f9583c8b4e8.diff LOG: Remove some explicit calls to getName() when printing diagnostics; NFC Added: Modified: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaDeclAttr.cpp clang/test/Sema/no-builtin.cpp clang/test/SemaCXX/member-pointer-ms.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 4328e322b914..cc815a4993d5 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3461,7 +3461,7 @@ def warn_use_of_temp_in_invalid_state : Warning< "invalid invocation of method '%0' on a temporary object while it is in the " "'%1' state">, InGroup<Consumed>, DefaultIgnore; def warn_attr_on_unconsumable_class : Warning< - "consumed analysis attribute is attached to member of class '%0' which isn't " + "consumed analysis attribute is attached to member of class %0 which isn't " "marked as consumable">, InGroup<Consumed>, DefaultIgnore; def warn_return_typestate_for_unconsumable_type : Warning< "return state set for an unconsumable type '%0'">, InGroup<Consumed>, diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 3385717e3138..476c9e635b45 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1099,7 +1099,7 @@ static void handleNoBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL) { AddBuiltinName(BuiltinName); else S.Diag(LiteralLoc, diag::warn_attribute_no_builtin_invalid_builtin_name) - << BuiltinName << AL.getAttrName()->getName(); + << BuiltinName << AL; } // Repeating the same attribute is fine. @@ -1110,7 +1110,7 @@ static void handleNoBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL) { if (HasWildcard && Names.size() > 1) S.Diag(D->getLocation(), diag::err_attribute_no_builtin_wildcard_or_builtin_name) - << AL.getAttrName()->getName(); + << AL; if (D->hasAttr<NoBuiltinAttr>()) D->dropAttr<NoBuiltinAttr>(); @@ -1176,8 +1176,7 @@ static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD, if (const CXXRecordDecl *RD = ThisType->getAsCXXRecordDecl()) { if (!RD->hasAttr<ConsumableAttr>()) { - S.Diag(AL.getLoc(), diag::warn_attr_on_unconsumable_class) << - RD->getNameAsString(); + S.Diag(AL.getLoc(), diag::warn_attr_on_unconsumable_class) << RD; return false; } @@ -3676,7 +3675,7 @@ void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E) { if (!T->isDependentType() && !T->isAnyPointerType() && !T->isReferenceType() && !T->isMemberPointerType()) { Diag(AttrLoc, diag::warn_attribute_pointer_or_reference_only) - << &TmpAttr /*TmpAttr.getName()*/ << T << D->getSourceRange(); + << &TmpAttr << T << D->getSourceRange(); return; } @@ -3915,8 +3914,7 @@ bool Sema::checkMSInheritanceAttrOnDefinition( Diag(Range.getBegin(), diag::err_mismatched_ms_inheritance) << 0 /*definition*/; - Diag(RD->getDefinition()->getLocation(), diag::note_defined_here) - << RD->getNameAsString(); + Diag(RD->getDefinition()->getLocation(), diag::note_defined_here) << RD; return true; } diff --git a/clang/test/Sema/no-builtin.cpp b/clang/test/Sema/no-builtin.cpp index 8908f38333bd..392d847f98aa 100644 --- a/clang/test/Sema/no-builtin.cpp +++ b/clang/test/Sema/no-builtin.cpp @@ -17,11 +17,11 @@ void many_attribute_function_4() __attribute__((no_builtin("memcpy", "memcpy"))) /// Invalid builtin name. void invalid_builtin() __attribute__((no_builtin("not_a_builtin"))) {} -// expected-warning@-1 {{'not_a_builtin' is not a valid builtin name for no_builtin}} +// expected-warning@-1 {{'not_a_builtin' is not a valid builtin name for 'no_builtin'}} /// Can't use bare no_builtin with a named one. void wildcard_and_functionname() __attribute__((no_builtin)) __attribute__((no_builtin("memcpy"))) {} -// expected-error@-1 {{empty no_builtin cannot be composed with named ones}} +// expected-error@-1 {{empty 'no_builtin' cannot be composed with named ones}} /// Can't attach attribute to a variable. int __attribute__((no_builtin)) variable; diff --git a/clang/test/SemaCXX/member-pointer-ms.cpp b/clang/test/SemaCXX/member-pointer-ms.cpp index c8059acd6737..3271ff0c623a 100644 --- a/clang/test/SemaCXX/member-pointer-ms.cpp +++ b/clang/test/SemaCXX/member-pointer-ms.cpp @@ -239,11 +239,11 @@ template <typename T> struct __multiple_inheritance A<T, T>; // expected-warning@-1 {{inheritance model ignored on partial specialization}} template <> struct __single_inheritance A<int, float>; -struct B {}; // expected-note {{B defined here}} +struct B {}; // expected-note {{'B' defined here}} struct __multiple_inheritance B; // expected-error{{inheritance model does not match definition}} struct __multiple_inheritance C {}; // expected-error{{inheritance model does not match definition}} - // expected-note@-1 {{C defined here}} + // expected-note@-1 {{'C' defined here}} struct __virtual_inheritance D; struct D : virtual B {}; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits