[clang] [Clang] prevent assertion in __has_embed parameter recovery at end-of-directive (PR #175104)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 18:05:04 PST 2026


================
@@ -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))
----------------
shafik wrote:

`EndTokenKind` is used in a few more places in this function, is it correct at all? We also have a `CurTok.isOneOf(EndTokenKind, tok::eod)` as well. 

Can you also confirm we have a test that hits each case? I am surprised this change does not effect any tests, so I guess it was always wrong and we just did not have tests?

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


More information about the cfe-commits mailing list