[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


================
@@ -250,3 +258,39 @@
 
 #if __has_embed("") // expected-error {{empty filename}}
 #endif
+
+//--- test2.c
+// expected-error at +4 {{missing ')' after '__has_embed'}} \
+   expected-error at +4 {{expected value in expression}} \
+   expected-note at +4 {{to match this '('}} \
+   expected-error at +4 {{unterminated conditional directive}}
----------------
AaronBallman wrote:

Please add the `#endif` to each of these and then you can remove all the unterminated diagnostics.

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


More information about the cfe-commits mailing list