[clang] [CIR] Ensure strings are null-terminated, better deal with trailing null (PR #185513)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 14:48:41 PDT 2026


erichkeane wrote:

I realized after I submitted that case for testing: string literals in C/C++ are auto-null-terminated by the frontend, so there is no test difference between the two.  This patch will still 'remove' it from the CIR literal to put into the 'trailing-zeros' but that is going to be of zero consequence (and still results in the same CIR), while still permitting some constant merging that otherwise would be more difficult to find (common initial sequence/terminating sequence optimizations).

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


More information about the cfe-commits mailing list