diff options
-rw-r--r-- | lld/lib/Core/DefinedAtom.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lld/lib/Core/DefinedAtom.cpp b/lld/lib/Core/DefinedAtom.cpp index fd9f23d7fba..bb884771b08 100644 --- a/lld/lib/Core/DefinedAtom.cpp +++ b/lld/lib/Core/DefinedAtom.cpp @@ -83,12 +83,15 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) { bool DefinedAtom::compareByPosition(const DefinedAtom *lhs, const DefinedAtom *rhs) { - const File *lhsFile = &lhs->file(); - const File *rhsFile = &rhs->file(); + const File *lhsFile; + const File *rhsFile; if (lhs == rhs) return false; + lhsFile = &lhs->file(); + rhsFile = &rhs->file(); + if (lhsFile->ordinal() != rhsFile->ordinal()) return lhsFile->ordinal() < rhsFile->ordinal(); assert(lhs->ordinal() != rhs->ordinal()); |