[clang] Recognize friend operator != to fix ambiguity with operator== (PR #70213)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 07:52:26 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 84d8ace51a5afb07b528f65cde091cf3dbd7c326 183209f71b08a1fdba335d89c906cd26483115c1 -- clang/lib/Sema/SemaOverload.cpp clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 30bde49636b2..807a07a35d69 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -12119,8 +12119,7 @@ struct CompareOverloadCandidatesForDisplay {
         int leftBetter = 0;
         unsigned I = (L->IgnoreObjectArgument || R->IgnoreObjectArgument);
         for (unsigned E = L->Conversions.size(); I != E; ++I) {
-          switch (CompareImplicitConversionSequences(S, Loc,
-                                                     L->Conversions[I],
+          switch (CompareImplicitConversionSequences(S, Loc, L->Conversions[I],
                                                      R->Conversions[I])) {
           case ImplicitConversionSequence::Better:
             leftBetter++;
@@ -12134,8 +12133,10 @@ struct CompareOverloadCandidatesForDisplay {
             break;
           }
         }
-        if (leftBetter > 0) return true;
-        if (leftBetter < 0) return false;
+        if (leftBetter > 0)
+          return true;
+        if (leftBetter < 0)
+          return false;
 
       } else if (RFailureKind == ovl_fail_bad_conversion)
         return false;
@@ -12158,13 +12159,15 @@ struct CompareOverloadCandidatesForDisplay {
     SourceLocation RLoc = GetLocationForCandidate(R);
 
     // Put candidates without locations (e.g. builtins) at the end.
-    if (LLoc.isInvalid()) return false;
-    if (RLoc.isInvalid()) return true;
+    if (LLoc.isInvalid())
+      return false;
+    if (RLoc.isInvalid())
+      return true;
 
     return S.SourceMgr.isBeforeInTranslationUnit(LLoc, RLoc);
   }
 };
-}
+} // namespace
 
 /// CompleteNonViableCandidate - Normally, overload resolution only
 /// computes up to the first bad conversion. Produces the FixIt set if

``````````

</details>


https://github.com/llvm/llvm-project/pull/70213


More information about the cfe-commits mailing list