================ @@ -5055,6 +5058,17 @@ void Parser::ParseLexedCAttribute(LateParsedAttribute &LA, bool EnterScope, ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, nullptr, nullptr, SourceLocation(), ParsedAttr::Form::GNU(), nullptr); + const auto &SM = PP.getSourceManager(); + CharSourceRange ExpansionRange = SM.getExpansionRange(LA.AttrNameLoc); + StringRef FoundName = + Lexer::getSourceText(ExpansionRange, SM, PP.getLangOpts()) + .split('(') + .first; + IdentifierInfo *MacroII = PP.getIdentifierInfo(FoundName); + for (unsigned i = 0; i < Attrs.size(); ++i) + Attrs[i].setMacroIdentifier(MacroII, ExpansionRange.getBegin(), ---------------- erichkeane wrote:
Does this not do weird things when trying to print an attribute when multiple are defined by the same one? Do you have good examples of this use case? Also, I find myself wondering if we should just use `MacroIdentifier != nullptr` instead of this? Or alternatively... does the `attrRange` in the `ParsedAttr` have this information we could just use to look it up later? 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