llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tools-extra Author: Kazu Hirata (kazutakahirata) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/139410.diff 2 Files Affected: - (modified) clang-tools-extra/modularize/Modularize.cpp (+2-5) - (modified) clang-tools-extra/modularize/PreprocessorTracker.cpp (+2-13) ``````````diff 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; `````````` </details> https://github.com/llvm/llvm-project/pull/139410 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits