================
@@ -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:

@AaronBallman @erichkeane Thanks for the valuable feedback!

Our motivation was that with `-fbounds-safety`, we would have a toolchain 
header defines this:
`#define __counted_by(c) __attribute__((__counted_by(c)__))` 

then the user code uses it as `__counted_by` spelling, 

we'd like it to be just printed as `__counted_by` and we don't want it to be 
printed as `__counted_by__` nor having a redundant aka (`__counted_by__` ) next 
to `__counted_by`.

Also, that was why we were limiting this change specifically to 
"system-defined" macros.

Does it make sense? I guess there might be a better way to implement this 
behavior in Clang?

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

Reply via email to