================ @@ -5590,69 +5590,8 @@ static bool isTriviallyEqualityComparableType(Sema &S, QualType Type, SourceLoca CanonicalType, /*CheckIfTriviallyCopyable=*/false); } -static bool IsCXXTriviallyRelocatableType(Sema &S, const CXXRecordDecl *RD) { - if (std::optional<ASTContext::CXXRecordDeclRelocationInfo> Info = - S.getASTContext().getRelocationInfoForCXXRecord(RD)) - return Info->IsRelocatable; - ASTContext::CXXRecordDeclRelocationInfo Info = - S.CheckCXX2CRelocatableAndReplaceable(RD); - S.getASTContext().setRelocationInfoForCXXRecord(RD, Info); - return Info.IsRelocatable; -} - -bool Sema::IsCXXTriviallyRelocatableType(QualType Type) { - - QualType BaseElementType = getASTContext().getBaseElementType(Type); - - if (Type->isVariableArrayType()) - return false; - - if (BaseElementType.hasNonTrivialObjCLifetime()) - return false; - - if (BaseElementType.hasAddressDiscriminatedPointerAuth()) - return false; - - if (BaseElementType->isIncompleteType()) - return false; - - if (BaseElementType->isScalarType() || BaseElementType->isVectorType()) - return true; - - if (const auto *RD = BaseElementType->getAsCXXRecordDecl()) - return ::IsCXXTriviallyRelocatableType(*this, RD); - - return false; -} - -static bool IsCXXReplaceableType(Sema &S, const CXXRecordDecl *RD) { - if (std::optional<ASTContext::CXXRecordDeclRelocationInfo> Info = - S.getASTContext().getRelocationInfoForCXXRecord(RD)) - return Info->IsReplaceable; - ASTContext::CXXRecordDeclRelocationInfo Info = - S.CheckCXX2CRelocatableAndReplaceable(RD); - S.getASTContext().setRelocationInfoForCXXRecord(RD, Info); - return Info.IsReplaceable; -} - -bool Sema::IsCXXReplaceableType(QualType Type) { - if (Type.isConstQualified() || Type.isVolatileQualified()) - return false; - - if (Type->isVariableArrayType()) - return false; - - QualType BaseElementType = - getASTContext().getBaseElementType(Type.getUnqualifiedType()); - if (BaseElementType->isIncompleteType()) - return false; - if (BaseElementType->isScalarType()) - return true; - if (const auto *RD = BaseElementType->getAsCXXRecordDecl()) - return ::IsCXXReplaceableType(*this, RD); - return false; -} - +// FIXME : Move the type traits logic to SemaTypeTraits.h ---------------- erichkeane wrote:
There is no such file though? its a little sad to not have this done here. https://github.com/llvm/llvm-project/pull/141238 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits