mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-14 20:57:01 +00:00
AsmMatcher: Ensure classes are totally ordered, so we can std::sort them reliably.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104806 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cdef41a6b4
commit
368a456503
@ -388,6 +388,9 @@ public:
|
|||||||
|
|
||||||
/// operator< - Compare two classes.
|
/// operator< - Compare two classes.
|
||||||
bool operator<(const ClassInfo &RHS) const {
|
bool operator<(const ClassInfo &RHS) const {
|
||||||
|
if (this == &RHS)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Unrelated classes can be ordered by kind.
|
// Unrelated classes can be ordered by kind.
|
||||||
if (!isRelatedTo(RHS))
|
if (!isRelatedTo(RHS))
|
||||||
return Kind < RHS.Kind;
|
return Kind < RHS.Kind;
|
||||||
@ -403,7 +406,13 @@ public:
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// This class preceeds the RHS if it is a proper subset of the RHS.
|
// This class preceeds the RHS if it is a proper subset of the RHS.
|
||||||
return this != &RHS && isSubsetOf(RHS);
|
if (isSubsetOf(RHS))
|
||||||
|
return true;
|
||||||
|
if (RHS.isSubsetOf(*this))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Otherwise, order by name to ensure we have a total ordering.
|
||||||
|
return ValueName < RHS.ValueName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user