[llvm] [DebugNames] Compare TableEntry names more efficiently (PR #79759)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 12:07:57 PST 2024


felipepiovezan wrote:

> So the function could be written, I think, as return Data.size() >= Target.size() && strncmp(Data.data(), Target.data(), Target.size()) == 0 && !Data[Target.size()]; I think? Something like that

@dwblaikie I had to tweak this slightly: we want `Data.size() > Target.size()` instead of `>=`, because a (non-corrupt) string table name must be null terminated and `Data.size()` includes the `\0`.

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


More information about the llvm-commits mailing list