diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-11-13 19:39:55 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-11-13 19:39:55 +0000 |
commit | ed074e9a1b69a55e91d9f8976cdced3a06d6058a (patch) | |
tree | 95e14b86fb03f56ff73b3d3c9f914eef9c8e0be6 /tools/llvm-nm | |
parent | ba6086818d9c5070061f74ac9944666b4312c6f0 (diff) |
llvm-nm: Make sort more stable when symbol names are equal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-nm')
-rw-r--r-- | tools/llvm-nm/llvm-nm.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 153de95293..27efd74264 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -150,6 +150,8 @@ namespace { return true; else if (a.Address == b.Address && a.Name < b.Name) return true; + else if (a.Address == b.Address && a.Name == b.Name && a.Size < b.Size) + return true; else return false; @@ -160,12 +162,21 @@ namespace { return true; else if (a.Size == b.Size && a.Name < b.Name) return true; + else if (a.Size == b.Size && a.Name == b.Name && a.Address < b.Address) + return true; else return false; } static bool CompareSymbolName(const NMSymbol &a, const NMSymbol &b) { - return a.Name < b.Name; + if (a.Name < b.Name) + return true; + else if (a.Name == b.Name && a.Size < b.Size) + return true; + else if (a.Name == b.Name && a.Size == b.Size && a.Address < b.Address) + return true; + else + return false; } StringRef CurrentFilename; |