================
@@ -980,7 +980,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation 
&DeclEnd) {
     if (getLangOpts().CPlusPlus11) {
       for (unsigned I = 0;; ++I) {
         const Token &T = GetLookAheadToken(I);
-        if (T.is(tok::r_paren))
+        if (T.isOneOf(tok::r_paren, tok::semi, tok::eof))
----------------
ojhunt wrote:

@cor3ntin That issue with `consumeClose()` returning false on semicolons (I 
_think_ it's more general than that) is responsible for a bunch of the bad 
(read: asserting) parsing failures that people have been posting ai+fuzzer 
"fixes" for. We have a bunch of paths through the parser that expect to be 
receiving either a failure or a specific ast node type, but the behavioral path 
they actually hit is `outernodeType(innerNodeType();` returning success and the 
inner node - see the terrible `asm((...)` parsing bug "fix" from a few a months 
ago.

The only reason I haven't sat down to actually change the behavior (towards the 
strict "if you don't have the expected closing paren you should not claim 
success" model) is my assumption that we have endless recovery paths that 
depend on it. Whether that's true I don't know - it's simply a story I tell 
myself to justify the current behavior :D



https://github.com/llvm/llvm-project/pull/187859
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to