Skip to content

Commit 3b3509b

Browse files
committed
[Sema] haveSameParameterTypes - replace repeated isNull() test with assertions
As reported on https://pvs-studio.com/en/blog/posts/cpp/0771/ (Snippet 2) - (and mentioned on rGdc4259d5a38409) we are repeating the T1.isNull() check instead of checking T2.isNull() as well, and at this point neither should be null - so we're better off with an assertion. Differential Revision: https://reviews.llvm.org/D107347
1 parent b9ca73e commit 3b3509b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9586,7 +9586,8 @@ static bool haveSameParameterTypes(ASTContext &Context, const FunctionDecl *F1,
95869586
for (unsigned I = 0; I != NumParams; ++I) {
95879587
QualType T1 = NextParam(F1, I1, I == 0);
95889588
QualType T2 = NextParam(F2, I2, I == 0);
9589-
if (!T1.isNull() && !T1.isNull() && !Context.hasSameUnqualifiedType(T1, T2))
9589+
assert(!T1.isNull() && !T2.isNull() && "Unexpected null param types");
9590+
if (!Context.hasSameUnqualifiedType(T1, T2))
95909591
return false;
95919592
}
95929593
return true;

0 commit comments

Comments
 (0)