[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 07:00:34 PST 2025
================
@@ -3401,6 +3401,40 @@ void Parser::DistributeCLateParsedAttrs(Decl *Dcl,
}
}
+/// type-qualifier:
+/// ('__ptrauth') '(' constant-expression
+/// (',' constant-expression)[opt]
+/// (',' constant-expression)[opt] ')'
+void Parser::ParsePtrauthQualifier(ParsedAttributes &attrs) {
+ assert(Tok.is(tok::kw___ptrauth));
+
+ IdentifierInfo *KwName = Tok.getIdentifierInfo();
+ SourceLocation KwLoc = ConsumeToken();
+
+ BalancedDelimiterTracker T(*this, tok::l_paren);
+ if (T.expectAndConsume())
+ return;
+
+ ArgsVector ArgExprs;
+ do {
+ ExprResult ER = ParseAssignmentExpression();
+ if (ER.isInvalid()) {
+ T.skipToEnd();
+ return;
+ }
+ ArgExprs.push_back(ER.get());
+ } while (TryConsumeToken(tok::comma));
----------------
AaronBallman wrote:
This doesn't match the grammar in the comment above -- it allows an arbitrary number of expressions to be parsed instead of failing when I'd expect it to.
https://github.com/llvm/llvm-project/pull/100830
More information about the cfe-commits
mailing list