[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 08:04:05 PDT 2025


================
@@ -488,6 +488,13 @@ unsigned Parser::ParseAttributeArgsCommon(
   bool AttributeHasVariadicIdentifierArg =
       attributeHasVariadicIdentifierArg(*AttrName, Form.getSyntax(), ScopeName);
 
+  if (Tok.is(tok::hash) || Tok.is(tok::hashhash)) {
----------------
AaronBallman wrote:

@cor3ntin do we need to distinguish between valid preprocessor tokens and invalid post-phase-7 tokens?

I *think* the only tokens that aren't valid post phase 7 is hash, but I'm not certain what we're supposed to do with things like `%:` `%:%:` which are digraphs for hash. Are those supposed to also be rejected?

https://github.com/llvm/llvm-project/pull/147308


More information about the cfe-commits mailing list