[PATCH] D107347: [Sema] haveSameParameterTypes - fix repeated isNull() test

Simon Pilgrim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 3 06:30:17 PDT 2021


RKSimon created this revision.
RKSimon added a reviewer: rsmith.
RKSimon requested review of this revision.
Herald added a project: clang.

As reported on https://pvs-studio.com/en/blog/posts/cpp/0771/ (Snippet 2) - (and mentioned on rGdc4259d5a38409 <https://reviews.llvm.org/rGdc4259d5a38409e65b60266a7df0f03c3b91a151>) we are repeating the T1.isNull() check instead of checking T2.isNull() as well.

I'm not familiar with this code but it doesn't look like we have any test coverage that relies on the null tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107347

Files:
  clang/lib/Sema/SemaOverload.cpp


Index: clang/lib/Sema/SemaOverload.cpp
===================================================================
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -9525,7 +9525,7 @@
   for (unsigned I = 0; I != NumParams; ++I) {
     QualType T1 = NextParam(F1, I1, I == 0);
     QualType T2 = NextParam(F2, I2, I == 0);
-    if (!T1.isNull() && !T1.isNull() && !Context.hasSameUnqualifiedType(T1, T2))
+    if (!T1.isNull() && !T2.isNull() && !Context.hasSameUnqualifiedType(T1, T2))
       return false;
   }
   return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107347.363721.patch
Type: text/x-patch
Size: 546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210803/560134e2/attachment.bin>


More information about the cfe-commits mailing list