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

Konstantin Varlamov via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 20:35:02 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");
----------------
var-const wrote:

IMO it's completely reasonable to leave supporting Unicode as a potential follow-up, but I'm happy to know what currently is and isn't supported.

For the string length -- maybe let's try 128 or 256 characters? There isn't any specific size that we need to test -- just want some validation that passing a string longer than a short sentence won't cause any weird effects.


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


More information about the cfe-commits mailing list