Skip to content

Commit 8e2a9fa

Browse files
[TableGen] Use std::tie to implement operator< (NFC) (#139405)
1 parent fa24875 commit 8e2a9fa

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

clang/utils/TableGen/MveEmitter.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,18 +1550,14 @@ struct OutputIntrinsic {
15501550
std::string Name;
15511551
ComparableStringVector ParamValues;
15521552
bool operator<(const OutputIntrinsic &rhs) const {
1553-
if (Name != rhs.Name)
1554-
return Name < rhs.Name;
1555-
return ParamValues < rhs.ParamValues;
1553+
return std::tie(Name, ParamValues) < std::tie(rhs.Name, rhs.ParamValues);
15561554
}
15571555
};
15581556
struct MergeableGroup {
15591557
std::string Code;
15601558
ComparableStringVector ParamTypes;
15611559
bool operator<(const MergeableGroup &rhs) const {
1562-
if (Code != rhs.Code)
1563-
return Code < rhs.Code;
1564-
return ParamTypes < rhs.ParamTypes;
1560+
return std::tie(Code, ParamTypes) < std::tie(rhs.Code, rhs.ParamTypes);
15651561
}
15661562
};
15671563

clang/utils/TableGen/NeonEmitter.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,8 @@ class Intrinsic {
492492

493493
bool operator<(const Intrinsic &Other) const {
494494
// Sort lexicographically on a three-tuple (ArchGuard, TargetGuard, Name)
495-
if (ArchGuard != Other.ArchGuard)
496-
return ArchGuard < Other.ArchGuard;
497-
if (TargetGuard != Other.TargetGuard)
498-
return TargetGuard < Other.TargetGuard;
499-
return Name < Other.Name;
495+
return std::tie(ArchGuard, TargetGuard, Name) <
496+
std::tie(Other.ArchGuard, Other.TargetGuard, Other.Name);
500497
}
501498

502499
ClassKind getClassKind(bool UseClassBIfScalar = false) {

0 commit comments

Comments
 (0)