[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
This commit is contained in:
Simon Pilgrim 2021-10-18 12:36:29 +01:00
parent b9ca73e1a8
commit 3b3509b3cb
1 changed files with 2 additions and 1 deletions

View File

@ -9586,7 +9586,8 @@ static bool haveSameParameterTypes(ASTContext &Context, const FunctionDecl *F1,
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))
assert(!T1.isNull() && !T2.isNull() && "Unexpected null param types");
if (!Context.hasSameUnqualifiedType(T1, T2))
return false;
}
return true;