Remove some explicit calls to getName() when printing diagnostics; NFC
authorAaron Ballman <aaron@aaronballman.com>
Sat, 14 Mar 2020 21:00:45 +0000 (17:00 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Sat, 14 Mar 2020 21:01:45 +0000 (17:01 -0400)
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Sema/no-builtin.cpp
clang/test/SemaCXX/member-pointer-ms.cpp

index 4328e32..cc815a4 100644 (file)
@@ -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>,
index 3385717..476c9e6 100644 (file)
@@ -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;
 }
 
index 8908f38..392d847 100644 (file)
@@ -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;
index c8059ac..3271ff0 100644 (file)
@@ -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 {};