[llvm] [Object] Provide operator< for ELFSymbolRef (PR #89861)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 00:39:59 PDT 2024


================
@@ -1504,3 +1504,39 @@ TEST(ELFObjectFileTest, GetSectionAndRelocations) {
                "SHT_RELA section with index 1: failed to get a "
                "relocated section: invalid section index: 255");
 }
+
+TEST(ELFObjectFileTest, ELFSymbolRefLess) {
----------------
jh7370 wrote:

As far as I see, this test only covers one of the cases that are relevant, i.e. symbol table indexes are equal and the left has a lower symbol index than the right. There are quite a few more cases that are interesting, I think, specifically all the cases in the following list:
* symtab index match:
  * left sym index is lower (this is the one you have already)
  * right sym index is lower (this could be achieved by just reversing the order in the comparison)
  * sym indexes match (this could be achieved by comparing one object with itself)
* left symtab index is lower than right
  * left sym index is lower
  * right sym index is lower
  * sym indexes match
* right symtab index is lower than left
  * left sym index is lower
  * right sym index is lower
  * sym indexes match

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


More information about the llvm-commits mailing list