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

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 09:49:04 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),
----------------
rapidsna wrote:

@erichkeane Currently, a note is emitted to show the line where it's expanded from that includes the original attribute spelling:  https://github.com/llvm/llvm-project/pull/107619/files#diff-3d962c5c4f372776e40887d273f9404efe3cd306f9915505d8566b791021914bR49

Not sure how I can suppress the follow-on note that lists macro expansions, but I can try the `ak_attr` approach as @AaronBallman suggested. 

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


More information about the cfe-commits mailing list