[clang] [Clang] Avoid crash with wide string CPU builtin argument (PR #245515)

Bhavya Gautam via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 29 02:14:57 PST 2026


================
@@ -897,6 +897,8 @@ def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
 def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
   "%select{GCP|CDE}1">;
 def warn_invalid_cpu_supports : Warning<"invalid cpu feature string for builtin">;
+def err_cpu_builtin_string_literal_char_width : Error<
+  "CPU builtin argument must be a narrow string literal">;
----------------
gautam899 wrote:

It does match. I have added the new test file for the case when compiled with the flag "-Wno-error=incompatible-pointer-types". In the case, the error->"incompatible pointer types" is downgraded to a warning. I believe it's not required to add the entire message "CPU builtin argument must be a narrow string literal" in the test file, as -verify only verifies if the text inside {{..}} a substring of the diagnostic.

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


More information about the cfe-commits mailing list