================
@@ -506,7 +506,15 @@ void clang::FormatASTNodeDiagnosticArgument(
     case DiagnosticsEngine::ak_attr: {
       const Attr *At = reinterpret_cast<Attr *>(Val);
       assert(At && "Received null Attr object!");
-      OS << '\'' << At->getSpelling() << '\'';
+
+      OS << '\'';
+      if (At->hasScope()) {
----------------
a-tarasyuk wrote:

@AaronBallman This kind is used here

https://github.com/llvm/llvm-project/blob/cf3d136c225361c9a3d1488cd285c784fd6a2a92/clang/include/clang/AST/Attr.h#L383-L387

Some custom attributes don’t explicitly set a name from the parsed attribute - 
for example:

https://github.com/llvm/llvm-project/blob/ec48d15b2003253e26d9f902b252f92e89a114e2/clang/lib/Sema/SemaHLSL.cpp#L704-L706

Instead, these attributes derive their name from the spelling, which is part of 
`Attr`.

https://github.com/llvm/llvm-project/blob/cf3d136c225361c9a3d1488cd285c784fd6a2a92/clang/include/clang/AST/Attr.h#L95

This _kind_ can likely be removed, and the logic for handling custom attributes 
without an explicit name can be moved into the overload. In that overload, we 
can either use a string-based kind directly or delegate to the 
`AttributeCommonInfo` overload




https://github.com/llvm/llvm-project/pull/144619
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to