[PATCH] D26537: Fix llvm-symbolizer to correctly sort a symbol array and calculate symbol sizes

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 17:00:54 PST 2016


dberris accepted this revision.
dberris added a reviewer: dberris.
dberris added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Object/SymbolSize.cpp:19-25
+int llvm::object::compareAddress(const SymEntry *A, const SymEntry *B) {
   if (A->SectionID != B->SectionID)
-    return A->SectionID - B->SectionID;
-  return A->Address - B->Address;
+    return A->SectionID < B->SectionID ? -1 : 1;
+  if (A->Address != B->Address)
+    return A->Address < B->Address ? -1 : 1;
+  return 0;
 }
----------------
It would be good to document what the ordering guarantees are at the interface level for this function -- for instance, is this a strict weak ordering on (section id, address)?


https://reviews.llvm.org/D26537





More information about the llvm-commits mailing list