[clang] 488cf10 - [clang][Sema][NFC] Remove redundant isTypeValid

Troy Johnson via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 27 12:48:26 PDT 2022


Author: Troy Johnson
Date: 2022-10-27T12:48:11-07:00
New Revision: 488cf1038c88a6d7e5378d493a253e1dc6a97cd9

URL: https://github.com/llvm/llvm-project/commit/488cf1038c88a6d7e5378d493a253e1dc6a97cd9
DIFF: https://github.com/llvm/llvm-project/commit/488cf1038c88a6d7e5378d493a253e1dc6a97cd9.diff

LOG: [clang][Sema][NFC] Remove redundant isTypeValid

These isTypeValid calls are redundant because the isDerivedFrom call performs the same checks.

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

Added: 
    

Modified: 
    clang/lib/Sema/SemaOverload.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 2190720bdc2de..d21de7db3f53b 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -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() &&


        


More information about the cfe-commits mailing list