Parser: Reject @c attributes using the string format

Reject `@c` attributes in the format of `@c("customName")` to accept
only `@c(customName)` and of course the bare `@c`.
This commit is contained in:
Alexis Laferrière
2025-09-23 16:43:19 -07:00
parent 659692e834
commit 7ec1d36215
2 changed files with 5 additions and 8 deletions

View File

@@ -3027,14 +3027,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
}
case DeclAttrKind::CDecl: {
if (!AttrName.starts_with("_") &&
// Backwards support for @c("stringId"). Remove before enabling in
// production so we accept only the identifier format.
lookahead(1, [&](CancellableBacktrackingScope &) {
return Tok.isNot(tok::string_literal);
})) {
if (AttrName == "c") {
std::optional<StringRef> CName;
if (consumeIfAttributeLParen()) {
// Custom C name.