[clang] [NFC] Replace bool <= bool comparison (PR #102948)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 11:22:39 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Mital Ashok (MitalAshok)

<details>
<summary>Changes</summary>

Closes #<!-- -->102912

---
Full diff: https://github.com/llvm/llvm-project/pull/102948.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaOverload.cpp (+2-2) 


``````````diff
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 52f640eb96b73..1ce0fa091938d 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -509,7 +509,7 @@ NarrowingKind StandardConversionSequence::getNarrowingKind(
     constexpr auto CanRepresentAll = [](bool FromSigned, unsigned FromWidth,
                                         bool ToSigned, unsigned ToWidth) {
       return (FromWidth < ToWidth + (FromSigned == ToSigned)) &&
-             (FromSigned <= ToSigned);
+             !(FromSigned && !ToSigned);
     };
 
     if (CanRepresentAll(FromSigned, FromWidth, ToSigned, ToWidth))
@@ -542,7 +542,7 @@ NarrowingKind StandardConversionSequence::getNarrowingKind(
       // If the bit-field width was dependent, it might end up being small
       // enough to fit in the target type (unless the target type is unsigned
       // and the source type is signed, in which case it will never fit)
-      if (DependentBitField && (FromSigned <= ToSigned))
+      if (DependentBitField && !(FromSigned && !ToSigned))
         return NK_Dependent_Narrowing;
 
       // Otherwise, such a conversion is always narrowing

``````````

</details>


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


More information about the cfe-commits mailing list