diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-05-27 05:31:32 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-27 05:31:32 +0000 |
| commit | 97ac3afac231058438bb24c43478b34bb6ec2968 (patch) | |
| tree | f7d90e95fc05b2f011dc3c9e04ce6c3191592249 /llvm/utils | |
| parent | ebdc7724577544ebcd891a76f1c95c44d4013ccc (diff) | |
| download | bcm5719-llvm-97ac3afac231058438bb24c43478b34bb6ec2968.tar.gz bcm5719-llvm-97ac3afac231058438bb24c43478b34bb6ec2968.zip | |
AsmMatcher: Ensure classes are totally ordered, so we can std::sort them reliably.
llvm-svn: 104806
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 783c6b5aae9..4ba3df11764 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -388,6 +388,9 @@ public: /// operator< - Compare two classes. bool operator<(const ClassInfo &RHS) const { + if (this == &RHS) + return false; + // Unrelated classes can be ordered by kind. if (!isRelatedTo(RHS)) return Kind < RHS.Kind; @@ -403,7 +406,13 @@ public: default: // 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; } } }; |

