-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[modularize] Use std::tie to implement operator< (NFC) #139410
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
[modularize] Use std::tie to implement operator< (NFC) #139410
Conversation
@llvm/pr-subscribers-clang-tools-extra Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/139410.diff 2 Files Affected:
diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp
index 8609692945344..7f8a19280b111 100644
--- a/clang-tools-extra/modularize/Modularize.cpp
+++ b/clang-tools-extra/modularize/Modularize.cpp
@@ -406,11 +406,8 @@ struct Location {
}
friend bool operator<(const Location &X, const Location &Y) {
- if (X.File != Y.File)
- return X.File < Y.File;
- if (X.Line != Y.Line)
- return X.Line < Y.Line;
- return X.Column < Y.Column;
+ return std::tie(X.File, X.Line, X.Column) <
+ std::tie(Y.File, Y.Line, Y.Column);
}
friend bool operator>(const Location &X, const Location &Y) { return Y < X; }
friend bool operator<=(const Location &X, const Location &Y) {
diff --git a/clang-tools-extra/modularize/PreprocessorTracker.cpp b/clang-tools-extra/modularize/PreprocessorTracker.cpp
index 0c030f1112204..336f570217933 100644
--- a/clang-tools-extra/modularize/PreprocessorTracker.cpp
+++ b/clang-tools-extra/modularize/PreprocessorTracker.cpp
@@ -494,19 +494,8 @@ class PPItemKey {
return Column == Other.Column;
}
bool operator<(const PPItemKey &Other) const {
- if (Name < Other.Name)
- return true;
- else if (Name > Other.Name)
- return false;
- if (File < Other.File)
- return true;
- else if (File > Other.File)
- return false;
- if (Line < Other.Line)
- return true;
- else if (Line > Other.Line)
- return false;
- return Column < Other.Column;
+ return std::tie(Name, File, Line, Column) <
+ std::tie(Other.Name, Other.File, Other.Line, Other.Column);
}
StringHandle Name;
HeaderHandle File;
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/17572 Here is the relevant piece of the build log for the reference
|
No description provided.