mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user