[clang] Thread Safety Analysis: Fix crash with wide string literals (PR #180349)
Marco Elver via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 10 11:50:52 PST 2026
melver wrote:
> This should have a release note so users know about the fix.
We don't have a release with https://github.com/llvm/llvm-project/pull/148551 yet, which was landed last week. We might need a separate release note for https://github.com/llvm/llvm-project/pull/148551 itself though, but that's a separate PR.
> One thing I'm concerned by is that we have `compareString` functions which I don't think will expect this because those bytes may not be comparable. e.g., we do this:
>
> ```
> case ValueType::BT_String:
> return Cmp.compareStrings(as<StringRef>().value(),
> E->as<StringRef>().value());
> ```
>
> and is that actually going to work when we don't have a `StringRef` but instead have a bucket of bytes?
getBytes() returns a StringRef, and we have:
```
bool compareStrings (StringRef s, StringRef r) { return s == r; }
```
So it will just compare these bytes for equality (StringRef::operator== does memcmp). So if we have 2 wide-strings that are equal, they will match. I think that's the intent.
https://github.com/llvm/llvm-project/pull/180349
More information about the cfe-commits
mailing list