[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:38 PDT 2024
================
@@ -835,6 +835,17 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LA,
Diag(Tok, diag::warn_attribute_on_function_definition)
<< &LA.AttrName;
+ 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);
----------------
AaronBallman wrote:
What if no name is found?
https://github.com/llvm/llvm-project/pull/107619
More information about the cfe-commits
mailing list