clang 22.0.0git
|
#include "clang/AST/DeclCXX.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/Type.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/DiagnosticParse.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/TypeTraits.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Overload.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaHLSL.h"
Go to the source code of this file.
Typedefs | |
using | ExtractedTypeTraitInfo = std::optional< std::pair< TypeTrait, llvm::SmallVector< QualType, 1 > > > |
Enumerations | |
enum class | TypeTraitReturnType { Bool , SizeT } |
using ExtractedTypeTraitInfo = std::optional<std::pair<TypeTrait, llvm::SmallVector<QualType, 1> >> |
Definition at line 1972 of file SemaTypeTraits.cpp.
|
strong |
Enumerator | |
---|---|
Bool | |
SizeT |
Definition at line 1513 of file SemaTypeTraits.cpp.
|
static |
Definition at line 1199 of file SemaTypeTraits.cpp.
References clang::InitializationKind::CreateCopy(), clang::ExprError(), clang::TypeLoc::getBeginLoc(), clang::QualType::getNonLValueExprType(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::Expr::getValueKindForType(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::Init, clang::InitializedEntity::InitializeTemporary(), clang::Type::isArrayType(), clang::Type::isFunctionType(), clang::Type::isObjectType(), clang::Result, clang::Self, clang::Unevaluated, and clang::Sema::Unevaluated.
Referenced by EvaluateBinaryTypeTrait(), and EvaluateBooleanTypeTrait().
|
static |
Check the completeness of a type in a unary type trait.
If the particular type trait requires a complete type, tries to complete it. If completing the type fails, a diagnostic is emitted and false returned. If completing the type succeeds or no completion was required, returns true.
Definition at line 409 of file SemaTypeTraits.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::Type::isArrayType(), clang::Type::isIncompleteArrayType(), clang::Type::isVoidType(), Loc, and clang::Sema::RequireCompleteType().
Referenced by clang::Sema::BuildTypeTrait().
|
static |
Checks that type T is not an atomic type (_Atomic).
true
if T
is VLA and a diagnostic was emitted, false
otherwise. Definition at line 393 of file SemaTypeTraits.cpp.
References clang::SemaBase::Diag(), clang::Type::isAtomicType(), and clang::T.
Referenced by EvaluateUnaryTypeTrait().
|
static |
Definition at line 2385 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), and Loc.
Referenced by DiagnoseIsEmptyReason(), and clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2430 of file SemaTypeTraits.cpp.
References clang::Sema::Context, D, clang::SemaBase::Diag(), DiagnoseIsEmptyReason(), clang::ASTContext::getAsArrayType(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::Type::isReferenceType(), Loc, and clang::T.
|
static |
Definition at line 2453 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), clang::Decl::getLocation(), clang::Decl::isInvalidDecl(), and Loc.
Referenced by DiagnoseIsFinalReason(), and clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2467 of file SemaTypeTraits.cpp.
References clang::Sema::Context, D, clang::SemaBase::Diag(), DiagnoseIsFinalReason(), clang::ASTContext::getAsArrayType(), clang::Type::getAsCXXRecordDecl(), clang::Type::isFunctionType(), clang::Type::isRecordType(), clang::Type::isReferenceType(), Loc, and clang::T.
|
static |
Definition at line 2359 of file SemaTypeTraits.cpp.
References clang::Sema::BuildBinOp(), clang::Sema::Context, D, clang::SemaBase::Diag(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getTranslationUnitDecl(), clang::Expr::getValueKindForType(), clang::Decl::isInvalidDecl(), Loc, clang::T, clang::Unevaluated, and clang::Sema::Unevaluated.
Referenced by clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2286 of file SemaTypeTraits.cpp.
References clang::Sema::Context, clang::InitializationKind::CreateDirect(), D, clang::SemaBase::Diag(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::QualType::getNonLValueExprType(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getTranslationUnitDecl(), clang::Expr::getValueKindForType(), clang::Init, clang::InitializedEntity::InitializeTemporary(), clang::Type::isFunctionType(), clang::Type::isIncompleteArrayType(), clang::Decl::isInvalidDecl(), clang::Type::isObjectType(), Loc, clang::T, clang::Unevaluated, and clang::Sema::Unevaluated.
Referenced by clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2040 of file SemaTypeTraits.cpp.
References clang::CopyAssignment, clang::CopyConstructor, D, clang::SemaBase::Diag(), clang::Decl::getSourceRange(), Loc, LookupSpecialMemberFromXValue(), clang::MoveAssignment, and clang::MoveConstructor.
Referenced by DiagnoseNonReplaceableReason(), and DiagnoseNonTriviallyRelocatableReason().
|
static |
Definition at line 2143 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), DiagnoseNonDefaultMovable(), clang::Decl::getSourceRange(), clang::Decl::hasAttr(), clang::Sema::IsCXXReplaceableType(), Loc, and LookupSpecialMemberFromXValue().
Referenced by DiagnoseNonReplaceableReason(), and clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2185 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), DiagnoseNonReplaceableReason(), clang::Type::getAsCXXRecordDecl(), clang::Sema::getASTContext(), clang::ASTContext::getBaseElementType(), clang::Decl::getLocation(), clang::Type::isArrayType(), clang::Decl::isInvalidDecl(), clang::Type::isReferenceType(), clang::Type::isScalarType(), clang::Type::isVariablyModifiedType(), Loc, and clang::T.
|
static |
Definition at line 2517 of file SemaTypeTraits.cpp.
References clang::AS_none, D, clang::SemaBase::Diag(), clang::Decl::getLocation(), clang::CXXRecordDecl::hasDirectFields(), hasMultipleDataBaseClassesWithFields(), Indirect, and Loc.
Referenced by DiagnoseNonStandardLayoutReason(), and clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2615 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), DiagnoseNonStandardLayoutReason(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::Decl::isInvalidDecl(), clang::Type::isReferenceType(), clang::Type::isVariablyModifiedType(), Loc, and clang::T.
|
static |
Definition at line 2229 of file SemaTypeTraits.cpp.
References clang::Sema::DefaultedFunctionKind::asSpecialMember(), clang::CopyAssignment, clang::CopyConstructor, D, clang::SemaBase::Diag(), clang::Decl::getASTContext(), clang::Sema::getDefaultedFunctionKind(), clang::Decl::getSourceRange(), clang::FunctionDecl::isTrivial(), Loc, clang::Method, clang::MoveAssignment, and clang::MoveConstructor.
Referenced by DiagnoseNonTriviallyCopyableReason(), and clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2340 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), DiagnoseNonTriviallyCopyableReason(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::Decl::isInvalidDecl(), clang::Type::isReferenceType(), Loc, and clang::T.
|
static |
Definition at line 2084 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), DiagnoseNonDefaultMovable(), clang::Decl::getSourceRange(), clang::Decl::hasAttr(), clang::Sema::IsCXXTriviallyRelocatableType(), and Loc.
Referenced by DiagnoseNonTriviallyRelocatableReason(), and clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 2115 of file SemaTypeTraits.cpp.
References D, clang::SemaBase::Diag(), DiagnoseNonTriviallyRelocatableReason(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::Decl::isInvalidDecl(), clang::Type::isReferenceType(), clang::Type::isVariablyModifiedType(), Loc, and clang::T.
|
static |
Checks that type T is not a VLA.
true
if T
is VLA and a diagnostic was emitted, false
otherwise. Definition at line 379 of file SemaTypeTraits.cpp.
References clang::SemaBase::Diag(), clang::Type::isVariableArrayType(), and clang::T.
Referenced by EvaluateBinaryTypeTrait(), and EvaluateUnaryTypeTrait().
|
static |
Definition at line 1845 of file SemaTypeTraits.cpp.
References D, clang::Dim, clang::Stmt::getSourceRange(), clang::Type::isArrayType(), clang::Type::isDependentType(), clang::Self, and clang::T.
Referenced by clang::Sema::BuildArrayTypeTrait().
|
static |
Definition at line 1631 of file SemaTypeTraits.cpp.
References CheckConvertibilityForTypeTraits(), clang::ASTContext::containsAddressDiscriminatedPointerAuth(), clang::CT_Cannot, DiagnoseVLAInCXXTypeTrait(), clang::Type::getAsCanonical(), clang::TypeLoc::getBeginLoc(), clang::QualType::getNonReferenceType(), clang::RecordType::getOriginalDecl(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::Expr::getValueKindForType(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::QualType::hasNonTrivialObjCLifetime(), clang::Type::isDependentType(), clang::Type::isIncompleteArrayType(), clang::Type::isStructureOrClassType(), clang::Type::isUnionType(), clang::Type::isVoidType(), clang::Result, clang::Self, clang::Success, clang::Unevaluated, and clang::Sema::Unevaluated.
Referenced by EvaluateBooleanTypeTrait().
|
static |
Definition at line 1296 of file SemaTypeTraits.cpp.
References clang::BTT_Last, clang::Sema::canThrow(), CheckConvertibilityForTypeTraits(), clang::Sema::Context, clang::InitializationKind::CreateCopy(), clang::InitializationKind::CreateDirect(), clang::ASTContext::CreateTypeSourceInfo(), clang::CT_Cannot, EvaluateBinaryTypeTrait(), EvaluateUnaryTypeTrait(), clang::Type::getAsCXXRecordDecl(), clang::QualType::getNonLValueExprType(), clang::ASTContext::getPointerType(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getTranslationUnitDecl(), clang::Expr::getValueKindForType(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::Init, clang::InitializedEntity::InitializeTemporary(), clang::CXXRecordDecl::isAbstract(), clang::Type::isFunctionType(), clang::Type::isIncompleteArrayType(), clang::Type::isIncompleteType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Type::isObjectType(), clang::Type::isReferenceType(), clang::Type::isVoidType(), clang::Sema::RequireCompleteType(), clang::Result, clang::T, clang::Unevaluated, clang::Sema::Unevaluated, and clang::UTT_Last.
Referenced by clang::Sema::BuildTypeTrait().
|
static |
Definition at line 1931 of file SemaTypeTraits.cpp.
References E, clang::Expr::isLValue(), and clang::Expr::isPRValue().
Referenced by clang::Sema::BuildExpressionTrait().
|
static |
Definition at line 1269 of file SemaTypeTraits.cpp.
References clang::SemaBase::Diag(), clang::Sema::getASTContext(), clang::SourceRange::getBegin(), clang::Sema::GetDecompositionElementCount(), clang::ASTContext::getSizeType(), clang::ASTContext::MakeIntValue(), and clang::T.
Referenced by clang::Sema::BuildTypeTrait().
|
static |
Definition at line 702 of file SemaTypeTraits.cpp.
References clang::AS_public, clang::C, clang::RecordDecl::canPassInRegisters(), clang::Constructor, clang::Destructor, DiagnoseAtomicInCXXTypeTrait(), DiagnoseVLAInCXXTypeTrait(), clang::Type::getAsCXXRecordDecl(), clang::TypeLoc::getBeginLoc(), clang::Type::getCanonicalTypeUnqualified(), clang::CXXRecordDecl::getDestructor(), clang::FunctionProtoType::getNumParams(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::Decl::hasAttr(), clang::CXXRecordDecl::hasNonTrivialCopyAssignment(), clang::CXXRecordDecl::hasNonTrivialCopyConstructor(), clang::CXXRecordDecl::hasNonTrivialDefaultConstructor(), clang::CXXRecordDecl::hasNonTrivialMoveAssignment(), clang::CXXRecordDecl::hasNonTrivialMoveConstructor(), HasNoThrowOperator(), clang::CXXRecordDecl::hasTrivialCopyAssignment(), clang::CXXRecordDecl::hasTrivialCopyConstructor(), clang::CXXRecordDecl::hasTrivialDefaultConstructor(), clang::CXXRecordDecl::hasTrivialDestructor(), clang::CXXRecordDecl::hasTrivialMoveAssignment(), clang::CXXRecordDecl::hasTrivialMoveConstructor(), clang::CXXRecordDecl::isAbstract(), clang::Type::isAggregateType(), clang::Type::isAnyComplexType(), clang::Type::isAnyPointerType(), clang::Type::isArithmeticType(), clang::Type::isArrayType(), clang::Type::isClassType(), clang::Type::isCompoundType(), clang::CXXMethodDecl::isCopyAssignmentOperator(), clang::FunctionDecl::isDeleted(), clang::Type::isDependentType(), clang::CXXRecordDecl::isEmpty(), clang::Type::isEnumeralType(), clang::Type::isExtVectorType(), clang::Type::isFloatingType(), clang::Type::isFunctionType(), clang::Type::isFundamentalType(), clang::Type::isHLSLIntangibleType(), clang::Type::isIncompleteArrayType(), clang::Type::isIncompleteType(), clang::Type::isIntegralType(), clang::Type::isInterfaceType(), clang::Type::isLiteralType(), clang::Type::isLValueReferenceType(), clang::Type::isMemberDataPointerType(), clang::Type::isMemberFunctionPointerType(), clang::Type::isMemberPointerType(), clang::CXXMethodDecl::isMoveAssignmentOperator(), clang::FunctionProtoType::isNothrow(), clang::Type::isObjCLifetimeType(), clang::Type::isObjectType(), clang::CXXRecordDecl::isPolymorphic(), clang::Type::isReferenceType(), clang::Type::isRValueReferenceType(), clang::Type::isScalarType(), clang::Type::isScopedEnumeralType(), clang::Type::isSignedIntegerType(), clang::Type::isStandardLayoutType(), clang::Type::isStructureType(), isTriviallyEqualityComparableType(), IsTriviallyRelocatableType(), clang::TagDecl::isUnion(), clang::Type::isUnionType(), clang::Type::isUnsignedIntegerType(), clang::FunctionDecl::isUserProvided(), clang::Type::isVectorType(), clang::Type::isVoidType(), clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::Self, and clang::T.
Referenced by EvaluateBooleanTypeTrait().
|
static |
Definition at line 1979 of file SemaTypeTraits.cpp.
References D, E, clang::Decl::isInStdNamespace(), clang::TemplateArgument::Pack, StdNameToTypeTrait(), clang::NestedNameSpecifier::Type, and clang::TemplateArgument::Type.
Referenced by clang::Sema::DiagnoseTypeTraitDetails().
|
static |
Definition at line 1518 of file SemaTypeTraits.cpp.
|
static |
Definition at line 2499 of file SemaTypeTraits.cpp.
References D, clang::RecordDecl::fields(), and clang::Decl::isInvalidDecl().
Referenced by DiagnoseNonStandardLayoutReason().
|
static |
Definition at line 592 of file SemaTypeTraits.cpp.
References clang::Sema::Context, clang::Sema::CreateOverloadedBinOp(), clang::ASTContext::getCanonicalTagType(), clang::CallExpr::getDirectCallee(), clang::ASTContext::getTranslationUnitDecl(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::LookupBinOp(), clang::Result, clang::T, clang::Sema::TUScope, clang::Sema::Unevaluated, and clang::VK_LValue.
Referenced by isTriviallyEqualityComparableType().
|
static |
Definition at line 559 of file SemaTypeTraits.cpp.
References clang::LookupResult::begin(), clang::C, clang::Type::castAs(), clang::LookupResult::end(), clang::ValueDecl::getType(), clang::FunctionProtoType::isNothrow(), clang::Sema::LookupOrdinaryName, clang::Self, and clang::LookupResult::suppressDiagnostics().
Referenced by EvaluateUnaryTypeTrait().
|
static |
Definition at line 115 of file SemaTypeTraits.cpp.
References D, clang::Decl::isInvalidDecl(), and LookupSpecialMemberFromXValue().
Referenced by clang::Sema::CheckCXX2CRelocatableAndReplaceable(), and IsDefaultMovable().
|
static |
Definition at line 129 of file SemaTypeTraits.cpp.
References D, clang::Decl::isInvalidDecl(), and LookupSpecialMemberFromXValue().
Referenced by clang::Sema::CheckCXX2CRelocatableAndReplaceable(), and IsDefaultMovable().
|
static |
Definition at line 347 of file SemaTypeTraits.cpp.
References clang::Sema::CheckCXX2CRelocatableAndReplaceable(), clang::Sema::getASTContext(), clang::ASTContext::getRelocationInfoForCXXRecord(), clang::ASTContext::CXXRecordDeclRelocationInfo::IsReplaceable, and clang::ASTContext::setRelocationInfoForCXXRecord().
|
static |
Definition at line 154 of file SemaTypeTraits.cpp.
References D, clang::CXXDestructorDecl::getCanonicalDecl(), hasSuitableConstructorForRelocation(), hasSuitableMoveAssignmentOperatorForRelocation(), clang::FunctionDecl::isDefaulted(), clang::FunctionDecl::isDeleted(), and clang::FunctionDecl::isUserProvided().
Referenced by clang::Sema::CheckCXX2CRelocatableAndReplaceable().
|
static |
Definition at line 214 of file SemaTypeTraits.cpp.
References D, and clang::Sema::IsCXXReplaceableType().
Referenced by clang::Sema::CheckCXX2CRelocatableAndReplaceable().
|
static |
Definition at line 178 of file SemaTypeTraits.cpp.
References clang::ASTContext::containsAddressDiscriminatedPointerAuth(), clang::Sema::Context, D, and clang::Sema::IsCXXTriviallyRelocatableType().
Referenced by clang::Sema::CheckCXX2CRelocatableAndReplaceable().
|
static |
Definition at line 652 of file SemaTypeTraits.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::Sema::getASTContext(), HasNonDeletedDefaultedEqualityComparison(), clang::ASTContext::hasUniqueObjectRepresentations(), clang::Type::isArrayType(), clang::Type::isDependentType(), clang::Type::isEnumeralType(), and clang::Type::isIncompleteType().
Referenced by EvaluateUnaryTypeTrait().
Definition at line 668 of file SemaTypeTraits.cpp.
References clang::RecordDecl::canPassInRegisters(), clang::ASTContext::containsAddressDiscriminatedPointerAuth(), clang::Type::getAsCXXRecordDecl(), clang::Type::getAsRecordDecl(), clang::Sema::getASTContext(), clang::ASTContext::getBaseElementType(), clang::Sema::IsCXXTriviallyRelocatableType(), clang::Type::isIncompleteType(), clang::Type::isObjectType(), clang::CXXRecordDecl::isPolymorphic(), clang::QualType::isTriviallyCopyableType(), clang::QualType::PCK_ARCStrong, clang::QualType::PCK_Trivial, and clang::T.
Referenced by EvaluateUnaryTypeTrait().
|
static |
Definition at line 29 of file SemaTypeTraits.cpp.
References clang::Sema::AddMethodCandidate(), clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::AS_none, clang::DeclContextLookupResult::begin(), clang::OverloadCandidateSet::BestViableFunction(), clang::Expr::Classify(), clang::OverloadCandidateSet::CSK_Normal, clang::ASTContext::DeclarationNames, clang::DeclContextLookupResult::empty(), clang::DeclContextLookupResult::end(), clang::Sema::getASTContext(), clang::ASTContext::getCanonicalTagType(), clang::getConstructorInfo(), clang::DeclarationNameTable::getCXXConstructorName(), clang::DeclarationNameTable::getCXXOperatorName(), clang::CXXRecordDecl::getDefinition(), clang::Decl::getLocation(), clang::NamedDecl::getUnderlyingDecl(), clang::DeclContext::lookup(), clang::DeclAccessPair::make(), clang::OR_Deleted, clang::OR_Success, clang::VK_LValue, and clang::VK_XValue.
Referenced by DiagnoseNonDefaultMovable(), DiagnoseNonReplaceableReason(), hasSuitableConstructorForRelocation(), and hasSuitableMoveAssignmentOperatorForRelocation().
|
static |
Definition at line 1958 of file SemaTypeTraits.cpp.
Referenced by ExtractTypeTraitFromExpression().