[llvm] [Object] Provide operator< for ELFSymbolRef (PR #89861)
Amir Ayupov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 09:33:09 PDT 2024
aaupov wrote:
> > > Also, is there a reason you provide `<` but not `==`? I note that `DataRefImpl` has both.
> >
> >
> > DataRefImpl's `operator==` is good enough for comparison.
>
> Why is DataRefImpl's `operator<` not good enough when the `operator==` is?
Sorry, I've made the commit message more clear. DataRefImpl's `operator<` uses std::memcmp whose result is endianness-dependent (as shown by added test), which is exactly the issue addressed by a custom `operator<` for ELFSymbolRefs.
`operator==` also uses std::memcmp but equality is invariant wrt endianness.
>
> Also, please try to avoid force pushes in active reviews, per the LLVM guidelines. If rebasing is necessary, consider merging `main` into your branch instead.
Noted, thank you.
https://github.com/llvm/llvm-project/pull/89861
More information about the llvm-commits
mailing list