MScarta wrote:

I pushed a second commit. While comparing this with #241359 I tested more kinds 
of string literal and found my own type check was too strict. It compared 
types, so it rejected u8 literals, which have 1-byte characters and which LLVM 
21 folds. I changed the check to compare character sizes instead, and added two 
test lines for it.

One side effect: `__builtin_wcslen` on a `u""` or `U""` literal cast to a 
`wchar_t` of the same size is folded. LLVM 21 did not fold this, but main 
already does, so it is not new here. I can restrict the fast path to matching 
types if you prefer.

I also replaced one of my test lines, because it gave the same result with and 
without the fix.

The description is updated to match.


https://github.com/llvm/llvm-project/pull/241354
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to