Skip to content

Commit

Permalink
[Sema] haveSameParameterTypes - replace repeated isNull() test with a…
Browse files Browse the repository at this point in the history
…ssertions

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
  • Loading branch information
RKSimon committed Oct 18, 2021
1 parent b9ca73e commit 3b3509b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/lib/Sema/SemaOverload.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 3b3509b

Please sign in to comment.