Add an assert to check atom ordinal.
authorRui Ueyama <ruiu@google.com>
Thu, 29 Jan 2015 22:39:43 +0000 (22:39 +0000)
committerRui Ueyama <ruiu@google.com>
Thu, 29 Jan 2015 22:39:43 +0000 (22:39 +0000)
No two atoms are allowed to have the same file and atom ordinals.
If there's such atoms, there's a bug in the reader.

llvm-svn: 227504

lld/lib/ReaderWriter/PECOFF/OrderPass.h

index 8f8b408..c1dc5c6 100644 (file)
@@ -42,6 +42,7 @@ static bool compareByPosition(const DefinedAtom *lhs, const DefinedAtom *rhs) {
   const File *rhsFile = &rhs->file();
   if (lhsFile->ordinal() != rhsFile->ordinal())
     return lhsFile->ordinal() < rhsFile->ordinal();
+  assert(lhs->ordinal() != rhs->ordinal());
   return lhs->ordinal() < rhs->ordinal();
 }