[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 07:12:40 PDT 2024


================
@@ -1105,16 +1120,16 @@ enum AttributeDeclKind {
 
 inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                              const ParsedAttr &At) {
-  DB.AddTaggedVal(reinterpret_cast<uint64_t>(At.getAttrName()),
+  const IdentifierInfo *AttrName =
+      At.printAsMacro() ? At.getMacroIdentifier() : At.getAttrName();
+  DB.AddTaggedVal(reinterpret_cast<uint64_t>(AttrName),
----------------
AaronBallman wrote:

Instead of printing the macro name here, do we want to add a new tag `ak_attr` that takes a `ParsedAttr *` so that the diagnostics engine can automatically print both the macro name and the attribute name (with an aka)? Then we can suppress the follow-on note that lists macro expansions (maybe? If not, then maybe this is a bad idea because we're duplicating the information we show the user.)

https://github.com/llvm/llvm-project/pull/107619


More information about the cfe-commits mailing list