[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
Sun Nov 13 23:53:13 PST 2016


dberris added inline comments.


================
Comment at: unittests/Object/SymbolSizeTest.cpp:17-25
+  std::vector<SymEntry> Syms;
+  auto it = symbol_iterator(SymbolRef());
+  Syms.push_back(SymEntry{it, 0xffffffff00000000ull, 1, 0});
+  Syms.push_back(SymEntry{it, 0x00ffffff00000000ull, 2, 0});
+  Syms.push_back(SymEntry{it, 0x00ffffff000000ffull, 3, 0});
+  Syms.push_back(SymEntry{it, 0x0000000100000000ull, 4, 0});
+  Syms.push_back(SymEntry{it, 0x00000000000000ffull, 5, 0});
----------------
This looks like you can use an initialiser list instead:

```
auto it = symbol_iterator(SymbolRef());
std::vector<SymEntry> Syms{
  SymEntry{it, ...},
  SymEntry{it, ...}};
```


================
Comment at: unittests/Object/SymbolSizeTest.cpp:29-31
+  for (unsigned I = 0, N = Syms.size(); I < N - 1; ++I) {
+    EXPECT_LE(Syms[I].Address, Syms[I + 1].Address);
+  }
----------------
How about using something like `std::is_sorted(...)`?


================
Comment at: unittests/Object/SymbolSizeTest.cpp:33
+
+  EXPECT_EQ(1, 1);
+}
----------------
Do you even need this?


https://reviews.llvm.org/D26537





More information about the llvm-commits mailing list