[llvm-commits] [llvm] r167866 - in /llvm/trunk: test/Object/coff-archive.test tools/llvm-nm/llvm-nm.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 13 11:39:56 PST 2012
Author: ddunbar
Date: Tue Nov 13 13:39:55 2012
New Revision: 167866
URL: http://llvm.org/viewvc/llvm-project?rev=167866&view=rev
Log:
llvm-nm: Make sort more stable when symbol names are equal.
Modified:
llvm/trunk/test/Object/coff-archive.test
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
Modified: llvm/trunk/test/Object/coff-archive.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/coff-archive.test?rev=167866&r1=167865&r2=167866&view=diff
==============================================================================
--- llvm/trunk/test/Object/coff-archive.test (original)
+++ llvm/trunk/test/Object/coff-archive.test Tue Nov 13 13:39:55 2012
@@ -153,8 +153,8 @@
CHECKIDX: 00000000 R ??_C at _0BC@IHENMCGI at b?5cannot?5be?5zero?$CB?$AA@
CHECKIDX: w ??_Einvalid_argument at std@@UAEPAXI at Z
CHECKIDX: w ??_Elogic_error at std@@UAEPAXI at Z
-CHECKIDX: U ??_Ginvalid_argument at std@@UAEPAXI at Z
CHECKIDX: 00000000 T ??_Ginvalid_argument at std@@UAEPAXI at Z
+CHECKIDX: U ??_Ginvalid_argument at std@@UAEPAXI at Z
CHECKIDX: 00000000 T ??_Glogic_error at std@@UAEPAXI at Z
CHECKIDX: U ??_Glogic_error at std@@UAEPAXI at Z
CHECKIDX: 00000000 D ??_R0?AVexception at std@@@8
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=167866&r1=167865&r2=167866&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Tue Nov 13 13:39:55 2012
@@ -150,6 +150,8 @@
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 @@
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;
More information about the llvm-commits
mailing list