[clang] Add support for builtin_verbose_trap (PR #79230)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 09:45:32 PST 2024


================
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
+template <const char * const str>
+void f(const char * arg) {
+  __builtin_verbose_trap("Argument_must_not_be_null");
----------------
ahatanak wrote:

@philnik777 you are right. I'll enable unicode in follow-up patches using custom type checking.

@var-const 128 and 256 character strings should work without any problems. I don't think you'll see any problems with long strings unless you hit implementation limits of clang or lldb. I tested a 512 char string literal locally and both clang and lldb work fine.

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


More information about the cfe-commits mailing list