Skip to content

Commit

Permalink
[clang] Fix invalid comparator in tablegen
Browse files Browse the repository at this point in the history
Summary: The current version of the comparator does not introduce a strict weak ordering.

Reviewers: fowles, bkramer, sdesmalen

Reviewed By: sdesmalen

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78323
  • Loading branch information
EricWF committed Apr 16, 2020
1 parent ce77900 commit af2968e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions clang/utils/TableGen/SveEmitter.cpp
Expand Up @@ -33,6 +33,7 @@
#include <sstream>
#include <set>
#include <cctype>
#include <tuple>

using namespace llvm;

Expand Down Expand Up @@ -909,9 +910,10 @@ void SVEEmitter::createHeader(raw_ostream &OS) {
std::stable_sort(
Defs.begin(), Defs.end(), [](const std::unique_ptr<Intrinsic> &A,
const std::unique_ptr<Intrinsic> &B) {
return A->getGuard() < B->getGuard() ||
(unsigned)A->getClassKind() < (unsigned)B->getClassKind() ||
A->getName() < B->getName();
auto ToTuple = [](const std::unique_ptr<Intrinsic> &I) {
return std::make_tuple(I->getGuard(), (unsigned)I->getClassKind(), I->getName());
};
return ToTuple(A) < ToTuple(B);
});

StringRef InGuard = "";
Expand Down

0 comments on commit af2968e

Please sign in to comment.