[clang][Sema][NFC] Remove redundant isTypeValid
authorTroy Johnson <troyj@meta.com>
Thu, 27 Oct 2022 19:31:34 +0000 (12:31 -0700)
committerTroy Johnson <troyj@meta.com>
Thu, 27 Oct 2022 19:48:11 +0000 (12:48 -0700)
These isTypeValid calls are redundant because the isDerivedFrom call performs the same checks.

Differential Revision: https://reviews.llvm.org/D136190

clang/lib/Sema/SemaOverload.cpp

index 2190720..d21de7d 100644 (file)
@@ -4606,15 +4606,6 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc,
   return ImplicitConversionSequence::Indistinguishable;
 }
 
-/// Determine whether the given type is valid, e.g., it is not an invalid
-/// C++ class.
-static bool isTypeValid(QualType T) {
-  if (CXXRecordDecl *Record = T->getAsCXXRecordDecl())
-    return !Record->isInvalidDecl();
-
-  return true;
-}
-
 static QualType withoutUnaligned(ASTContext &Ctx, QualType T) {
   if (!T.getQualifiers().hasUnaligned())
     return T;
@@ -4664,7 +4655,6 @@ Sema::CompareReferenceRelationship(SourceLocation Loc,
   if (UnqualT1 == UnqualT2) {
     // Nothing to do.
   } else if (isCompleteType(Loc, OrigT2) &&
-             isTypeValid(UnqualT1) && isTypeValid(UnqualT2) &&
              IsDerivedFrom(Loc, UnqualT2, UnqualT1))
     Conv |= ReferenceConversions::DerivedToBase;
   else if (UnqualT1->isObjCObjectOrInterfaceType() &&