================
@@ -3686,14 +3686,14 @@ Preprocessor::LexEmbedParameters(Token &CurTok, bool 
ForHasEmbed) {
           std::pair<tok::TokenKind, SourceLocation> Matches) {
         Diag(CurTok, diag::err_expected) << Expected;
         Diag(Matches.second, diag::note_matching) << Matches.first;
-        if (CurTok.isNot(EndTokenKind))
----------------
a-tarasyuk wrote:

@shafik Thanks for the feedback. `LexEmbedParameters` is shared by `#embed` and 
`__has_embed(...)`, so `EndTokenKind` is still required to terminate normal 
parsing appropriately. 

This change only affects error recovery. `DiscardUntilEndOfDirective` is 
specifically intended to skip the remainder of the directive line, so once 
`CurTok` is already `tok::eod`, there is nothing left to discard, and the 
context-specific expected end token (e.g., `tok::r_paren` for `__has_embed`) is 
no longer relevant.

The added tests cover this behavior. Other scenarios appear to be handled by 
the existing `embed___has_embed_parsing_errors` tests; if there are additional 
edge cases to cover, please let me know.

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

Reply via email to