[clang] [Clang][Lex] Implement CWG3013: Error if #embed parameters were defined as macros (PR #224769)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 07:21:52 PDT 2026


================
@@ -3771,6 +3771,10 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
 std::optional<LexEmbedParametersResult>
 Preprocessor::LexEmbedParameters(Token &CurTok, bool ForHasEmbed) {
   LexEmbedParametersResult Result{};
+  if (ForHasEmbed)
+    assert(isParsingIfOrElifDirective() &&
+           "__has_embed outside of #if or #elif directive?");
----------------
Fznamznon wrote:

That If that is just for an assert feels weird, can we
```suggestion
    assert(!ForHasEmbed || isParsingIfOrElifDirective() &&
           "__has_embed outside of #if or #elif directive?");
```

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


More information about the cfe-commits mailing list