================
@@ -2040,6 +2040,10 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
       Diag(getLocForEndOfToken(Tok.getLocation()), diag::err_pp_expected_after)
         << Tok.getKind() << tok::r_paren;
       Diag(LParenLoc, diag::note_matching) << tok::l_paren;
+      // Don't lose an eod, eof, or annotation token while recovering from
+      // a missing ')'. Return it to the caller instead.
+      if (RParen.isOneOf(tok::eof, tok::eod) || RParen.isAnnotation())
+        Tok = RParen;
----------------
Sirraide wrote:

```suggestion
      if (RParen.isOneOf(tok::eof, tok::eod) || RParen.isAnnotation())
        Tok = RParen;
```
I think the comment doesn’t really add anything here. Also, can you rename 
`RParen` to `Next` or sth like that because it’s really confusing that it’s 
called `RParen` given that we have code here that explicitly handles the case 
of it _not_ being a `)` token

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

Reply via email to