[clang] [Clang] prevent crash on unterminated __has_embed (PR #163107)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 15 05:49:49 PDT 2025
================
@@ -1280,6 +1275,9 @@ EmbedResult Preprocessor::EvaluateHasEmbed(Token &Tok, IdentifierInfo *II) {
return EmbedResult::Invalid;
}
+ if (Params->UnrecognizedParams > 0)
+ return EmbedResult::NotFound;
+
----------------
AaronBallman wrote:
> From what I understand, unknown parameters don’t trigger an error
They don't for `__has_embed` but they do for `#embed`. The idea is: you can use `__has_embed` to determine whether the `#embed` directive will succeed or not; so if the parameter is unknown, `__has_embed` should return false.
https://github.com/llvm/llvm-project/pull/163107
More information about the cfe-commits
mailing list