Skip to content

[TableGen] Use std::tie to implement operator< (NFC) #139405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions clang/utils/TableGen/MveEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1550,18 +1550,14 @@ struct OutputIntrinsic {
std::string Name;
ComparableStringVector ParamValues;
bool operator<(const OutputIntrinsic &rhs) const {
if (Name != rhs.Name)
return Name < rhs.Name;
return ParamValues < rhs.ParamValues;
return std::tie(Name, ParamValues) < std::tie(rhs.Name, rhs.ParamValues);
}
};
struct MergeableGroup {
std::string Code;
ComparableStringVector ParamTypes;
bool operator<(const MergeableGroup &rhs) const {
if (Code != rhs.Code)
return Code < rhs.Code;
return ParamTypes < rhs.ParamTypes;
return std::tie(Code, ParamTypes) < std::tie(rhs.Code, rhs.ParamTypes);
}
};

Expand Down
7 changes: 2 additions & 5 deletions clang/utils/TableGen/NeonEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,8 @@ class Intrinsic {

bool operator<(const Intrinsic &Other) const {
// Sort lexicographically on a three-tuple (ArchGuard, TargetGuard, Name)
if (ArchGuard != Other.ArchGuard)
return ArchGuard < Other.ArchGuard;
if (TargetGuard != Other.TargetGuard)
return TargetGuard < Other.TargetGuard;
return Name < Other.Name;
return std::tie(ArchGuard, TargetGuard, Name) <
std::tie(Other.ArchGuard, Other.TargetGuard, Other.Name);
}

ClassKind getClassKind(bool UseClassBIfScalar = false) {
Expand Down
Loading