;
84llvm_unreachable(
"Nested name specifier is not a type for inheriting ctor");
98 "not a constructor name");
120 auto*RD = dyn_cast<CXXRecordDecl>(ND);
121 if(RD && RD->isInjectedClassName()) {
122InjectedClassName = RD;
126 if(!InjectedClassName) {
131diag::err_incomplete_nested_name_spec) << CurClass << SS.
getRange();
146 boolEnteringContext) {
180 boolFailed =
false;
192 autoIsAcceptableResult = [&](
NamedDecl*
D) ->
bool{
193 auto*
Type= dyn_cast<TypeDecl>(
D->getUnderlyingDecl());
204 unsignedNumAcceptableResults = 0;
206 if(IsAcceptableResult(
D))
207++NumAcceptableResults;
212 if(
auto*RD = dyn_cast<CXXRecordDecl>(
D))
213 if(RD->isInjectedClassName())
214 D= cast<NamedDecl>(RD->getParent());
216 if(FoundDeclSet.insert(
D).second)
217FoundDecls.push_back(
D);
225 if(
Found.isAmbiguous() && NumAcceptableResults == 1) {
226 Diag(NameLoc, diag::ext_dtor_name_ambiguous);
230 if(
auto*TD = dyn_cast<TypeDecl>(
D->getUnderlyingDecl()))
236 if(!IsAcceptableResult(
D))
242 if(
Found.isAmbiguous())
246 if(IsAcceptableResult(
Type)) {
258 boolIsDependent =
false;
260 autoLookupInObjectType = [&]() ->
ParsedType{
261 if(Failed || SearchType.
isNull())
271 returnCheckLookupResult(
Found);
289 returnCheckLookupResult(
Found);
298 returnCheckLookupResult(
Found);
345 if(
ParsedType T= LookupInNestedNameSpec(PrefixSS))
375 unsignedNumNonExtensionDecls = FoundDecls.size();
387(
"::"+ II.
getName()).str());
399 Diag(SS.
getEndLoc(), diag::ext_qualified_dtor_named_in_lexical_scope)
401 Diag(FoundDecls.back()->getLocation(), diag::note_destructor_type_here)
412FoundDecls.resize(NumNonExtensionDecls);
415std::stable_sort(FoundDecls.begin(), FoundDecls.end(),
417return isa<TypeDecl>(A->getUnderlyingDecl()) >
418isa<TypeDecl>(B->getUnderlyingDecl());
422 autoMakeFixItHint = [&]{
425 if(!SearchType.
isNull())
428Destroyed = dyn_cast_or_null<CXXRecordDecl>(S->getEntity());
435 if(FoundDecls.empty()) {
437 Diag(NameLoc, diag::err_undeclared_destructor_name)
438<< &II << MakeFixItHint();
439}
else if(!SearchType.
isNull() && FoundDecls.size() == 1) {
440 if(
auto*TD = dyn_cast<TypeDecl>(FoundDecls[0]->getUnderlyingDecl())) {
441assert(!SearchType.
isNull() &&
442 "should only reject a type result if we have a search type");
444 Diag(NameLoc, diag::err_destructor_expr_type_mismatch)
445<<
T<< SearchType << MakeFixItHint();
447 Diag(NameLoc, diag::err_destructor_expr_nontype)
448<< &II << MakeFixItHint();
451 Diag(NameLoc, SearchType.
isNull() ? diag::err_destructor_name_nontype
452: diag::err_destructor_expr_mismatch)
453<< &II << SearchType << MakeFixItHint();
457 if(
auto*TD = dyn_cast<TypeDecl>(FoundD->getUnderlyingDecl()))
458 Diag(FoundD->getLocation(), diag::note_destructor_type_here)
461 Diag(FoundD->getLocation(), diag::note_destructor_nontype_here)
479 "unexpected type in getDestructorType");
508Name.getSourceRange(),
509(StringRef(
"operator\"\"") + II->
getName()).str());
518 Diag(
Loc, diag::warn_deprecated_literal_operator_id) << II << Hint;
521 Diag(
Loc, diag::warn_reserved_extern_symbol)
522<< II << static_cast<int>(Status) << Hint;
536 Diag(Name.getBeginLoc(), diag::err_literal_operator_id_outside_namespace)
547llvm_unreachable(
"unknown nested name specifier kind");
568 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid) <<
T);
581 boolWasEvaluated =
false;
591 CXXRecordDecl*RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
614WasEvaluated =
true;
637 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid)
644? diag::warn_side_effects_typeid
645: diag::warn_side_effects_unevaluated_context);
658 return ExprError(
Diag(OpLoc, diag::err_openclcxx_not_supported)
664 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
678 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
682 return ExprError(
Diag(OpLoc, diag::err_no_typeid_with_fno_rtti));
706 if(
auto*CTE = dyn_cast<CXXTypeidExpr>(
Result.get()))
707 if(CTE->isPotentiallyEvaluated() && !CTE->isMostDerived(
Context))
708 Diag(OpLoc, diag::warn_no_typeid_with_rtti_disabled)
730 if(
const auto*Uuid = TD->getMostRecentDecl()->getAttr<UuidAttr>()) {
731UuidAttrs.insert(Uuid);
736 if(
const auto*CTSD = dyn_cast<ClassTemplateSpecializationDecl>(TD)) {
739 constUuidAttr *UuidForTA =
nullptr;
746UuidAttrs.insert(UuidForTA);
756 if(!Operand->getType()->isDependentType()) {
759 if(UuidAttrs.empty())
760 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
761 if(UuidAttrs.size() > 1)
762 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
763Guid = UuidAttrs.back()->getGuidDecl();
780 if(UuidAttrs.empty())
781 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
782 if(UuidAttrs.size() > 1)
783 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
784Guid = UuidAttrs.back()->getGuidDecl();
819assert((Kind == tok::kw_true || Kind == tok::kw_false) &&
820 "Unknown C++ Boolean value!");
832 boolIsThrownVarInScope =
false;
845 if(
const auto*DRE = dyn_cast<DeclRefExpr>(Ex->
IgnoreParens()))
846 if(
const auto*Var = dyn_cast<VarDecl>(DRE->getDecl());
847Var && Var->hasLocalStorage() &&
848!Var->getType().isVolatileQualified()) {
849 for(; S; S = S->getParent()) {
850 if(S->isDeclScope(Var)) {
851IsThrownVarInScope =
true;
868 boolIsThrownVarInScope) {
870 const boolIsOpenMPGPUTarget =
871 getLangOpts().OpenMPIsTargetDevice && (
T.isNVPTX() ||
T.isAMDGCN());
874 if(!IsOpenMPGPUTarget && !
getLangOpts().CXXExceptions &&
877 targetDiag(OpLoc, diag::err_exceptions_disabled) <<
"throw";
881 if(IsOpenMPGPUTarget)
882 targetDiag(OpLoc, diag::warn_throw_not_valid_on_target) <<
T.str();
887<<
"throw"<< llvm::to_underlying(
CUDA().CurrentTarget());
890 Diag(OpLoc, diag::err_omp_simd_region_cannot_use_stmt) <<
"throw";
895 Diag(OpLoc, diag::err_acc_branch_in_out_compute_construct)
939llvm::DenseMap<CXXRecordDecl *, unsigned> &SubobjectsSeen,
940llvm::SmallPtrSetImpl<CXXRecordDecl *> &VBases,
941llvm::SetVector<CXXRecordDecl *> &PublicSubobjectsSeen,
942 boolParentIsPublic) {
944 CXXRecordDecl*BaseDecl = BS.getType()->getAsCXXRecordDecl();
949NewSubobject = VBases.insert(BaseDecl).second;
951NewSubobject =
true;
954++SubobjectsSeen[BaseDecl];
957 boolPublicPath = ParentIsPublic && BS.getAccessSpecifier() ==
AS_public;
959PublicSubobjectsSeen.insert(BaseDecl);
969llvm::DenseMap<CXXRecordDecl *, unsigned> SubobjectsSeen;
970llvm::SmallSet<CXXRecordDecl *, 2> VBases;
971llvm::SetVector<CXXRecordDecl *> PublicSubobjectsSeen;
972SubobjectsSeen[RD] = 1;
973PublicSubobjectsSeen.insert(RD);
977 for(
CXXRecordDecl*PublicSubobject : PublicSubobjectsSeen) {
979 if(SubobjectsSeen[PublicSubobject] > 1)
982Objects.push_back(PublicSubobject);
991 boolisPointer =
false;
1011isPointer ? diag::err_throw_incomplete_ptr
1012: diag::err_throw_incomplete,
1022diag::err_throw_abstract_type,
E))
1044 PDiag(diag::err_access_dtor_exception) << Ty);
1060 for(
CXXRecordDecl*Subobject : UnambiguousPublicSubobjects) {
1101 if(ExnObjAlign < TypeAlign) {
1102 Diag(ThrowLoc, diag::warn_throw_underaligned_obj);
1103 Diag(ThrowLoc, diag::note_throw_underaligned_obj)
1108 if(!isPointer &&
getLangOpts().AssumeNothrowExceptionDtor) {
1110 autoTy = Dtor->getType();
1114 Diag(ThrowLoc, diag::err_throw_object_throwing_dtor) << RD;
1166 for(
intI = FunctionScopes.size();
1167I-- && isa<LambdaScopeInfo>(FunctionScopes[I]) &&
1169cast<LambdaScopeInfo>(FunctionScopes[I])->CallOperator);
1171CurLSI = cast<LambdaScopeInfo>(FunctionScopes[I]);
1178 if(
C.isCopyCapture()) {
1190 "While computing 'this' capture-type for a generic lambda, when we " 1191 "run out of enclosing LSI's, yet the enclosing DC is a " 1192 "lambda-call-operator we must be (i.e. Current LSI) in a generic " 1193 "lambda call oeprator");
1196 autoIsThisCaptured =
1197[](
CXXRecordDecl*Closure,
bool&IsByCopy,
bool&IsConst) {
1200 for(
auto&&
C: Closure->
captures()) {
1201 if(
C.capturesThis()) {
1212 boolIsByCopyCapture =
false;
1213 boolIsConstCapture =
false;
1216IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
1217 if(IsByCopyCapture) {
1235 if(method && method->isImplicitObjectMemberFunction())
1236ThisTy = method->getThisType().getNonReferenceType();
1264: S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(
false)
1266 if(!Enabled || !ContextDecl)
1271 Record= Template->getTemplatedDecl();
1273 Record= cast<CXXRecordDecl>(ContextDecl);
1281this->Enabled =
true;
1298 Sema.
Diag(DiagLoc, diag::note_lambda_this_capture_fixit)
1304 boolBuildAndDiagnose,
const unsigned*
constFunctionScopeIndexToStopAt,
1305 const boolByCopy) {
1310assert((!ByCopy ||
Explicit) &&
"cannot implicitly capture *this by value");
1312 const intMaxFunctionScopesIndex = FunctionScopeIndexToStopAt
1313? *FunctionScopeIndexToStopAt
1339 unsignedNumCapturingClosures = 0;
1340 for(
intidx = MaxFunctionScopesIndex; idx >= 0; idx--) {
1343 if(CSI->CXXThisCaptureIndex != 0) {
1345CSI->Captures[CSI->CXXThisCaptureIndex - 1].markUsed(BuildAndDiagnose);
1351 if(BuildAndDiagnose) {
1353 Diag(
Loc, diag::err_this_capture)
1354<< (
Explicit&& idx == MaxFunctionScopesIndex);
1364(
Explicit&& idx == MaxFunctionScopesIndex)) {
1370NumCapturingClosures++;
1374 if(BuildAndDiagnose) {
1376 Diag(
Loc, diag::err_this_capture)
1377<< (
Explicit&& idx == MaxFunctionScopesIndex);
1385 if(!BuildAndDiagnose)
return false;
1397isa<LambdaScopeInfo>(
FunctionScopes[MaxFunctionScopesIndex])) &&
1398 "Only a lambda can capture the enclosing object (referred to by " 1401 for(
intidx = MaxFunctionScopesIndex; NumCapturingClosures;
1402--idx, --NumCapturingClosures) {
1409 boolisNested = NumCapturingClosures > 1;
1429 if(!
Type.isNull())
1443 const auto*Method = dyn_cast<CXXMethodDecl>(DC);
1444 if(Method && Method->isExplicitObjectMemberFunction()) {
1445 Diag(
Loc, diag::err_invalid_this_use) << 1;
1447 Diag(
Loc, diag::err_invalid_this_use) << 1;
1449 Diag(
Loc, diag::err_invalid_this_use) << 0;
1463 if(This->isTypeDependent())
1468 autoIsDependent = [&]() {
1470 auto*LSI = dyn_cast<sema::LambdaScopeInfo>(
Scope);
1474 if(LSI->Lambda && !LSI->Lambda->Encloses(
CurContext) &&
1475LSI->AfterParameterList)
1482 if(LSI->isCXXThisCaptured()) {
1483 if(!LSI->getCXXThisCapture().isCopyCapture())
1486 const auto*MD = LSI->CallOperator;
1487 if(MD->getType().isNull())
1491 returnTy && MD->isExplicitObjectMemberFunction() &&
1498This->setCapturedByCopyInLambdaWithExplicitObjectParameter(IsDependent);
1518 boolListInitialization) {
1528RParenOrBraceLoc, ListInitialization);
1532 if(!
Result.isInvalid() &&
Result.get()->isInstantiationDependent() &&
1533!
Result.get()->isTypeDependent())
1535 else if(
Result.isInvalid())
1537RParenOrBraceLoc, exprs, Ty);
1546 boolListInitialization) {
1555? ListInitialization
1557TyBeginLoc, LParenOrBraceLoc, RParenOrBraceLoc)
1570 if(Deduced && !Deduced->
isDeduced() &&
1571isa<DeducedTemplateSpecializationType>(Deduced)) {
1577}
else if(Deduced && !Deduced->
isDeduced()) {
1579 if(ListInitialization) {
1580 auto*ILE = cast<InitListExpr>(Exprs[0]);
1581Inits =
MultiExprArg(ILE->getInits(), ILE->getNumInits());
1585 return ExprError(
Diag(TyBeginLoc, diag::err_auto_expr_init_no_expression)
1586<< Ty << FullRange);
1587 if(Inits.size() > 1) {
1588 Expr*FirstBad = Inits[1];
1590diag::err_auto_expr_init_multiple_expressions)
1591<< Ty << FullRange);
1595 Diag(TyBeginLoc, diag::warn_cxx20_compat_auto_expr) << FullRange;
1597 Expr*Deduce = Inits[0];
1598 if(isa<InitListExpr>(Deduce))
1601<< ListInitialization << Ty << FullRange);
1608 return ExprError(
Diag(TyBeginLoc, diag::err_auto_expr_deduction_failure)
1609<< Ty << Deduce->
getType() << FullRange
1623RParenOrBraceLoc, ListInitialization);
1629 if(Exprs.size() == 1 && !ListInitialization &&
1630!isa<InitListExpr>(Exprs[0])) {
1631 Expr*Arg = Exprs[0];
1639 if(!ListInitialization)
1640 return ExprError(
Diag(TyBeginLoc, diag::err_value_init_for_array_type)
1650 return ExprError(
Diag(TyBeginLoc, diag::err_init_for_function_type)
1651<< Ty << FullRange);
1660 if(ListInitialization &&
1661cast<InitListExpr>(Exprs[0])->getNumInits() == 0) {
1665Exprs[0]->getBeginLoc(), Exprs[0]->getEndLoc());
1668diag::err_invalid_incomplete_type_use,
1677 if(
Result.isInvalid())
1682Inner = BTE->getSubExpr();
1683 if(
auto*CE = dyn_cast<ConstantExpr>(Inner);
1684CE && CE->isImmediateInvocation())
1685Inner = CE->getSubExpr();
1686 if(!isa<CXXTemporaryObjectExpr>(Inner) &&
1687!isa<CXXScalarValueInitExpr>(Inner)) {
1699:
SourceRange(LParenOrBraceLoc, RParenOrBraceLoc);
1721 for(
const auto*
D: R) {
1722 if(
const auto*FD = dyn_cast<FunctionDecl>(
D)) {
1739 returnllvm::none_of(PreventedBy, [&](
const FunctionDecl*FD) {
1741 "Only single-operand functions should be in PreventedBy");
1756 unsignedUsualParams = 1;
1758 if(S.
getLangOpts().SizedDeallocation && UsualParams < FD->getNumParams() &&
1764 if(S.
getLangOpts().AlignedAllocation && UsualParams < FD->getNumParams() &&
1774 structUsualDeallocFnInfo {
1775UsualDeallocFnInfo() :
Found(), FD(nullptr) {}
1783 unsignedNumBaseParams = 1;
1784 if(FD->isDestroyingOperatorDelete()) {
1789 if(NumBaseParams < FD->getNumParams() &&
1791FD->getParamDecl(NumBaseParams)->getType(),
1797 if(NumBaseParams < FD->getNumParams() &&
1798FD->getParamDecl(NumBaseParams)->getType()->isAlignValT()) {
1800HasAlignValT =
true;
1809 explicit operator bool()
const{
returnFD; }
1811 boolisBetterThan(
constUsualDeallocFnInfo &
Other,
boolWantSize,
1812 boolWantAlign)
const{
1816 if(Destroying !=
Other.Destroying)
1823 if(HasAlignValT !=
Other.HasAlignValT)
1824 returnHasAlignValT == WantAlign;
1826 if(HasSizeT !=
Other.HasSizeT)
1827 returnHasSizeT == WantSize;
1830 returnCUDAPref >
Other.CUDAPref;
1835 boolDestroying, HasSizeT, HasAlignValT;
1855UsualDeallocFnInfo Best;
1857 for(
autoI = R.
begin(),
E= R.
end(); I !=
E; ++I) {
1858UsualDeallocFnInfo Info(S, I.getPair());
1866BestFns->push_back(Info);
1870 if(Best.isBetterThan(Info, WantSize, WantAlign))
1875 if(BestFns && Info.isBetterThan(Best, WantSize, WantAlign))
1880BestFns->push_back(Info);
1894 if(!record)
return false;
1907 if(ops.
empty())
return false;
1919 returnBest && Best.HasSizeT;
1927std::optional<Expr *> ArraySize;
1929 if(
D.getNumTypeObjects() > 0 &&
1932 if(
D.getDeclSpec().hasAutoTypeSpec())
1943 D.DropFirstTypeObject();
1948 for(
unsignedI = 0, N =
D.getNumTypeObjects(); I < N; ++I) {
1953 if(
Expr*NumElts = (
Expr*)Array.NumElts) {
1954 if(!NumElts->isTypeDependent() && !NumElts->isValueDependent()) {
1969NumElts,
nullptr, diag::err_new_array_nonconst,
AllowFold)
1981 if(
D.isInvalidType())
1986DirectInitRange = List->getSourceRange();
1989PlacementLParen, PlacementArgs, PlacementRParen,
1990TypeIdParens, AllocType, TInfo, ArraySize, DirectInitRange,
1995 Expr*
Init,
boolIsCPlusPlus20) {
1999 returnIsCPlusPlus20 || PLE->getNumExprs() == 0;
2000 if(isa<ImplicitValueInitExpr>(
Init))
2003 return!CCE->isListInitialization() &&
2004CCE->getConstructor()->isDefaultConstructor();
2006assert(isa<InitListExpr>(
Init) &&
2007 "Shouldn't create list CXXConstructExprs for arrays.");
2015 if(!
getLangOpts().AlignedAllocationUnavailable)
2019std::optional<unsigned> AlignmentParam;
2032StringRef OSName = AvailabilityAttr::getPlatformNameSourceSpelling(
2037 boolIsDelete = Kind == OO_Delete || Kind == OO_Array_Delete;
2038 Diag(
Loc, diag::err_aligned_allocation_unavailable)
2040<< OSVersion.getAsString() << OSVersion.empty();
2041 Diag(
Loc, diag::note_silence_aligned_allocation_unavailable);
2051std::optional<Expr *> ArraySize,
2057 if(DirectInitRange.
isValid()) {
2058assert(
Initializer&&
"Have parens but no initializer.");
2060}
else if(isa_and_nonnull<InitListExpr>(
Initializer))
2065 "Initializer expression that cannot have been implicitly created.");
2072 "paren init for non-call init");
2073Exprs =
MultiExprArg(List->getExprs(), List->getNumExprs());
2080 switch(InitStyle) {
2091DirectInitRange.
getEnd());
2097llvm_unreachable(
"Unknown initialization kind");
2102 if(Deduced && !Deduced->isDeduced() &&
2103isa<DeducedTemplateSpecializationType>(Deduced)) {
2106 Diag(*ArraySize ? (*ArraySize)->getExprLoc() : TypeRange.
getBegin(),
2107diag::err_deduced_class_template_compound_type)
2109<< (*ArraySize ? (*ArraySize)->getSourceRange() : TypeRange));
2114AllocTypeInfo, Entity, Kind, Exprs);
2115 if(AllocType.
isNull())
2117}
else if(Deduced && !Deduced->isDeduced()) {
2121 auto*ILE = cast<InitListExpr>(Exprs[0]);
2122Inits =
MultiExprArg(ILE->getInits(), ILE->getNumInits());
2126 return ExprError(
Diag(StartLoc, diag::err_auto_new_requires_ctor_arg)
2127<< AllocType << TypeRange);
2128 if(Inits.size() > 1) {
2129 Expr*FirstBad = Inits[1];
2131diag::err_auto_new_ctor_multiple_expressions)
2132<< AllocType << TypeRange);
2136<< AllocType << TypeRange;
2137 Expr*Deduce = Inits[0];
2138 if(isa<InitListExpr>(Deduce))
2141<< Braced << AllocType << TypeRange);
2148 return ExprError(
Diag(StartLoc, diag::err_auto_new_deduction_failure)
2149<< AllocType << Deduce->
getType() << TypeRange
2167AllocType = Array->getElementType();
2187 if(ArraySize && *ArraySize &&
2188(*ArraySize)->getType()->isNonOverloadPlaceholderType()) {
2191ArraySize = result.
get();
2200std::optional<uint64_t> KnownArraySize;
2201 if(ArraySize && *ArraySize && !(*ArraySize)->isTypeDependent()) {
2210(*ArraySize)->getType()->getAs<
RecordType>())
2212 Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
2213<< (*ArraySize)->getType() << 0 <<
"'size_t'";
2220SizeConvertDiagnoser(
Expr*ArraySize)
2222ArraySize(ArraySize) {}
2226 returnS.
Diag(
Loc, diag::err_array_size_not_integral)
2232 returnS.
Diag(
Loc, diag::err_array_size_incomplete_type)
2238 returnS.
Diag(
Loc, diag::err_array_size_explicit_conversion) <<
T<< ConvTy;
2243 returnS.
Diag(Conv->
getLocation(), diag::note_array_size_conversion)
2249 returnS.
Diag(
Loc, diag::err_array_size_ambiguous_conversion) <<
T;
2254 returnS.
Diag(Conv->
getLocation(), diag::note_array_size_conversion)
2263? diag::warn_cxx98_compat_array_size_conversion
2264: diag::ext_array_size_conversion)
2267} SizeDiagnoser(*ArraySize);
2275ArraySize = ConvertedSize.
get();
2276 QualTypeSizeType = (*ArraySize)->getType();
2294 if(std::optional<llvm::APSInt>
Value=
2295(*ArraySize)->getIntegerConstantExpr(
Context)) {
2296 if(
Value->isSigned() &&
Value->isNegative()) {
2298diag::err_typecheck_negative_array_size)
2299<< (*ArraySize)->getSourceRange());
2303 unsignedActiveSizeBits =
2307 Diag((*ArraySize)->getBeginLoc(), diag::err_array_too_large)
2308<<
toString(*
Value, 10) << (*ArraySize)->getSourceRange());
2311KnownArraySize =
Value->getZExtValue();
2312}
else if(TypeIdParens.
isValid()) {
2314 Diag((*ArraySize)->getBeginLoc(), diag::ext_new_paren_array_nonconst)
2315<< (*ArraySize)->getSourceRange()
2328 unsignedAlignment =
2331 boolPassAlignment =
getLangOpts().AlignedAllocation &&
2332Alignment > NewAlignment;
2342AllocType, ArraySize.has_value(), PassAlignment, PlacementArgs,
2343OperatorNew, OperatorDelete))
2348 boolUsualArrayDeleteWantsSize =
false;
2350UsualArrayDeleteWantsSize =
2363 unsignedNumImplicitArgs = PassAlignment ? 2 : 1;
2365NumImplicitArgs, PlacementArgs, AllPlaceArgs,
2369 if(!AllPlaceArgs.empty())
2370PlacementArgs = AllPlaceArgs;
2380llvm::APInt SingleEltSize(
2384std::optional<llvm::APInt> AllocationSize;
2387AllocationSize = SingleEltSize;
2391AllocationSize = llvm::APInt(SizeTyWidth, *KnownArraySize)
2392.umul_ov(SingleEltSize, Overflow);
2396 "Expected that all the overflows would have been handled already.");
2400 Context, AllocationSize.value_or(llvm::APInt::getZero(SizeTyWidth)),
2419CK_IntegralCast, &AlignmentLiteral,
2424CallArgs.reserve(NumImplicitArgs + PlacementArgs.size());
2425CallArgs.emplace_back(AllocationSize
2426?
static_cast<Expr*
>(&AllocationSizeLiteral)
2427: &OpaqueAllocationSize);
2429CallArgs.emplace_back(&DesiredAlignment);
2430CallArgs.insert(CallArgs.end(), PlacementArgs.begin(), PlacementArgs.end());
2434 checkCall(OperatorNew, Proto,
nullptr, CallArgs,
2435 false, StartLoc,
Range, CallType);
2439 if(PlacementArgs.empty() && !PassAlignment &&
2440(OperatorNew->isImplicit() ||
2441(OperatorNew->getBeginLoc().isValid() &&
2443 if(Alignment > NewAlignment)
2444 Diag(StartLoc, diag::warn_overaligned_type)
2456 SourceRangeInitRange(Exprs.front()->getBeginLoc(),
2457Exprs.back()->getEndLoc());
2458 Diag(StartLoc, diag::err_new_array_init_args) << InitRange;
2478InitType = AllocType;
2491dyn_cast_or_null<CXXBindTemporaryExpr>(FullInit.
get()))
2492FullInit = Binder->getSubExpr();
2499 if(ArraySize && !*ArraySize) {
2507 Diag(TypeRange.
getEnd(), diag::err_new_array_size_unknown_from_init)
2519 if(OperatorDelete) {
2526PassAlignment, UsualArrayDeleteWantsSize,
2527PlacementArgs, TypeIdParens, ArraySize, InitStyle,
2537 return Diag(
Loc, diag::err_bad_new_type)
2538<< AllocType << 0 << R;
2540 return Diag(
Loc, diag::err_bad_new_type)
2541<< AllocType << 1 << R;
2544 Loc, AllocType, diag::err_new_incomplete_or_sizeless_type, R))
2547diag::err_allocation_of_abstract_type))
2550 return Diag(
Loc, diag::err_variably_modified_new_type)
2554 return Diag(
Loc, diag::err_address_space_qualified_new)
2562 return Diag(
Loc, diag::err_arc_new_array_without_ownership)
2577Alloc != AllocEnd; ++Alloc) {
2580 NamedDecl*
D= (*Alloc)->getUnderlyingDecl();
2614 if(PassAlignment) {
2615PassAlignment =
false;
2617Args.erase(Args.begin() + 1);
2619Operator, &Candidates, AlignArg,
2645(Args[1]->getType()->isObjectPointerType() ||
2646Args[1]->getType()->isArrayType())) {
2647S.
Diag(R.
getNameLoc(), diag::err_need_header_before_placement_new)
2662 if(AlignedCandidates) {
2664 return C.Function->getNumParams() > 1 &&
2665 C.Function->getParamDecl(1)->getType()->isAlignValT();
2669AlignedArgs.reserve(Args.size() + 1);
2670AlignedArgs.push_back(Args[0]);
2671AlignedArgs.push_back(AlignArg);
2672AlignedArgs.append(Args.begin() + 1, Args.end());
2683S.
Diag(R.
getNameLoc(), diag::err_ovl_no_viable_function_in_call)
2685 if(AlignedCandidates)
2686AlignedCandidates->
NoteCandidates(S, AlignedArgs, AlignedCands,
"",
2696S.
PDiag(diag::err_ovl_ambiguous_call)
2705Candidates, Best->Function, Args);
2709llvm_unreachable(
"Unreachable, bad result from BestViableFunction");
2731AllocArgs.reserve((PassAlignment ? 2 : 1) + PlaceArgs.size());
2741AllocArgs.push_back(&Size);
2744 if(PassAlignment) {
2750AllocArgs.push_back(&Align);
2752AllocArgs.insert(AllocArgs.end(), PlaceArgs.begin(), PlaceArgs.end());
2761IsArray ? OO_Array_New : OO_New);
2793 if(PlaceArgs.empty()) {
2794 Diag(StartLoc, diag::err_openclcxx_not_supported) <<
"default new";
2796 Diag(StartLoc, diag::err_openclcxx_placement_new);
2801assert(!R.
empty() &&
"implicitly declared allocation functions not found");
2802assert(!R.
isAmbiguous() &&
"global allocation functions are ambiguous");
2808OperatorNew,
nullptr,
2815OperatorDelete =
nullptr;
2822OperatorNew->getDeclName().getCXXOverloadedOperator() == OO_Array_New
2850 while(Filter.hasNext()) {
2851 auto*FD = dyn_cast<FunctionDecl>(Filter.next()->getUnderlyingDecl());
2852 if(FD && FD->isDestroyingOperatorDelete())
2858 boolFoundGlobalDelete = FoundDelete.
empty();
2859 if(FoundDelete.
empty()) {
2886 boolisPlacementNew = !PlaceArgs.empty() || OperatorNew->param_size() != 1 ||
2887OperatorNew->isVariadic();
2889 if(isPlacementNew) {
2906 for(
unsignedI = 1, N = Proto->getNumParams(); I < N; ++I)
2907ArgTypes.push_back(Proto->getParamType(I));
2911EPI.
Variadic= Proto->isVariadic();
2913ExpectedFunctionType
2918DEnd = FoundDelete.
end();
2922dyn_cast<FunctionTemplateDecl>((*D)->getUnderlyingDecl())) {
2930Fn = cast<FunctionDecl>((*D)->getUnderlyingDecl());
2933ExpectedFunctionType,
2935ExpectedFunctionType))
2936Matches.push_back(std::make_pair(
D.getPair(), Fn));
2952*
this, FoundDelete,
FoundGlobalDelete,
2956Matches.push_back(std::make_pair(Selected.Found, Selected.FD));
2960 for(
autoFn : BestDeallocFns)
2961Matches.push_back(std::make_pair(Fn.Found, Fn.FD));
2969 if(Matches.size() == 1) {
2970OperatorDelete = Matches[0].second;
2980UsualDeallocFnInfo Info(*
this,
2986 boolIsSizedDelete = Info.HasSizeT;
2987 if(IsSizedDelete && !FoundGlobalDelete) {
2988 autoNonSizedDelete =
2991 if(NonSizedDelete && !NonSizedDelete.HasSizeT &&
2992NonSizedDelete.HasAlignValT == Info.HasAlignValT)
2993IsSizedDelete =
false;
2996 if(IsSizedDelete) {
3000PlaceArgs.back()->getEndLoc());
3001 Diag(StartLoc, diag::err_placement_new_non_placement_delete) << R;
3002 if(!OperatorDelete->isImplicit())
3003 Diag(OperatorDelete->getLocation(), diag::note_previous_decl)
3010}
else if(!Matches.empty()) {
3014 Diag(StartLoc, diag::warn_ambiguous_suitable_delete_function_found)
3015<< DeleteName << AllocElemType;
3017 for(
auto&Match : Matches)
3018 Diag(Match.second->getLocation(),
3019diag::note_member_declared_here) << DeleteName;
3083 if(TheGlobalModuleFragment) {
3098 if(TheGlobalModuleFragment) {
3099AlignValT->setModuleOwnershipKind(
3101AlignValT->setLocalOwningModule(TheGlobalModuleFragment);
3106AlignValT->setImplicit(
true);
3119Params.push_back(Param);
3122 boolHasSizedVariant =
getLangOpts().SizedDeallocation &&
3123(Kind == OO_Delete || Kind == OO_Array_Delete);
3124 boolHasAlignedVariant =
getLangOpts().AlignedAllocation;
3126 intNumSizeVariants = (HasSizedVariant ? 2 : 1);
3127 intNumAlignVariants = (HasAlignedVariant ? 2 : 1);
3128 for(
intSized = 0; Sized < NumSizeVariants; ++Sized) {
3130Params.push_back(SizeT);
3132 for(
intAligned = 0; Aligned < NumAlignVariants; ++Aligned) {
3145DeclareGlobalAllocationFunctions(OO_New, VoidPtr, SizeT);
3146DeclareGlobalAllocationFunctions(OO_Array_New, VoidPtr, SizeT);
3147DeclareGlobalAllocationFunctions(OO_Delete,
Context.
VoidTy, VoidPtr);
3148DeclareGlobalAllocationFunctions(OO_Array_Delete,
Context.
VoidTy, VoidPtr);
3151PopGlobalModuleFragment();
3164Alloc != AllocEnd; ++Alloc) {
3168 if(
Func->getNumParams() == Params.size()) {
3170 for(
auto*
P:
Func->parameters())
3171FuncParams.push_back(
3177 Func->setVisibleDespiteOwningModule();
3185 false,
false,
true));
3188 boolHasBadAllocExceptionSpec
3189= (Name.getCXXOverloadedOperator() == OO_New ||
3190Name.getCXXOverloadedOperator() == OO_Array_New);
3191 if(HasBadAllocExceptionSpec) {
3194assert(
StdBadAlloc&&
"Must have std::bad_alloc declared");
3206 autoCreateAllocationFunctionDecl = [&](
Attr*ExtraAttr) {
3212Alloc->setImplicit();
3214Alloc->setVisibleDespiteOwningModule();
3216 if(HasBadAllocExceptionSpec &&
getLangOpts().NewInfallible &&
3219ReturnsNonNullAttr::CreateImplicit(
Context, Alloc->getLocation()));
3231 if(TheGlobalModuleFragment) {
3232Alloc->setModuleOwnershipKind(
3234Alloc->setLocalOwningModule(TheGlobalModuleFragment);
3238Alloc->addAttr(VisibilityAttr::CreateImplicit(
3240? VisibilityAttr::Hidden
3242? VisibilityAttr::Protected
3243: VisibilityAttr::Default));
3249 nullptr,
SC_None,
nullptr));
3250ParamDecls.back()->setImplicit();
3252Alloc->setParams(ParamDecls);
3254Alloc->addAttr(ExtraAttr);
3261CreateAllocationFunctionDecl(
nullptr);
3265CreateAllocationFunctionDecl(CUDAHostAttr::CreateImplicit(
Context));
3266CreateAllocationFunctionDecl(CUDADeviceAttr::CreateImplicit(
Context));
3271 boolCanProvideSize,
3285assert(
Result.FD &&
"operator delete missing from global scope?");
3297 returnOperatorDelete;
3309 boolWantSize,
boolWantAligned) {
3314 if(
Found.isAmbiguous())
3317 Found.suppressDiagnostics();
3327Overaligned, &Matches);
3330 if(Matches.size() == 1) {
3331Operator = cast<CXXMethodDecl>(Matches[0].FD);
3337 Diag(StartLoc, diag::err_deleted_function_use)
3338<< (Msg !=
nullptr) << (Msg ? Msg->
getString() : StringRef());
3354 if(!Matches.empty()) {
3356 Diag(StartLoc, diag::err_ambiguous_suitable_delete_member_function_found)
3358 for(
auto&Match : Matches)
3359 Diag(Match.FD->getLocation(), diag::note_member_declared_here) << Name;
3366 if(!
Found.empty()) {
3368 Diag(StartLoc, diag::err_no_suitable_delete_member_function_found)
3373diag::note_member_declared_here) << Name;
3378Operator =
nullptr;
3385classMismatchingNewDeleteDetector {
3387 enumMismatchResult {
3393MemberInitMismatches,
3402 explicitMismatchingNewDeleteDetector(
boolEndOfTU)
3403: Field(nullptr), IsArrayForm(
false), EndOfTU(EndOfTU),
3404HasUndefinedConstructors(
false) {}
3421MismatchResult analyzeField(
FieldDecl*Field,
boolDeleteWasArrayForm);
3431 boolHasUndefinedConstructors;
3443MismatchResult analyzeMemberExpr(
const MemberExpr*ME);
3466MismatchResult analyzeInClassInitializer();
3470MismatchingNewDeleteDetector::MismatchResult
3471MismatchingNewDeleteDetector::analyzeDeleteExpr(
const CXXDeleteExpr*DE) {
3473assert(DE &&
"Expected delete-expression");
3476 if(
const MemberExpr*ME = dyn_cast<const MemberExpr>(
E)) {
3477 returnanalyzeMemberExpr(ME);
3478}
else if(
const DeclRefExpr*
D= dyn_cast<const DeclRefExpr>(
E)) {
3479 if(!hasMatchingVarInit(
D))
3480 returnVarInitMismatches;
3486MismatchingNewDeleteDetector::getNewExprFromInitListOrExpr(
const Expr*
E) {
3487assert(
E!=
nullptr&&
"Expected a valid initializer expression");
3489 if(
const InitListExpr*ILE = dyn_cast<const InitListExpr>(
E)) {
3490 if(ILE->getNumInits() == 1)
3491 E= dyn_cast<const CXXNewExpr>(ILE->getInit(0)->IgnoreParenImpCasts());
3494 returndyn_cast_or_null<const CXXNewExpr>(
E);
3497boolMismatchingNewDeleteDetector::hasMatchingNewInCtorInit(
3501(NE = getNewExprFromInitListOrExpr(CI->
getInit()))) {
3502 if(
NE->isArray() == IsArrayForm)
3505NewExprs.push_back(NE);
3510boolMismatchingNewDeleteDetector::hasMatchingNewInCtor(
3516HasUndefinedConstructors =
true;
3519 for(
const auto*CI : cast<const CXXConstructorDecl>(
Definition)->inits()) {
3520 if(hasMatchingNewInCtorInit(CI))
3526MismatchingNewDeleteDetector::MismatchResult
3527MismatchingNewDeleteDetector::analyzeInClassInitializer() {
3528assert(Field !=
nullptr&&
"This should be called only for members");
3529 const Expr*InitExpr =
Field->getInClassInitializer();
3531 returnEndOfTU ? NoMismatch : AnalyzeLater;
3532 if(
const CXXNewExpr*NE = getNewExprFromInitListOrExpr(InitExpr)) {
3533 if(
NE->isArray() != IsArrayForm) {
3534NewExprs.push_back(NE);
3535 returnMemberInitMismatches;
3541MismatchingNewDeleteDetector::MismatchResult
3542MismatchingNewDeleteDetector::analyzeField(
FieldDecl*Field,
3543 boolDeleteWasArrayForm) {
3544assert(Field !=
nullptr&&
"Analysis requires a valid class member.");
3545this->Field =
Field;
3546IsArrayForm = DeleteWasArrayForm;
3548 for(
const auto*CD : RD->
ctors()) {
3549 if(hasMatchingNewInCtor(CD))
3552 if(HasUndefinedConstructors)
3553 returnEndOfTU ? NoMismatch : AnalyzeLater;
3554 if(!NewExprs.empty())
3555 returnMemberInitMismatches;
3556 return Field->hasInClassInitializer() ? analyzeInClassInitializer()
3560MismatchingNewDeleteDetector::MismatchResult
3561MismatchingNewDeleteDetector::analyzeMemberExpr(
const MemberExpr*ME) {
3562assert(ME !=
nullptr&&
"Expected a member expression");
3564 returnanalyzeField(F, IsArrayForm);
3568boolMismatchingNewDeleteDetector::hasMatchingVarInit(
const DeclRefExpr*
D) {
3570 if(
const VarDecl*VD = dyn_cast<const VarDecl>(
D->getDecl())) {
3571 if(VD->hasInit() && (NE = getNewExprFromInitListOrExpr(VD->getInit())) &&
3572 NE->isArray() != IsArrayForm) {
3573NewExprs.push_back(NE);
3576 returnNewExprs.empty();
3581 constMismatchingNewDeleteDetector &Detector) {
3584 if(!Detector.IsArrayForm)
3593 SemaRef.
Diag(DeleteLoc, diag::warn_mismatched_delete_new)
3594<< Detector.IsArrayForm << H;
3596 for(
const auto*NE : Detector.NewExprs)
3597 SemaRef.
Diag(NE->getExprLoc(), diag::note_allocated_here)
3598<< Detector.IsArrayForm;
3601voidSema::AnalyzeDeleteExprMismatch(
const CXXDeleteExpr*DE) {
3604MismatchingNewDeleteDetector Detector(
false);
3605 switch(Detector.analyzeDeleteExpr(DE)) {
3606 caseMismatchingNewDeleteDetector::VarInitMismatches:
3607 caseMismatchingNewDeleteDetector::MemberInitMismatches: {
3611 caseMismatchingNewDeleteDetector::AnalyzeLater: {
3616 caseMismatchingNewDeleteDetector::NoMismatch:
3622 boolDeleteWasArrayForm) {
3623MismatchingNewDeleteDetector Detector(
true);
3624 switch(Detector.analyzeField(Field, DeleteWasArrayForm)) {
3625 caseMismatchingNewDeleteDetector::VarInitMismatches:
3626llvm_unreachable(
"This analysis should have been done for class members.");
3627 caseMismatchingNewDeleteDetector::AnalyzeLater:
3628llvm_unreachable(
"Analysis cannot be postponed any point beyond end of " 3629 "translation unit.");
3630 caseMismatchingNewDeleteDetector::MemberInitMismatches:
3633 caseMismatchingNewDeleteDetector::NoMismatch:
3640 boolArrayForm,
Expr*ExE) {
3650 boolArrayFormAsWritten = ArrayForm;
3651 boolUsualArrayDeleteWantsSize =
false;
3669 if(ConvPtrType->getPointeeType()->isIncompleteOrObjectType())
3676 returnS.
Diag(
Loc, diag::err_delete_operand) <<
T;
3681 returnS.
Diag(
Loc, diag::err_delete_incomplete_class_type) <<
T;
3687 returnS.
Diag(
Loc, diag::err_delete_explicit_conversion) <<
T<< ConvTy;
3698 returnS.
Diag(
Loc, diag::err_ambiguous_delete_operand) <<
T;
3710llvm_unreachable(
"conversion functions are permitted");
3718 if(!Converter.match(
Type))
3729diag::err_address_space_qualified_delete)
3739 Diag(StartLoc,
LangOpts.CPlusPlus26 ? diag::err_delete_incomplete
3740: diag::ext_delete_void_ptr_operand)
3745 return ExprError(
Diag(StartLoc, diag::err_delete_operand)
3753? diag::err_delete_incomplete
3754: diag::warn_delete_incomplete,
3757PointeeRD = cast<CXXRecordDecl>(RT->getDecl());
3762 Diag(StartLoc, diag::warn_delete_array_type)
3769ArrayForm ? OO_Array_Delete : OO_Delete);
3783UsualArrayDeleteWantsSize =
3788 else if(isa_and_nonnull<CXXMethodDecl>(OperatorDelete))
3789UsualArrayDeleteWantsSize =
3790UsualDeallocFnInfo(*
this,
3797 if(Dtor->isCalledByDelete(OperatorDelete)) {
3812 if(!OperatorDelete) {
3814 Diag(StartLoc, diag::err_openclcxx_not_supported) <<
"default delete";
3819 boolCanProvideSize =
3820IsComplete && (!ArrayForm || UsualArrayDeleteWantsSize ||
3826Overaligned, DeleteName);
3829 if(OperatorDelete->isInvalidDecl())
3836 boolIsVirtualDelete =
false;
3839 if(Dtor->isCalledByDelete(OperatorDelete))
3841 PDiag(diag::err_access_dtor) << PointeeElem);
3842IsVirtualDelete = Dtor->isVirtual();
3852 QualTypeParamType = OperatorDelete->getParamDecl(0)->getType();
3871 Context.
VoidTy, UseGlobal, ArrayForm, ArrayFormAsWritten,
3872UsualArrayDeleteWantsSize, OperatorDelete, Ex.
get(), StartLoc);
3873AnalyzeDeleteExprMismatch(
Result);
3882IsDelete ? OO_Delete : OO_New);
3886assert(!R.
empty() &&
"implicitly declared allocation functions not found");
3887assert(!R.
isAmbiguous() &&
"global allocation functions are ambiguous");
3896FnOvl != FnOvlEnd; ++FnOvl) {
3899 NamedDecl*
D= (*FnOvl)->getUnderlyingDecl();
3923 "class members should not be considered");
3926S.
Diag(R.
getNameLoc(), diag::err_builtin_operator_new_delete_not_usual)
3927<< (IsDelete ? 1 : 0) <<
Range;
3928S.
Diag(FnDecl->
getLocation(), diag::note_non_usual_function_declared_here)
3940S.
PDiag(diag::err_ovl_no_viable_function_in_call)
3948S.
PDiag(diag::err_ovl_ambiguous_call)
3955Candidates, Best->Function, Args);
3958llvm_unreachable(
"Unreachable, bad result from BestViableFunction");
3963 CallExpr*TheCall = cast<CallExpr>(TheCallResult.
get());
3965 Diag(TheCall->
getExprLoc(), diag::err_builtin_requires_language)
3966<< (IsDelete ?
"__builtin_operator_delete":
"__builtin_operator_new")
3976OperatorNewOrDelete))
3978assert(OperatorNewOrDelete &&
"should be found");
3984 for(
unsignedi = 0; i != TheCall->
getNumArgs(); ++i) {
3995assert(Callee &&
Callee->getCastKind() == CK_BuiltinFnToFnPtr &&
3996 "Callee expected to be implicit cast to a builtin function pointer");
3999 returnTheCallResult;
4003 boolIsDelete,
boolCallCanBeVirtual,
4004 boolWarnOnNonAbstractTypes,
4031 Diag(
Loc, diag::warn_delete_abstract_non_virtual_dtor) << (IsDelete ? 0 : 1)
4033}
else if(WarnOnNonAbstractTypes) {
4036 Diag(
Loc, diag::warn_delete_non_virtual_dtor) << (IsDelete ? 0 : 1)
4040std::string TypeStr;
4042 Diag(DtorLoc, diag::note_delete_non_virtual)
4052 if(
E.isInvalid())
4070diag::err_invalid_use_of_function_type)
4074diag::err_invalid_use_of_array_type)
4092llvm_unreachable(
"unexpected condition kind");
4118diag::err_constexpr_if_condition_expression_is_not_constant);
4126From = Cast->getSubExpr();
4138 if(!ToPtrType->getPointeeType().hasQualifiers()) {
4139 switch(StrLit->getKind()) {
4146 return(ToPointeeType->getKind() == BuiltinType::Char_U ||
4147ToPointeeType->getKind() == BuiltinType::Char_S);
4152assert(
false&&
"Unevaluated string literal in expression");
4167 boolHadMultipleCandidates,
4170 default: llvm_unreachable(
"Unhandled cast kind!");
4171 caseCK_ConstructorConversion: {
4176diag::err_allocation_of_abstract_type))
4189CastLoc, Ty, FoundDecl, cast<CXXConstructorDecl>(Method),
4190ConstructorArgs, HadMultipleCandidates,
4191 false,
false,
false,
4193 if(
Result.isInvalid())
4199 caseCK_UserDefinedConversion: {
4209HadMultipleCandidates);
4210 if(
Result.isInvalid())
4214CK_UserDefinedConversion,
Result.get(),
4215 nullptr,
Result.get()->getValueKind(),
4248assert(FD &&
"no conversion function for user-defined conversion seq");
4250 CastKind= CK_UserDefinedConversion;
4258 CastKind= CK_ConstructorConversion;
4285From = CastArg.
get();
4299 PDiag(diag::err_typecheck_ambiguous_condition)
4305llvm_unreachable(
"bad conversion");
4312ToType, From->
getType(), From, Action);
4313assert(Diagnosed &&
"failed to diagnose bad conversion"); (void)Diagnosed;
4327ElType = ToVec->getElementType();
4364 false,
false,
false,
4371 false,
false,
false,
4404ToAtomicType = ToType;
4405ToType = ToAtomic->getValueType();
4408 QualTypeInitialFromType = FromType;
4410 switch(SCS.
First) {
4413FromType = FromAtomic->getValueType().getUnqualifiedType();
4426From = FromRes.
get();
4446 "FromType must be ArrayParameterType in ICK_HLSL_Array_RValue \ 4447 if it is not ToType");
4464llvm_unreachable(
"Improper first standard conversion");
4505 "only enums with fixed underlying type can promote to bool");
4535CK = CK_FloatingComplexCast;
4537CK = CK_FloatingComplexToIntegralComplex;
4539CK = CK_IntegralComplexToFloatingComplex;
4541CK = CK_IntegralComplexCast;
4567 "Attempting implicit fixed point conversion without a fixed " 4572 nullptr, CCK).
get();
4576 nullptr, CCK).
get();
4580 nullptr, CCK).
get();
4584 nullptr, CCK).
get();
4588 nullptr, CCK).
get();
4592 nullptr, CCK).
get();
4597 nullptr, CCK).
get();
4607diag::ext_typecheck_convert_incompatible_pointer)
4612diag::ext_typecheck_convert_incompatible_pointer)
4619}
else if(
getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
4620!
ObjC().CheckObjCARCUnavailableWeakConversion(ToType,
4625 Diag(From->
getBeginLoc(), diag::err_arc_convesion_of_weak_unavailable)
4634 if(!FromPteeType.
isNull() && !ToPteeType.
isNull() &&
4654 if(Kind == CK_BlockPointerToObjCPointerCast) {
4716&BasePath, CCK).
get();
4745 QualTypeElType = ToComplex->getElementType();
4753isFloatingComplex ? CK_FloatingCast : CK_FloatingToIntegral).
get();
4757isFloatingComplex ? CK_IntegralToFloating : CK_IntegralCast).
get();
4761isFloatingComplex ? CK_FloatingRealToComplex
4762: CK_IntegralRealToComplex).
get();
4767 QualTypeElType = FromComplex->getElementType();
4772isFloatingComplex ? CK_FloatingComplexToReal
4773: CK_IntegralComplexToReal,
4782isFloatingComplex ? CK_FloatingCast
4783: CK_IntegralToFloating,
4789isFloatingComplex ? CK_FloatingToIntegral
4806AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast;
4819From = FromRes.
get();
4821 "Improper transparent union conversion");
4829CK_ZeroToOCLOpaqueType,
4844llvm_unreachable(
"Improper second standard conversion");
4853 "Dimension conversion for matrix types is not implemented yet.");
4855 "Dimension conversion output must be vector or scalar type.");
4872 QualTypeTruncTy = FromVec->getElementType();
4883llvm_unreachable(
"Improper element standard conversion");
4887 switch(SCS.
Third) {
4910CK = CK_AddressSpaceConversion;
4915CK = CK_AddressSpaceConversion;
4921<< InitialFromType << ToType;
4932? diag::ext_deprecated_string_literal_conversion
4933: diag::warn_deprecated_string_literal_conversion)
4941llvm_unreachable(
"Improper third standard conversion");
4946 if(!ToAtomicType.
isNull()) {
4982S.
Diag(
T->getTypeLoc().getBeginLoc(), diag::err_vla_unsupported)
4983<< 1 << TypeTraitID;
4996S.
Diag(
T->getTypeLoc().getBeginLoc(), diag::err_atomic_unsupported)
5020 default: llvm_unreachable(
"not a UTT");
5022 caseUTT_IsCompleteType:
5030 caseUTT_IsIntegral:
5031 caseUTT_IsFloatingPoint:
5033 caseUTT_IsBoundedArray:
5035 caseUTT_IsReferenceable:
5036 caseUTT_IsLvalueReference:
5037 caseUTT_IsRvalueReference:
5038 caseUTT_IsMemberFunctionPointer:
5039 caseUTT_IsMemberObjectPointer:
5041 caseUTT_IsScopedEnum:
5044 caseUTT_IsFunction:
5045 caseUTT_IsReference:
5046 caseUTT_IsArithmetic:
5047 caseUTT_IsFundamental:
5050 caseUTT_IsCompound:
5051 caseUTT_IsMemberPointer:
5052 caseUTT_IsTypedResourceElementCompatible:
5061 caseUTT_IsVolatile:
5063 caseUTT_IsUnboundedArray:
5064 caseUTT_IsUnsigned:
5067 caseUTT_IsInterfaceClass:
5073 caseUTT_IsPolymorphic:
5074 caseUTT_IsAbstract:
5078 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
5087 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
5091 caseUTT_IsAggregate:
5092 caseUTT_IsImplicitLifetime:
5097 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
5102 caseUTT_IsTriviallyCopyable:
5103 caseUTT_IsStandardLayout:
5106 caseUTT_IsBitwiseCloneable:
5109 caseUTT_IsTriviallyRelocatable:
5110 caseUTT_IsTriviallyEqualityComparable:
5111 caseUTT_CanPassInRegs:
5115 caseUTT_HasNothrowAssign:
5116 caseUTT_HasNothrowMoveAssign:
5117 caseUTT_HasNothrowConstructor:
5118 caseUTT_HasNothrowCopy:
5119 caseUTT_HasTrivialAssign:
5120 caseUTT_HasTrivialMoveAssign:
5121 caseUTT_HasTrivialDefaultConstructor:
5122 caseUTT_HasTrivialMoveConstructor:
5123 caseUTT_HasTrivialCopy:
5124 caseUTT_HasTrivialDestructor:
5125 caseUTT_HasVirtualDestructor:
5129 caseUTT_HasUniqueObjectRepresentations:
5135 caseUTT_IsDestructible:
5136 caseUTT_IsNothrowDestructible:
5137 caseUTT_IsTriviallyDestructible:
5138 caseUTT_IsIntangibleType:
5143 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
5154 if((RD->*HasTrivial)() && !(RD->*HasNonTrivial)())
5160 if(
Self.LookupQualifiedName(Res, RD)) {
5161 boolFoundOperator =
false;
5164Op != OpEnd; ++Op) {
5165 if(isa<FunctionTemplateDecl>(*Op))
5169 if((Operator->*IsDesiredOp)()) {
5170FoundOperator =
true;
5172CPT =
Self.ResolveExceptionSpec(KeyLoc, CPT);
5177 returnFoundOperator;
5185 if(
Decl->isUnion())
5187 if(
Decl->isLambda())
5188 return Decl->isCapturelessLambda();
5199 Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(),
5206Functions, &Operand, &Operand);
5210 const auto*
CallExpr= dyn_cast<CXXOperatorCallExpr>(
Result.get());
5214 autoParamT = Callee->getParamDecl(0)->getType();
5215 if(!Callee->isDefaulted())
5217 if(!ParamT->isReferenceType() && !
Decl->isTriviallyCopyable())
5219 if(ParamT.getNonReferenceType()->getUnqualifiedDesugaredType() !=
5220 Decl->getTypeForDecl())
5224 returnllvm::all_of(
Decl->bases(),
5226if (const auto *RD = BS.getType()->getAsCXXRecordDecl())
5227return HasNonDeletedDefaultedEqualityComparison(
5232auto Type = FD->getType();
5233if (Type->isArrayType())
5234Type = Type->getBaseElementTypeUnsafe()
5235->getCanonicalTypeUnqualified();
5237if (Type->isReferenceType() || Type->isEnumeralType())
5239if (const auto *RD = Type->getAsCXXRecordDecl())
5240return HasNonDeletedDefaultedEqualityComparison(S, RD, KeyLoc);
5257CanonicalType,
false);
5264assert(!
T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
5268 default: llvm_unreachable(
"not a UTT");
5273 caseUTT_IsIntegral:
5275 caseUTT_IsFloatingPoint:
5280 if(
const auto*CAT =
C.getAsConstantArrayType(
T))
5281 returnCAT->getSize() != 0;
5283 caseUTT_IsBoundedArray:
5288 if(
const auto*CAT =
C.getAsConstantArrayType(
T))
5289 returnCAT->getSize() != 0;
5291 caseUTT_IsUnboundedArray:
5297 caseUTT_IsLvalueReference:
5299 caseUTT_IsRvalueReference:
5301 caseUTT_IsMemberFunctionPointer:
5303 caseUTT_IsMemberObjectPointer:
5307 caseUTT_IsScopedEnum:
5313 caseUTT_IsFunction:
5318 caseUTT_IsReference:
5320 caseUTT_IsArithmetic:
5322 caseUTT_IsFundamental:
5332 switch(
T.getObjCLifetime()) {
5345 caseUTT_IsCompound:
5347 caseUTT_IsMemberPointer:
5353 return T.isConstQualified();
5354 caseUTT_IsVolatile:
5355 return T.isVolatileQualified();
5357 return T.isTrivialType(
C);
5358 caseUTT_IsTriviallyCopyable:
5359 return T.isTriviallyCopyableType(
C);
5360 caseUTT_IsStandardLayout:
5363 return T.isPODType(
C);
5370 caseUTT_IsPolymorphic:
5374 caseUTT_IsAbstract:
5378 caseUTT_IsAggregate:
5387 caseUTT_IsInterfaceClass:
5392 returnRD->
hasAttr<FinalAttr>();
5399 caseUTT_IsUnsigned:
5418 caseUTT_HasTrivialDefaultConstructor:
5423 if(
T.isPODType(
C))
5425 if(
CXXRecordDecl*RD =
C.getBaseElementType(
T)->getAsCXXRecordDecl())
5429 caseUTT_HasTrivialMoveConstructor:
5433 if(
T.isPODType(
C))
5435 if(
CXXRecordDecl*RD =
C.getBaseElementType(
T)->getAsCXXRecordDecl())
5438 caseUTT_HasTrivialCopy:
5450 caseUTT_HasTrivialMoveAssign:
5454 if(
T.isPODType(
C))
5456 if(
CXXRecordDecl*RD =
C.getBaseElementType(
T)->getAsCXXRecordDecl())
5459 caseUTT_HasTrivialAssign:
5472 if(
T.isConstQualified())
5474 if(
T.isPODType(
C))
5480 caseUTT_IsDestructible:
5481 caseUTT_IsTriviallyDestructible:
5482 caseUTT_IsNothrowDestructible:
5501 if(UTT == UTT_IsTriviallyDestructible &&
T.isDestructedType())
5508 if(
auto*RD =
C.getBaseElementType(
T)->getAsCXXRecordDecl()) {
5519 if(UTT == UTT_IsNothrowDestructible) {
5521CPT =
Self.ResolveExceptionSpec(KeyLoc, CPT);
5528 caseUTT_HasTrivialDestructor:
5543 if(
CXXRecordDecl*RD =
C.getBaseElementType(
T)->getAsCXXRecordDecl())
5547 caseUTT_HasNothrowAssign:
5555 if(
C.getBaseElementType(
T).isConstQualified())
5568 caseUTT_HasNothrowMoveAssign:
5572 if(
T.isPODType(
C))
5581 caseUTT_HasNothrowCopy:
5594 boolFoundConstructor =
false;
5596 for(
const auto*ND :
Self.LookupConstructors(RD)) {
5600 if(isa<FunctionTemplateDecl>(ND->getUnderlyingDecl()))
5603 if(isa<UsingDecl>(ND))
5605 auto*Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());
5606 if(Constructor->isCopyConstructor(FoundTQs)) {
5607FoundConstructor =
true;
5609CPT =
Self.ResolveExceptionSpec(KeyLoc, CPT);
5619 returnFoundConstructor;
5622 caseUTT_HasNothrowConstructor:
5630 if(
CXXRecordDecl*RD =
C.getBaseElementType(
T)->getAsCXXRecordDecl()) {
5635 boolFoundConstructor =
false;
5636 for(
const auto*ND :
Self.LookupConstructors(RD)) {
5638 if(isa<FunctionTemplateDecl>(ND->getUnderlyingDecl()))
5641 if(isa<UsingDecl>(ND))
5643 auto*Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());
5644 if(Constructor->isDefaultConstructor()) {
5645FoundConstructor =
true;
5647CPT =
Self.ResolveExceptionSpec(KeyLoc, CPT);
5656 returnFoundConstructor;
5659 caseUTT_HasVirtualDestructor:
5671 caseUTT_IsCompleteType:
5676 caseUTT_HasUniqueObjectRepresentations:
5677 return C.hasUniqueObjectRepresentations(
T);
5678 caseUTT_IsTriviallyRelocatable:
5679 return T.isTriviallyRelocatableType(
C);
5680 caseUTT_IsBitwiseCloneable:
5681 return T.isBitwiseCloneableType(
C);
5682 caseUTT_IsReferenceable:
5683 return T.isReferenceable();
5684 caseUTT_CanPassInRegs:
5687 Self.Diag(KeyLoc, diag::err_builtin_pass_in_regs_non_class) <<
T;
5689 caseUTT_IsTriviallyEqualityComparable:
5691 caseUTT_IsImplicitLifetime: {
5693tok::kw___builtin_is_implicit_lifetime);
5695tok::kw___builtin_is_implicit_lifetime);
5725 caseUTT_IsIntangibleType:
5726assert(
Self.getLangOpts().HLSL &&
"intangible types are HLSL-only feature");
5729diag::err_incomplete_type))
5732tok::kw___builtin_hlsl_is_intangible))
5736 caseUTT_IsTypedResourceElementCompatible:
5737assert(
Self.getLangOpts().HLSL &&
5738 "typed resource element compatible types are an HLSL-only feature");
5742 return Self.HLSL().IsTypedResourceElementCompatible(
T);
5751 SourceLocationKeyLoc, llvm::BumpPtrAllocator &OpaqueExprAllocator) {
5792LhsT =
Self.Context.getRValueReferenceType(LhsT);
5809 if(
Init.Failed())
5832 if(Kind <=
BTT_Last&& Kind != BTT_ReferenceBindsToTemporary &&
5833Kind != BTT_ReferenceConstructsFromTemporary &&
5834Kind != BTT_ReferenceConvertsFromTemporary)
5836Args[1], RParenLoc);
5839 caseclang::BTT_ReferenceBindsToTemporary:
5840 caseclang::BTT_ReferenceConstructsFromTemporary:
5841 caseclang::BTT_ReferenceConvertsFromTemporary:
5842 caseclang::TT_IsConstructible:
5843 caseclang::TT_IsNothrowConstructible:
5844 caseclang::TT_IsTriviallyConstructible: {
5858assert(!Args.empty());
5863 for(
const auto*TSI : Args) {
5869diag::err_incomplete_type_used_in_type_trait_expr))
5883llvm::BumpPtrAllocator OpaqueExprAllocator;
5885ArgExprs.reserve(Args.size() - 1);
5886 for(
unsignedI = 1, N = Args.size(); I != N; ++I) {
5887 QualTypeArgTy = Args[I]->getType();
5906Kind == clang::BTT_ReferenceConvertsFromTemporary
5910 if(
Init.Failed())
5917 if(Kind == clang::TT_IsConstructible)
5920 if(Kind == clang::BTT_ReferenceBindsToTemporary ||
5921Kind == clang::BTT_ReferenceConstructsFromTemporary ||
5922Kind == clang::BTT_ReferenceConvertsFromTemporary) {
5926 if(!
Init.isDirectReferenceBinding())
5929 if(Kind == clang::BTT_ReferenceBindsToTemporary)
5933 if(
U->isReferenceType())
5941OpaqueExprAllocator)
5945 if(Kind == clang::TT_IsNothrowConstructible)
5948 if(Kind == clang::TT_IsTriviallyConstructible) {
5951 if(
T.getNonReferenceType().hasNonTrivialObjCLifetime())
5959llvm_unreachable(
"unhandled type trait");
5962 default: llvm_unreachable(
"not a TT");
5973 caseUTT_HasNothrowAssign:
5974 caseUTT_HasNothrowMoveAssign:
5975Replacement = BTT_IsNothrowAssignable;
5977 caseUTT_HasNothrowCopy:
5978 caseUTT_HasNothrowConstructor:
5979Replacement = TT_IsNothrowConstructible;
5981 caseUTT_HasTrivialAssign:
5982 caseUTT_HasTrivialMoveAssign:
5983Replacement = BTT_IsTriviallyAssignable;
5985 caseUTT_HasTrivialCopy:
5986Replacement = UTT_IsTriviallyCopyable;
5988 caseUTT_HasTrivialDefaultConstructor:
5989 caseUTT_HasTrivialMoveConstructor:
5990Replacement = TT_IsTriviallyConstructible;
5992 caseUTT_HasTrivialDestructor:
5993Replacement = UTT_IsTriviallyDestructible;
5998S.
Diag(KWLoc, diag::warn_deprecated_builtin)
6004 if(Arity && N != Arity) {
6005 Diag(
Loc, diag::err_type_trait_arity)
6010 if(!Arity && N == 0) {
6011 Diag(
Loc, diag::err_type_trait_arity)
6023 returnTypeTraitReturnType::Bool;
6033*
this, Kind, KWLoc, Args[0]->getType()))
6036DiagnoseBuiltinDeprecation(*
this, Kind, KWLoc);
6039 for(
unsignedI = 0, N = Args.size(); I != N; ++I) {
6040 if(Args[I]->getType()->isDependentType()) {
6047 caseTypeTraitReturnType::Bool: {
6051KWLoc, Kind, Args, RParenLoc,
Result);
6054llvm_unreachable(
"unhandled type trait return type");
6061ConvertedArgs.reserve(Args.size());
6063 for(
unsignedI = 0, N = Args.size(); I != N; ++I) {
6069ConvertedArgs.push_back(TInfo);
6081 "Cannot evaluate traits of dependent types");
6084 caseBTT_IsBaseOf: {
6092 if(!rhsRecord || !lhsRecord) {
6095 if(!LHSObjTy || !RHSObjTy)
6100 if(!BaseInterface || !DerivedInterface)
6103 if(
Self.RequireCompleteType(
6105diag::err_incomplete_type_used_in_type_trait_expr))
6111assert(
Self.Context.hasSameUnqualifiedType(LhsT, RhsT)
6112== (lhsRecord == rhsRecord));
6118 if(rhsRecord && rhsRecord->getDecl()->isUnion())
6121 if(lhsRecord == rhsRecord)
6128 if(
Self.RequireCompleteType(
6130diag::err_incomplete_type_used_in_type_trait_expr))
6133 returncast<CXXRecordDecl>(rhsRecord->getDecl())
6134->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->
getDecl()));
6136 caseBTT_IsVirtualBaseOf: {
6140 if(!BaseRecord || !DerivedRecord) {
6142tok::kw___builtin_is_virtual_base_of);
6144tok::kw___builtin_is_virtual_base_of);
6148 if(BaseRecord->
isUnionType() || DerivedRecord->isUnionType())
6152!DerivedRecord->isStructureOrClassType())
6156diag::err_incomplete_type))
6159 returncast<CXXRecordDecl>(DerivedRecord->getDecl())
6160->isVirtuallyDerivedFrom(cast<CXXRecordDecl>(BaseRecord->
getDecl()));
6163 return Self.Context.hasSameType(LhsT, RhsT);
6164 caseBTT_TypeCompatible: {
6167 QualTypeLhs =
Self.getASTContext().getUnqualifiedArrayType(LhsT, LhsQuals);
6168 QualTypeRhs =
Self.getASTContext().getUnqualifiedArrayType(RhsT, RhsQuals);
6169 return Self.Context.typesAreCompatible(Lhs, Rhs);
6171 caseBTT_IsConvertible:
6172 caseBTT_IsConvertibleTo:
6173 caseBTT_IsNothrowConvertible: {
6176llvm::BumpPtrAllocator OpaqueExprAllocator;
6178OpaqueExprAllocator);
6179 if(
Result.isInvalid())
6182 if(BTT != BTT_IsNothrowConvertible)
6188 caseBTT_IsAssignable:
6189 caseBTT_IsNothrowAssignable:
6190 caseBTT_IsTriviallyAssignable: {
6203 Self.RequireCompleteType(
6205diag::err_incomplete_type_used_in_type_trait_expr))
6208 Self.RequireCompleteType(
6210diag::err_incomplete_type_used_in_type_trait_expr))
6220LhsT =
Self.Context.getRValueReferenceType(LhsT);
6222RhsT =
Self.Context.getRValueReferenceType(RhsT);
6236 if(
Result.isInvalid())
6240 Self.CheckUnusedVolatileAssignment(
Result.get());
6245 if(BTT == BTT_IsAssignable)
6248 if(BTT == BTT_IsNothrowAssignable)
6251 if(BTT == BTT_IsTriviallyAssignable) {
6257 return!
Result.get()->hasNonTrivialCall(
Self.Context);
6260llvm_unreachable(
"unhandled type trait");
6263 caseBTT_IsLayoutCompatible: {
6266diag::err_incomplete_type);
6269diag::err_incomplete_type);
6274 return Self.IsLayoutCompatible(LhsT, RhsT);
6276 caseBTT_IsPointerInterconvertibleBaseOf: {
6278!
Self.getASTContext().hasSameUnqualifiedType(LhsT, RhsT)) {
6280diag::err_incomplete_type);
6284tok::kw___is_pointer_interconvertible_base_of);
6286tok::kw___is_pointer_interconvertible_base_of);
6288 return Self.IsPointerInterconvertibleBaseOf(Lhs, Rhs);
6290 caseBTT_IsDeducible: {
6291 const auto*TSTToBeDeduced = cast<DeducedTemplateSpecializationType>(LhsT);
6293 return Self.DeduceTemplateArgumentsFromType(
6294TSTToBeDeduced->getTemplateName().getAsTemplateDecl(), RhsT,
6297 caseBTT_IsScalarizedLayoutCompatible: {
6300diag::err_incomplete_type))
6304diag::err_incomplete_type))
6308 Self, Lhs, tok::kw___builtin_hlsl_is_scalarized_layout_compatible);
6310 Self, Rhs, tok::kw___builtin_hlsl_is_scalarized_layout_compatible);
6312 return Self.HLSL().IsScalarizedLayoutCompatible(LhsT, RhsT);
6315llvm_unreachable(
"not a BTT");
6317llvm_unreachable(
"Unknown type trait or not implemented");
6336assert(!
T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
6342 while(
const ArrayType*AT =
Self.Context.getAsArrayType(
T)) {
6344 T= AT->getElementType();
6350 caseATT_ArrayExtent: {
6351llvm::APSInt
Value;
6353 if(
Self.VerifyIntegerConstantExpression(
6354DimExpr, &
Value, diag::err_dimension_expr_not_constant_integer)
6357 if(
Value.isSigned() &&
Value.isNegative()) {
6358 Self.Diag(KeyLoc, diag::err_dimension_expr_not_constant_integer)
6366 boolMatched =
false;
6367 while(
const ArrayType*AT =
Self.Context.getAsArrayType(
T)) {
6373 T= AT->getElementType();
6378 returnCAT->getLimitedSize();
6384llvm_unreachable(
"Unknown type trait or not implemented");
6424 caseET_IsLValueExpr:
return E->
isLValue();
6425 caseET_IsRValueExpr:
6428llvm_unreachable(
"Expression trait not covered by switch");
6454 "placeholders should have been weeded out by now");
6469 const char*OpSpelling = isIndirect ?
"->*":
".*";
6477 Diag(
Loc, diag::err_bad_memptr_rhs)
6499 Diag(
Loc, diag::err_bad_memptr_lhs)
6500<< OpSpelling << 1 << LHSType
6509OpSpelling, (
int)isIndirect)) {
6514 Diag(
Loc, diag::err_bad_memptr_lhs) << OpSpelling
6538 Diag(
Loc, diag::err_pointer_to_member_type) << isIndirect;
6557 switch(Proto->getRefQualifier()) {
6566 if(Proto->isConst() && !Proto->isVolatile())
6568? diag::warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue
6569: diag::ext_pointer_to_const_ref_member_on_rvalue);
6571 Diag(
Loc, diag::err_pointer_to_member_oper_value_classify)
6578 Diag(
Loc, diag::err_pointer_to_member_oper_value_classify)
6591 if(
Result->isFunctionType()) {
6594}
else if(isIndirect) {
6612 bool&HaveConversion,
6614HaveConversion =
false;
6637HaveConversion =
true;
6652 boolFDerivedFromT = FRec && TRec && FRec != TRec &&
6653 Self.IsDerivedFrom(QuestionLoc, FTy, TTy);
6654 if(FRec && TRec && (FRec == TRec || FDerivedFromT ||
6655 Self.IsDerivedFrom(QuestionLoc, TTy, FTy))) {
6659 if(FRec == TRec || FDerivedFromT) {
6664HaveConversion =
true;
6687HaveConversion = !InitSeq.
Failed();
6702 Expr*Args[2] = { LHS.
get(), RHS.
get() };
6705 Self.AddBuiltinOperatorCandidates(OO_Conditional, QuestionLoc, Args,
6713LHS.
get(), Best->BuiltinParamTypes[0], Best->Conversions[0],
6720RHS.
get(), Best->BuiltinParamTypes[1], Best->Conversions[1],
6726 Self.MarkFunctionReferenced(QuestionLoc, Best->Function);
6735 if(
Self.DiagnoseConditionalForNull(LHS.
get(), RHS.
get(), QuestionLoc))
6738 Self.Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
6744 Self.Diag(QuestionLoc, diag::err_conditional_ambiguous_ovl)
6752llvm_unreachable(
"Conditional operator has only built-in overloads");
6763 Expr*Arg =
E.get();
6766 if(
Result.isInvalid())
6781assert(!EltTy->
isEnumeralType() &&
"Vectors cant be enum types");
6791assert(!EltTy->
isEnumeralType() &&
"Vectors cant be enum types");
6803 QualTypeCondElementTy = CondVT->getElementType();
6804 unsignedCondElementCount = CondVT->getNumElements();
6813 if(LHSVT && RHSVT) {
6814 if(isa<ExtVectorType>(CondVT) != isa<ExtVectorType>(LHSVT)) {
6815 Diag(QuestionLoc, diag::err_conditional_vector_cond_result_mismatch)
6816<<
isa<ExtVectorType>(CondVT);
6822 Diag(QuestionLoc, diag::err_conditional_vector_mismatched)
6823<< LHSType << RHSType;
6827}
else if(LHSVT || RHSVT) {
6829LHS, RHS, QuestionLoc,
false,
true,
6833 if(ResultType.isNull())
6846 Diag(QuestionLoc, diag::err_conditional_vector_operand_type)
6861assert(!ResultType.isNull() && ResultType->isVectorType() &&
6863 "Result should have been a vector type");
6864 auto*ResultVectorTy = ResultType->castAs<
VectorType>();
6865 QualTypeResultElementTy = ResultVectorTy->getElementType();
6866 unsignedResultElementCount = ResultVectorTy->getNumElements();
6868 if(ResultElementCount != CondElementCount) {
6869 Diag(QuestionLoc, diag::err_conditional_vector_size) << CondType
6876 Diag(QuestionLoc, diag::err_conditional_vector_element_size) << CondType
6894llvm::ElementCount CondElementCount =
6906 if(LHSBT && RHSBT) {
6909 Diag(QuestionLoc, diag::err_conditional_vector_mismatched)
6910<< LHSType << RHSType;
6913ResultType = LHSType;
6914}
else if(LHSBT || RHSBT) {
6917 if(ResultType.isNull())
6926ResultElementTy = LHSType;
6932 Diag(QuestionLoc, diag::err_conditional_vector_operand_type)
6938ResultElementTy, CondElementCount.getKnownMinValue());
6944assert(!ResultType.isNull() && ResultType->isSveVLSBuiltinType() &&
6945 "Result should have been a vector type");
6946 auto*ResultBuiltinTy = ResultType->castAs<
BuiltinType>();
6948llvm::ElementCount ResultElementCount =
6951 if(ResultElementCount != CondElementCount) {
6952 Diag(QuestionLoc, diag::err_conditional_vector_size)
6953<< CondType << ResultType;
6959 Diag(QuestionLoc, diag::err_conditional_vector_element_size)
6960<< CondType << ResultType;
6977 boolIsVectorConditional =
6980 boolIsSizelessVectorConditional =
6987 ExprResultCondRes = IsVectorConditional || IsSizelessVectorConditional
7013 if(LVoid || RVoid) {
7022 if(IsVectorConditional) {
7025 boolIsThrow = LVoid ? LThrow : RThrow;
7026 Diag(DiagLoc.
getBegin(), diag::err_conditional_vector_has_void)
7027<< DiagLoc << IsThrow;
7031 if(LThrow != RThrow) {
7032 Expr*NonThrow = LThrow ? RHS.
get() : LHS.
get();
7046 Diag(QuestionLoc, diag::err_conditional_void_nonvoid)
7047<< (LVoid ? RTy : LTy) << (LVoid ? 0 : 1)
7053 if(IsVectorConditional)
7056 if(IsSizelessVectorConditional)
7061 Diag(QuestionLoc, diag::err_wasm_table_conditional_expression)
7074 boolHaveL2R, HaveR2L;
7081 if(HaveL2R && HaveR2L) {
7082 Diag(QuestionLoc, diag::err_conditional_ambiguous)
7094}
else if(HaveR2L) {
7118ReferenceConversions::Qualification |
7119ReferenceConversions::NestedQualification |
7120ReferenceConversions::Function;
7125!(RefConv & ~AllowedConversions) &&
7133!(RefConv & ~AllowedConversions) &&
7149 if(Same && LVK == RVK && LVK !=
VK_PRValue&&
7223diag::err_typecheck_cond_incompatible_operands) << LTy << RTy
7247 if(!Composite.
isNull())
7254 if(!Composite.
isNull())
7261 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
7281 boolT2IsPointerLike = T2->isAnyPointerType() || T2->isMemberPointerType() ||
7282T2->isNullPtrType();
7283 if(!T1IsPointerLike && !T2IsPointerLike)
7291 if(T1IsPointerLike &&
7295? CK_NullToMemberPointer
7296: CK_NullToPointer).
get();
7299 if(T2IsPointerLike &&
7303? CK_NullToMemberPointer
7304: CK_NullToPointer).
get();
7309 if(!T1IsPointerLike || !T2IsPointerLike)
7312 "nullptr_t should be a null pointer constant");
7315 enum Kind{
Pointer, ObjCPointer, MemberPointer, Array } K;
7320 const Type*ClassOrBound;
7322Step(
KindK,
const Type*ClassOrBound =
nullptr)
7323: K(K), ClassOrBound(ClassOrBound) {}
7334 if(
auto*CAT = cast_or_null<ConstantArrayType>(ClassOrBound))
7336ArraySizeModifier::Normal, 0);
7340llvm_unreachable(
"unknown step kind");
7362 unsignedNeedConstBefore = 0;
7364assert(!Composite1.
isNull() && !Composite2.
isNull());
7371 if(!Steps.empty()) {
7381}
else if(Steps.size() == 1) {
7384 if(MaybeQ1 == MaybeQ2) {
7403assert(Steps.size() == 1);
7411assert(Steps.size() == 1);
7415Steps.back().Quals = Quals;
7416 if(Q1 != Quals || Q2 != Quals)
7417NeedConstBefore = Steps.size() - 1;
7425 auto*CAT1 = dyn_cast<ConstantArrayType>(Arr1);
7426 auto*CAT2 = dyn_cast<ConstantArrayType>(Arr2);
7427 if(CAT1 && CAT2 && CAT1->getSize() == CAT2->getSize()) {
7430Steps.emplace_back(Step::Array, CAT1);
7433 boolIAT1 = isa<IncompleteArrayType>(Arr1);
7434 boolIAT2 = isa<IncompleteArrayType>(Arr2);
7435 if((IAT1 && IAT2) ||
7437((
bool)CAT1 != (
bool)CAT2) &&
7438(Steps.empty() || Steps.back().K != Step::Array))) {
7444Steps.emplace_back(Step::Array);
7446NeedConstBefore = Steps.size();
7456Steps.emplace_back(Step::Pointer);
7465Steps.emplace_back(Step::ObjCPointer);
7489 else if(Steps.empty())
7495Steps.emplace_back(Step::MemberPointer,
Class);
7507Steps.emplace_back(Step::Pointer);
7545 if(Steps.size() == 1) {
7564FPT1->getParamTypes(), EPI1);
7566FPT2->getParamTypes(), EPI2);
7572 if(Steps.size() == 1 && Steps.front().K == Step::Pointer &&
7578Composite2 = Composite1;
7580Composite1 = Composite2;
7589Composite1 = Composite2;
7591Composite2 = Composite1;
7601 for(
unsignedI = 0; I != NeedConstBefore; ++I)
7602Steps[I].Quals.addConst();
7606 for(
auto&S : llvm::reverse(Steps))
7607Composite = S.rebuild(
Context, Composite);
7628E1 = E1Result.
get();
7633E2 = E2Result.
get();
7643assert(!isa<CXXBindTemporaryExpr>(
E) &&
"Double-bound temporary?");
7654 boolReturnsRetained;
7659 Expr*Callee =
Call->getCallee()->IgnoreParens();
7665 T= BinOp->getRHS()->getType();
7666 else if(
MemberExpr*Mem = dyn_cast<MemberExpr>(Callee))
7667 T= Mem->getMemberDecl()->getType();
7682}
else if(isa<StmtExpr>(
E)) {
7683ReturnsRetained =
true;
7687}
else if(isa<CastExpr>(
E) &&
7688isa<BlockExpr>(cast<CastExpr>(
E)->getSubExpr())) {
7697 D= Send->getMethodDecl();
7698}
else if(
ObjCBoxedExpr*BoxedExpr = dyn_cast<ObjCBoxedExpr>(
E)) {
7699 D= BoxedExpr->getBoxingMethod();
7703 if(ArrayLit->getNumElements() == 0 &&
7707 D= ArrayLit->getArrayWithObjectsMethod();
7709= dyn_cast<ObjCDictionaryLiteral>(
E)) {
7712 if(DictLit->getNumElements() == 0 &&
7716 D= DictLit->getDictWithObjectsMethod();
7719ReturnsRetained = (
D&&
D->
hasAttr<NSReturnsRetainedAttr>());
7724 if(!ReturnsRetained &&
7735 CastKindck = (ReturnsRetained ? CK_ARCConsumeObject
7736: CK_ARCReclaimReturnedObject);
7754RT = cast<RecordType>(
T);
7756 caseType::ConstantArray:
7757 caseType::IncompleteArray:
7758 caseType::VariableArray:
7759 caseType::DependentSizedArray:
7760 T= cast<ArrayType>(
T)->getElementType().getTypePtr();
7780 PDiag(diag::err_access_dtor_temp)
7811assert(SubExpr &&
"subexpression can't be null!");
7833assert(SubStmt &&
"sub-statement can't be null!");
7856 "not in a decltype expression");
7859 if(
Result.isInvalid())
7873 if(
ParenExpr*PE = dyn_cast<ParenExpr>(
E)) {
7877 if(SubExpr.
get() == PE->getSubExpr())
7882 if(BO->getOpcode() == BO_Comma) {
7886 if(RHS.
get() == BO->getRHS())
7889BO->
getType(), BO->getValueKind(),
7890BO->getObjectKind(), BO->getOperatorLoc(),
7891BO->getFPFeatures());
7908 if(
Result.isInvalid())
7918 for(
unsignedI = 0, N =
ExprEvalContexts.back().DelayedDecltypeCalls.size();
7921 if(
Call== TopCall)
7925 Call->getBeginLoc(),
Call,
Call->getDirectCallee()))
7931 for(
unsignedI = 0, N =
ExprEvalContexts.back().DelayedDecltypeBinds.size();
7935 if(
Bind== TopBind)
7941 Bind->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl();
7947 PDiag(diag::err_access_dtor_temp)
7948<<
Bind->getType());
7963 unsignedSkipStart = OperatorArrows.size(), SkipCount = 0;
7966 if(OperatorArrows.size() > Limit) {
7968SkipStart = (Limit - 1) / 2 + (Limit - 1) % 2;
7969SkipCount = OperatorArrows.size() - (Limit - 1);
7972 for(
unsignedI = 0; I < OperatorArrows.size();
) {
7973 if(I == SkipStart) {
7974S.
Diag(OperatorArrows[I]->getLocation(),
7975diag::note_operator_arrows_suppressed)
7979S.
Diag(OperatorArrows[I]->getLocation(), diag::note_operator_arrow_here)
7980<< OperatorArrows[I]->getCallResultType();
7990 bool&MayBePseudoDestructor) {
8001MayBePseudoDestructor =
false;
8006 if(OpKind == tok::arrow)
8011MayBePseudoDestructor =
true;
8018 if(OpKind == tok::arrow) {
8020 boolNoArrowOperatorFound =
false;
8021 boolFirstIteration =
true;
8029 if(OperatorArrows.size() >=
getLangOpts().ArrowDepth) {
8030 Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
8031<< StartingType <<
getLangOpts().ArrowDepth <<
Base->getSourceRange();
8033 Diag(OpLoc, diag::note_operator_arrow_depth)
8046: &NoArrowOperatorFound);
8047 if(
Result.isInvalid()) {
8048 if(NoArrowOperatorFound) {
8049 if(FirstIteration) {
8050 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
8051<< BaseType << 1 <<
Base->getSourceRange()
8053OpKind = tok::period;
8056 Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
8057<< BaseType <<
Base->getSourceRange();
8061diag::note_member_reference_arrow_from_operator_arrow);
8068OperatorArrows.push_back(OpCall->getDirectCallee());
8069BaseType =
Base->getType();
8071 if(!CTypes.insert(CBaseType).second) {
8072 Diag(OpLoc, diag::err_operator_arrow_circular) << StartingType;
8076FirstIteration =
false;
8079 if(OpKind == tok::arrow) {
8083BaseType = AT->getElementType();
8105MayBePseudoDestructor =
true;
8117diag::err_incomplete_member_access)) {
8132 if(
Base->hasPlaceholderType()) {
8137ObjectType =
Base->getType();
8145 if(OpKind == tok::arrow) {
8155ObjectType =
Base->getType();
8160}
else if(!
Base->isTypeDependent()) {
8162S.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
8163<< ObjectType <<
true 8168OpKind = tok::period;
8210 Diag(OpLoc, diag::ext_pseudo_dtor_on_void) <<
Base->getSourceRange();
8212 Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar)
8213<< ObjectType <<
Base->getSourceRange();
8221 if(DestructedTypeInfo) {
8230 if(OpKind == tok::period && ObjectType->
isPointerType() &&
8234 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
8235<< ObjectType <<
0 <<
Base->getSourceRange();
8239*
this, DestructedType))
8244ObjectType = DestructedType;
8245OpKind = tok::arrow;
8247 Diag(DestructedTypeStart, diag::err_pseudo_dtor_type_mismatch)
8248<< ObjectType << DestructedType <<
Base->getSourceRange()
8252DestructedType = ObjectType;
8253DestructedTypeInfo =
8264 Diag(DestructedTypeStart, diag::err_arc_pseudo_dtor_inconstant_quals)
8265<< ObjectType << DestructedType <<
Base->getSourceRange()
8270DestructedType = ObjectType;
8272DestructedTypeStart);
8285 if(ScopeTypeInfo) {
8287 if(!ScopeType->isDependentType() && !ObjectType->
isDependentType() &&
8291diag::err_pseudo_dtor_type_mismatch)
8292<< ObjectType << ScopeType <<
Base->getSourceRange()
8296ScopeTypeInfo =
nullptr;
8302OpKind == tok::arrow, OpLoc,
8322 "Invalid first type name in pseudo-destructor");
8325 "Invalid second type name in pseudo-destructor");
8334 if(!SS.
isSet()) {
8349S, &SS,
true,
false, ObjectTypePtrForLookup,
8362diag::err_pseudo_dtor_destructor_non_type)
8368DestructedType = ObjectType;
8386 if(
T.isInvalid() || !
T.get()) {
8388DestructedType = ObjectType;
8395 if(!DestructedType.
isNull()) {
8396 if(!DestructedTypeInfo)
8410S, &SS,
true,
false, ObjectTypePtrForLookup,
8414diag::err_pseudo_dtor_destructor_non_type)
8439 if(
T.isInvalid() || !
T.get()) {
8447 if(!ScopeType.isNull() && !ScopeTypeInfo)
8453ScopeTypeInfo, CCLoc, TildeLoc,
8485cast<PackIndexingType>(
T.getTypePtr())->getPattern(),
8492llvm_unreachable(
"Unsupported type in pseudo destructor");
8515Operand = R.
get();
8518Operand->HasSideEffects(
Context,
false)) {
8521 Diag(Operand->getExprLoc(), diag::warn_side_effects_unevaluated_context);
8537 boolIsCompoundAssign =
false;
8538 boolisIncrementDecrementUnaryOp =
false;
8540 if(BO->getLHS()->getType()->isDependentType() ||
8541BO->getRHS()->getType()->isDependentType()) {
8542 if(BO->getOpcode() != BO_Assign)
8544}
else if(!BO->isAssignmentOp())
8547IsCompoundAssign = BO->isCompoundAssignmentOp();
8548LHS = dyn_cast<DeclRefExpr>(BO->getLHS());
8550 if(COCE->getOperator() != OO_Equal)
8552LHS = dyn_cast<DeclRefExpr>(COCE->getArg(0));
8554 if(!UO->isIncrementDecrementOp())
8556isIncrementDecrementUnaryOp =
true;
8557LHS = dyn_cast<DeclRefExpr>(UO->getSubExpr());
8567 if((IsCompoundAssign || isIncrementDecrementUnaryOp) &&
8573iter->getSecond()--;
8638 if(!
T->getDecl()->isComplete()) {
8652diag::err_incomplete_type);
8678 if(isa<ParmVarDecl>(Var))
return true;
8679 const VarDecl*DefVD =
nullptr;
8713 while(isa_and_nonnull<CapturedDecl>(DC))
8717 "The current call operator must be synchronized with Sema's CurContext");
8738!IsFullExprInstantiationDependent)
8747 if(
conststd::optional<unsigned> Index =
8751 const boolIsVarNeverAConstantExpression =
8753 if(!IsFullExprInstantiationDependent || IsVarNeverAConstantExpression) {
8764 false, CaptureType,
8765DeclRefType,
nullptr)) {
8771DeclRefType,
nullptr);
8780 if(
conststd::optional<unsigned> Index =
8783 const unsignedFunctionScopeIndexOfCapturableLambda = *Index;
8786&FunctionScopeIndexOfCapturableLambda);
8798 Consumer.getLookupResult().getLookupKind());
8811 if(ND->isCXXClassMember()) {
8815 Record= NNS->getAsType()->getAsCXXRecordDecl();
8818dyn_cast<CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
8825NewSS, R,
Consumer.isAddressOfOperand()))
8828 nullptr,
nullptr);
8829}
else if(
auto*Ivar = dyn_cast<ObjCIvarDecl>(ND)) {
8831Ivar->getIdentifier());
8845: TypoExprs(TypoExprs) {}
8846 boolVisitTypoExpr(
TypoExpr*TE)
override{
8847TypoExprs.insert(TE);
8852classTransformTypos :
public TreeTransform<TransformTypos> {
8859llvm::SmallDenseMap<TypoExpr *, ExprResult, 2> TransformCache;
8860llvm::SmallDenseMap<OverloadExpr *, Expr *, 4> OverloadResolution;
8872 voidEmitAllDiagnostics(
boolIsAmbiguous) {
8874 auto&State = SemaRef.getTypoExprState(TE);
8875 if(State.DiagHandler) {
8886Replacement.isInvalid() ?
nullptr: Replacement.get()))
8889State.DiagHandler(TC);
8891SemaRef.clearDelayedTypo(TE);
8909 boolCheckAndAdvanceTypoExprCorrectionStreams() {
8910 for(
auto*TE : TypoExprs) {
8911 auto&State = SemaRef.getTypoExprState(TE);
8912TransformCache.erase(TE);
8913 if(!State.Consumer->hasMadeAnyCorrectionProgress())
8915 if(!State.Consumer->finished())
8917State.Consumer->resetCorrectionStream();
8923 if(
auto*OE = dyn_cast_or_null<OverloadExpr>(
E))
8924 E= OverloadResolution[OE];
8928 if(
auto*DRE = dyn_cast<DeclRefExpr>(
E))
8929 returnDRE->getFoundDecl();
8930 if(
auto*ME = dyn_cast<MemberExpr>(
E))
8941 if(Trap.hasErrorOccurred() || Res.
isInvalid())
8944 returnExprFilter(Res.
get());
8956 Expr*FixedExpr = Res.
get();
8958 autoSavedTypoExprs = std::move(TypoExprs);
8959 autoSavedAmbiguousTypoExprs = std::move(AmbiguousTypoExprs);
8961AmbiguousTypoExprs.clear();
8963FindTypoExprs(TypoExprs).TraverseStmt(FixedExpr);
8964 if(!TypoExprs.empty()) {
8968RecursiveTransformLoop(FixedExpr, IsAmbiguous);
8976 auto&SemaTypoExprs = SemaRef.TypoExprs;
8977 for(
auto*TE : TypoExprs) {
8978TransformCache.erase(TE);
8979SemaRef.clearDelayedTypo(TE);
8981 autoSI = find(SemaTypoExprs, TE);
8982 if(SI != SemaTypoExprs.end()) {
8983SemaTypoExprs.erase(SI);
8990SavedTypoExprs.set_union(TypoExprs);
8994TypoExprs = std::move(SavedTypoExprs);
8995AmbiguousTypoExprs = std::move(SavedAmbiguousTypoExprs);
9007 autoSavedTypoExprs = std::move(SemaRef.TypoExprs);
9008SemaRef.TypoExprs.clear();
9011Res = CheckForRecursiveTypos(TryTransform(
E), IsAmbiguous);
9025 if(!CheckAndAdvanceTypoExprCorrectionStreams())
9030 if(!IsAmbiguous && !Res.
isInvalid() && !AmbiguousTypoExprs.empty()) {
9031 autoSavedTransformCache =
9032llvm::SmallDenseMap<TypoExpr *, ExprResult, 2>(TransformCache);
9036 while(!AmbiguousTypoExprs.empty()) {
9037 autoTE = AmbiguousTypoExprs.back();
9041SemaRef.getTypoExprState(TE).Consumer->saveCurrentPosition();
9043 TypoCorrectionTC = SemaRef.getTypoExprState(TE).Consumer->peekNextCorrection();
9049TransformCache.erase(TE);
9050 ExprResultAmbigRes = CheckForRecursiveTypos(TryTransform(
E), IsAmbiguous);
9052 if(!AmbigRes.
isInvalid() || IsAmbiguous) {
9053SemaRef.getTypoExprState(TE).Consumer->resetCorrectionStream();
9054SavedTransformCache.erase(TE);
9056IsAmbiguous =
true;
9059}
while((Next = SemaRef.getTypoExprState(TE).Consumer->peekNextCorrection()) &&
9065AmbiguousTypoExprs.remove(TE);
9066SemaRef.getTypoExprState(TE).Consumer->restoreSavedPosition();
9067TransformCache[TE] = SavedTransformCache[TE];
9069TransformCache = std::move(SavedTransformCache);
9076 auto&SemaTypoExprs = SemaRef.TypoExprs;
9077 for(
autoIterator = SemaTypoExprs.begin(); Iterator != SemaTypoExprs.end();) {
9078 autoTE = *Iterator;
9079 autoFI = find(TypoExprs, TE);
9080 if(FI != TypoExprs.end()) {
9084SemaRef.clearDelayedTypo(TE);
9085Iterator = SemaTypoExprs.erase(Iterator);
9087SemaRef.TypoExprs = std::move(SavedTypoExprs);
9094: BaseTransform(SemaRef), InitDecl(InitDecl), ExprFilter(
Filter) {}
9099 Expr*ExecConfig =
nullptr) {
9100 autoResult = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
9101RParenLoc, ExecConfig);
9102 if(
auto*OE = dyn_cast<OverloadExpr>(Callee)) {
9103 if(Result.isUsable()) {
9104 Expr*ResultCall = Result.get();
9105 if(
auto*BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
9106ResultCall = BE->getSubExpr();
9107 if(
auto*CE = dyn_cast<CallExpr>(ResultCall))
9108OverloadResolution[OE] = CE->getCallee();
9119 boolIsAmbiguous =
false;
9120 ExprResultRes = RecursiveTransformLoop(
E, IsAmbiguous);
9123FindTypoExprs(TypoExprs).TraverseStmt(
E);
9125EmitAllDiagnostics(IsAmbiguous);
9134 auto&CacheEntry = TransformCache[
E];
9135 if(!TypoExprs.insert(
E) && !CacheEntry.isUnset()) {
9140assert(State.Consumer &&
"Cannot transform a cleared TypoExpr");
9144 while(
TypoCorrectionTC = State.Consumer->getNextCorrection()) {
9150State.RecoveryHandler(SemaRef,
E, TC) :
9152 if(!
NE.isInvalid()) {
9157 if((Next = State.Consumer->peekNextCorrection()) &&
9159AmbiguousTypoExprs.insert(
E);
9161AmbiguousTypoExprs.remove(
E);
9163assert(!
NE.isUnset() &&
9164 "Typo was transformed into a valid-but-null ExprResult");
9165 returnCacheEntry =
NE;
9175 boolRecoverUncorrectedTypos,
9183 autoTyposResolved = DelayedTypos.size();
9184 auto Result= TransformTypos(*
this, InitDecl, Filter).Transform(
E);
9185TyposResolved -= DelayedTypos.size();
9188 if(
Result.isInvalid() && RecoverUncorrectedTypos) {
9196 returnTT.TransformExpr(
E);
9200assert(TyposResolved == 0 &&
"Corrected typo but got same Expr back?");
9206 boolDiscardedValue,
boolIsConstexpr,
9207 boolIsTemplateArgument) {
9216 if(DiscardedValue) {
9241CheckCompletedExpr(
FullExpr.get(), CC, IsConstexpr);
9290 while(isa_and_nonnull<CapturedDecl>(DC))
9293 if(IsInLambdaDeclContext && CurrentLSI &&
9320RedeclarationKind::NotForRedeclaration);
9338llvm_unreachable(
"Invalid LookupResult Kind!");
9366 "Exactly one of TypeName and TemplateId must be specified.");
9384 if(
T.isInvalid())
9434 E,
false, NoexceptLoc,
9462 auto*Param = cast<TemplateTypeParmDecl>(TPL->
getParam(0));
9467assert(TC &&
"Type Constraint cannot be null here");
9469assert(IDC &&
"ImmediatelyDeclaredConstraint can't be null here.");
9474[&](llvm::raw_ostream &
OS) {
9475IDC->printPretty(OS,
nullptr,
9476getPrintingPolicy());
9478IsSimple, NoexceptLoc, ReturnTypeRequirement);
9480SubstitutedConstraintExpr =
9481cast<ConceptSpecializationExpr>(Constraint.
get());
9486ReturnTypeRequirement, Status,
9487SubstitutedConstraintExpr);
9496IsSimple, NoexceptLoc,
9497ReturnTypeRequirement);
9530InvalidConstraintEntity,
9546 if(Param->getType()->isVoidType()) {
9547 if(LocalParameters.size() > 1) {
9548 Diag(Param->getBeginLoc(), diag::err_void_only_param);
9550}
else if(Param->getIdentifier()) {
9551 Diag(Param->getBeginLoc(), diag::err_param_with_void_type);
9553}
else if(Param->getType().hasQualifiers()) {
9554 Diag(Param->getBeginLoc(), diag::err_void_param_qualified);
9556}
else if(Param->hasDefaultArg()) {
9560 Diag(Param->getDefaultArgRange().getBegin(),
9561diag::err_requires_expr_local_parameter_default_argument);
9563}
else if(Param->isExplicitObjectParameter()) {
9574 Diag(Param->getExplicitObjectParamThisLoc(),
9575diag::err_requires_expr_explicit_object_parameter);
9579Param->setDeclContext(Body);
9581 if(Param->getIdentifier()) {
9590assert(
CurContext&&
"DeclContext imbalance!");
9592assert(
CurContext&&
"Popped translation unit!");
9601LocalParameters, RParenLoc, Requirements,
Defines the clang::ASTContext interface.
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines a function that returns the minimum OS versions supporting C++17's aligned allocation functio...
static bool CanThrow(Expr *E, ASTContext &Ctx)
static CanQualType GetReturnType(QualType RetTy)
Returns the "extra-canonicalized" return type, which discards qualifiers on the return type.
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
static const char * getPlatformName(Darwin::DarwinPlatformKind Platform, Darwin::DarwinEnvironmentKind Environment)
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Record Record
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::Preprocessor interface.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
This file declares semantic analysis for CUDA constructs.
static void collectPublicBases(CXXRecordDecl *RD, llvm::DenseMap< CXXRecordDecl *, unsigned > &SubobjectsSeen, llvm::SmallPtrSetImpl< CXXRecordDecl * > &VBases, llvm::SetVector< CXXRecordDecl * > &PublicSubobjectsSeen, bool ParentIsPublic)
static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, const TypeSourceInfo *Lhs, const TypeSourceInfo *Rhs, SourceLocation KeyLoc)
static bool HasNonDeletedDefaultedEqualityComparison(Sema &S, const CXXRecordDecl *Decl, SourceLocation KeyLoc)
static bool DiagnoseVLAInCXXTypeTrait(Sema &S, const TypeSourceInfo *T, clang::tok::TokenKind TypeTraitID)
Checks that type T is not a VLA.
static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T)
Perform an "extended" implicit conversion as returned by TryClassUnification.
static void MaybeDecrementCount(Expr *E, llvm::DenseMap< const VarDecl *, int > &RefsMinusAssignments)
static ExprResult attemptRecovery(Sema &SemaRef, const TypoCorrectionConsumer &Consumer, const TypoCorrection &TC)
static void DiagnoseMismatchedNewDelete(Sema &SemaRef, SourceLocation DeleteLoc, const MismatchingNewDeleteDetector &Detector)
static void getUnambiguousPublicSubobjects(CXXRecordDecl *RD, llvm::SmallVectorImpl< CXXRecordDecl * > &Objects)
static bool isLegalArrayNewInitializer(CXXNewInitializationStyle Style, Expr *Init, bool IsCPlusPlus20)
static QualType adjustVectorType(ASTContext &Context, QualType FromTy, QualType ToType, QualType *ElTy=nullptr)
static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(Expr *const FE, LambdaScopeInfo *const CurrentLSI, Sema &S)
Check if the current lambda has any potential captures that must be captured by any of its enclosing ...
static void getUuidAttrOfType(Sema &SemaRef, QualType QT, llvm::SmallSetVector< const UuidAttr *, 1 > &UuidAttrs)
Grabs __declspec(uuid()) off a type, or returns 0 if we cannot resolve to a single GUID.
static bool resolveAllocationOverload(Sema &S, LookupResult &R, SourceRange Range, SmallVectorImpl< Expr * > &Args, bool &PassAlignment, FunctionDecl *&Operator, OverloadCandidateSet *AlignedCandidates, Expr *AlignArg, bool Diagnose)
static QualType adjustCVQualifiersForCXXThisWithinLambda(ArrayRef< FunctionScopeInfo * > FunctionScopes, QualType ThisTy, DeclContext *CurSemaContext, ASTContext &ASTCtx)
static bool DiagnoseAtomicInCXXTypeTrait(Sema &S, const TypeSourceInfo *T, clang::tok::TokenKind TypeTraitID)
Checks that type T is not an atomic type (_Atomic).
static bool FindConditionalOverload(Sema &Self, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
Try to find a common type for two according to C++0x 5.16p5.
static bool TryClassUnification(Sema &Self, Expr *From, Expr *To, SourceLocation QuestionLoc, bool &HaveConversion, QualType &ToType)
Try to convert a type to another according to C++11 5.16p3.
static bool HasNoThrowOperator(const RecordType *RT, OverloadedOperatorKind Op, Sema &Self, SourceLocation KeyLoc, ASTContext &C, bool(CXXRecordDecl::*HasTrivial)() const, bool(CXXRecordDecl::*HasNonTrivial)() const, bool(CXXMethodDecl::*IsDesiredOp)() const)
static bool EvaluateExpressionTrait(ExpressionTrait ET, Expr *E)
static UsualDeallocFnInfo resolveDeallocationOverload(Sema &S, LookupResult &R, bool WantSize, bool WantAlign, llvm::SmallVectorImpl< UsualDeallocFnInfo > *BestFns=nullptr)
Select the correct "usual" deallocation function to use from a selection of deallocation functions (e...
static bool hasNewExtendedAlignment(Sema &S, QualType AllocType)
Determine whether a type has new-extended alignment.
static ExprResult BuildCXXCastArgument(Sema &S, SourceLocation CastLoc, QualType Ty, CastKind Kind, CXXMethodDecl *Method, DeclAccessPair FoundDecl, bool HadMultipleCandidates, Expr *From)
static bool VariableCanNeverBeAConstantExpression(VarDecl *Var, ASTContext &Context)
static bool canRecoverDotPseudoDestructorCallsOnPointerObjects(Sema &SemaRef, QualType DestructedType)
Check if it's ok to try and recover dot pseudo destructor calls on pointer objects.
static bool CheckArrow(Sema &S, QualType &ObjectType, Expr *&Base, tok::TokenKind &OpKind, SourceLocation OpLoc)
static bool resolveBuiltinNewDeleteOverload(Sema &S, CallExpr *TheCall, bool IsDelete, FunctionDecl *&Operator)
static bool doesUsualArrayDeleteWantSize(Sema &S, SourceLocation loc, QualType allocType)
Determine whether a given type is a class for which 'delete[]' would call a member 'operator delete[]...
static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, SourceLocation KeyLoc, TypeSourceInfo *TInfo)
static uint64_t EvaluateArrayTypeTrait(Sema &Self, ArrayTypeTrait ATT, QualType T, Expr *DimExpr, SourceLocation KeyLoc)
static bool isValidVectorForConditionalCondition(ASTContext &Ctx, QualType CondTy)
static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT, SourceLocation Loc, QualType ArgTy)
Check the completeness of a type in a unary type trait.
static void noteOperatorArrows(Sema &S, ArrayRef< FunctionDecl * > OperatorArrows)
Note a set of 'operator->' functions that were used for a member access.
static bool isValidSizelessVectorForConditionalCondition(ASTContext &Ctx, QualType CondTy)
static void buildLambdaThisCaptureFixit(Sema &Sema, LambdaScopeInfo *LSI)
static ExprResult CheckConvertibilityForTypeTraits(Sema &Self, const TypeSourceInfo *Lhs, const TypeSourceInfo *Rhs, SourceLocation KeyLoc, llvm::BumpPtrAllocator &OpaqueExprAllocator)
static bool EvaluateBooleanTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool IsDependent)
static bool isTriviallyEqualityComparableType(Sema &S, QualType Type, SourceLocation KeyLoc)
static bool isNonPlacementDeallocationFunction(Sema &S, FunctionDecl *FD)
Determine whether the given function is a non-placement deallocation function.
static NamedDecl * getDeclFromExpr(Expr *E)
This file declares semantic analysis for HLSL constructs.
This file provides some common utility functions for processing Lambdas.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis functions specific to PowerPC.
static QualType getPointeeType(const MemRegion *R)
Defines the clang::TokenKind enum and support functions.
Defines the clang::TypeLoc interface and its subclasses.
Defines enumerations for the type traits support.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
MSGuidDecl * getMSGuidDecl(MSGuidDeclParts Parts) const
Return a declaration for the global GUID object representing the given GUID value.
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
unsigned getIntWidth(QualType T) const
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
DeclarationNameTable DeclarationNames
QualType getRecordType(const RecordDecl *Decl) const
QualType getScalableVectorType(QualType EltTy, unsigned NumElts, unsigned NumFields=1) const
Return the unique reference to a scalable vector type of the specified element type and scalable numb...
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' type.
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
const LangOptions & getLangOpts() const
bool hasUniqueObjectRepresentations(QualType Ty, bool CheckIfTriviallyCopyable=true) const
Return true if the specified type has unique object representations according to (C++17 [meta....
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CanQualType BoundMemberTy
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCIdType() const
Represents the Objective-CC id type.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage, bool AcceptDependent)
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
QualType getExceptionObjectType(QualType T) const
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false)
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
QualType getCVRQualifiedType(QualType T, unsigned CVR) const
Return a type with additional const, volatile, or restrict qualifiers.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
const TargetInfo & getTargetInfo() const
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getWideCharType() const
Return the type of wide characters.
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
uint64_t getCharWidth() const
Return the size of the character type, in bits.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
QualType getConstantArrayType(const ASTContext &Ctx) const
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getElementType() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Attr - This represents one attribute.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
A builtin binary operation expression such as "x + y" or "x <= y".
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
This class is used for builtin types like 'int'.
Represents a base class of a C++ class.
Represents binding an expression to a temporary.
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
const Expr * getSubExpr() const
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ base or member initializer.
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
Expr * getInit() const
Get the initializer.
Represents a delete expression for memory deallocation and destructor calls, e.g.
SourceLocation getBeginLoc() const
Represents a C++ destructor within a class.
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc, SourceLocation RPLoc)
Represents a static or instance method of a struct/union/class.
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
QualType getFunctionObjectParameterType() const
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr * > PlacementArgs, SourceRange TypeIdParens, std::optional< Expr * > ArraySize, CXXNewInitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class....
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12)
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class....
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11,...
capture_const_range captures() const
bool isAbstract() const
Determine whether this class has a pure virtual function.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12)
bool hasDefinition() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
bool hasNonTrivialDefaultConstructor() const
Determine whether this class has a non-trivial default constructor (C++11 [class.ctor]p5).
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6,...
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
char * location_data() const
Retrieve the data associated with the source-location information.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
SourceLocation getEndLoc() const
SourceRange getRange() const
bool isSet() const
Deprecated.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Represents a C++ temporary.
void setDestructor(const CXXDestructorDecl *Dtor)
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
Represents the this expression in C++.
static CXXThisExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType Ty, bool IsImplicit)
A C++ throw-expression (C++ [except.throw]).
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, QualType T, TypeSourceInfo *TSI, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool IsListInit)
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
SourceLocation getBeginLoc() const LLVM_READONLY
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Declaration of a class template.
void setExprNeedsCleanups(bool SideEffects)
bool cleanupsHaveSideEffects() const
bool exprNeedsCleanups() const
Complex values, per C99 6.2.5p11.
CompoundStmt - This represents a group of statements like { stmt stmt }.
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt * > Stmts, FPOptionsOverride FPFeatures, SourceLocation LB, SourceLocation RB)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
bool isSatisfied() const
Whether or not the concept with the given arguments was satisfied when the expression was created.
Represents the canonical version of C arrays with a specified constant size.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
Captures information about "declaration specifiers".
Expr * getPackIndexingExpr() const
TST getTypeSpecType() const
SourceLocation getBeginLoc() const LLVM_READONLY
static const TST TST_typename_pack_indexing
ParsedType getRepAsType() const
SourceLocation getEllipsisLoc() const
Expr * getRepAsExpr() const
static const TST TST_decltype
SourceLocation getTypeSpecTypeLoc() const
static const TST TST_decltype_auto
static const TST TST_error
SourceRange getTypeofParensRange() const
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
Kind
Lists the kind of concrete classes of Decl.
bool isInvalidDecl() const
SourceLocation getLocation() const
void setLocalOwningModule(Module *M)
void setImplicit(bool I=true)
DeclContext * getDeclContext()
@ ReachableWhenImported
This declaration has an owning module, and is visible to lookups that occurs within that module.
void setModuleOwnershipKind(ModuleOwnershipKind MOK)
Set whether this declaration is hidden from name lookup.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
The name of a declaration.
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
SourceLocation getBeginLoc() const LLVM_READONLY
Information about one declarator, including the parsed type information and the identifier.
void setRParenLoc(SourceLocation Loc)
void setDecltypeLoc(SourceLocation Loc)
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
Recursive AST visitor that supports extension via dynamic dispatch.
RAII object that enters a new expression evaluation context.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
This represents one expression.
bool isReadIfDiscardedInCPlusPlus11() const
Determine whether an lvalue-to-rvalue conversion should implicitly be applied to this expression if i...
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
bool isOrdinaryOrBitFieldObject() const
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
FullExpr - Represents a "full-expression" node.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
StringLiteral * getDeletedMessage() const
Get the message that indicates why this function was deleted.
QualType getReturnType() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool isDeleted() const
Whether this function has been deleted.
bool isReplaceableGlobalAllocationFunction(std::optional< unsigned > *AlignmentParam=nullptr, bool *IsNothrow=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, Expr *TrailingRequiresClause=nullptr)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
Represents a prototype with parameter type info, e.g.
unsigned getNumParams() const
QualType getParamType(unsigned i) const
bool isVariadic() const
Whether this function prototype is variadic.
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
Declaration of a template function.
ExtInfo withNoReturn(bool noReturn) const
bool getProducesResult() const
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
One of these records is kept for each identifier that is lexed.
ReservedIdentifierStatus isReserved(const LangOptions &LangOpts) const
Determine whether this is a name reserved for the implementation (C99 7.1.3, C++ [lib....
ReservedLiteralSuffixIdStatus isReservedLiteralSuffixId() const
Determine whether this is a name reserved for future standardization or the implementation (C++ [usrl...
StringRef getName() const
Return the actual identifier string.
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
@ StaticObjectArgumentConversion
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
Describes an C or C++ initializer list.
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateDefault(SourceLocation InitLoc)
Create a default initialization.
static InitializationKind CreateDirect(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
Create a direct initialization.
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
static InitializationKind CreateDirectList(SourceLocation InitLoc)
static InitializationKind CreateValue(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool isImplicit=false)
Create a value initialization.
Describes the sequence of initializations required to initialize a given object or reference with a s...
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence.
bool isAmbiguous() const
Determine whether this initialization failed due to an ambiguity.
bool Diagnose(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args)
Diagnose an potentially-invalid initialization sequence.
bool Failed() const
Determine whether the initialization sequence is invalid.
bool isDirectReferenceBinding() const
Determine whether this initialization is a direct reference binding (C++ [dcl.init....
Describes an entity that is being initialized.
static InitializedEntity InitializeException(SourceLocation ThrowLoc, QualType Type)
Create the initialization entity for an exception object.
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type)
Create the initialization entity for an object allocated via new.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
clang::ObjCRuntime ObjCRuntime
bool hasGlobalAllocationFunctionVisibility() const
bool allowsNonTrivialObjCLifetimeQualifiers() const
True if any ObjC types may have non-trivial lifetime qualifiers.
bool hasHiddenGlobalAllocationFunctionVisibility() const
bool hasProtectedGlobalAllocationFunctionVisibility() const
static SourceLocation findLocationAfterToken(SourceLocation loc, tok::TokenKind TKind, const SourceManager &SM, const LangOptions &LangOpts, bool SkipTrailingWhitespaceAndNewLine)
Checks that the given token is the first token that occurs after the given location (this excludes co...
A class for iterating through a result set and possibly filtering out results.
void erase()
Erase the last element returned from this iterator.
Represents the results of name lookup.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
DeclClass * getAsSingle() const
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
void setLookupName(DeclarationName Name)
Sets the name to look up.
bool empty() const
Return true if no decls were found.
SourceLocation getNameLoc() const
Gets the location of the identifier.
Filter makeFilter()
Create a filter for this result set.
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e.
bool isClassLookup() const
Returns whether these results arose from performing a lookup into a class.
void setNamingClass(CXXRecordDecl *Record)
Sets the 'naming class' for this lookup.
LookupResultKind getResultKind() const
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
DeclarationName getLookupName() const
Gets the name to look up.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
const Type * getClass() const
Data structure that captures multiple levels of template argument lists for use in template instantia...
void addOuterRetainedLevels(unsigned Num)
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
ObjCBoxedExpr - used for generalized expression boxing.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Represents an ObjC class declaration.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a pointer to an Objective C object.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
Represents a class type in Objective C.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
bool hasEmptyCollections() const
Are the empty collection symbols available?
static OpaquePtr getFromOpaquePtr(void *P)
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
@ CSK_Normal
Normal lookup.
@ CSK_Operator
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.
SmallVectorImpl< OverloadCandidate >::iterator iterator
void NoteCandidates(PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
When overload resolution fails, prints diagnostic messages containing the candidates in the candidate...
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
SmallVector< OverloadCandidate *, 32 > CompleteCandidates(Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, SourceLocation OpLoc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
Represents a parameter to a function.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
IdentifierTable & getIdentifierTable()
const LangOptions & getLangOpts() const
Stores the type being destroyed by a pseudo-destructor expression.
TypeSourceInfo * getTypeSourceInfo() const
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
QualType withConst() const
void addConst()
Add the const type qualifier to this QualType.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isWebAssemblyReferenceType() const
Returns true if it is a WebAssembly Reference Type.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool hasNonTrivialObjCLifetime() const
bool isAtLeastAsQualifiedAs(QualType Other, const ASTContext &Ctx) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
The collection of all-type qualifiers we support.
void removeCVRQualifiers(unsigned mask)
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
bool hasCVRQualifiers() const
bool hasUnaligned() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
void setAddressSpace(LangAS space)
unsigned getCVRUQualifiers() const
void setObjCGCAttr(GC type)
ObjCLifetime getObjCLifetime() const
static Qualifiers fromCVRUMask(unsigned CVRU)
LangAS getAddressSpace() const
void setObjCLifetime(ObjCLifetime type)
Represents a struct/union/class.
bool canPassInRegisters() const
Determine whether this class can be passed in registers.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
Scope - A scope is a transient data structure that is used while parsing the program.
@ BlockScope
This is a scope that corresponds to a block/closure object.
@ ClassScope
The scope of a struct/union/class definition.
@ TryScope
This is the scope of a C++ try statement.
@ FnScope
This indicates that the scope corresponds to a function, which means that labels are set here.
@ ObjCMethodScope
This scope corresponds to an Objective-C method body.
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
void EraseUnwantedMatches(const FunctionDecl *Caller, llvm::SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl * > > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
CUDAFunctionPreference IdentifyPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc)
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Sema - This implements semantic analysis and AST building for C.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
QualType CheckSizelessVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
Scope * getCurScope() const
Retrieve the parser's current scope.
QualType CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
bool checkArrayElementAlignment(QualType EltTy, SourceLocation Loc)
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupDestructorName
Look up a name following ~ in a destructor name.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
@ LookupAnyName
Look up any declaration with any name.
void DiagnoseSentinelCalls(const NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
bool BuildTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc, bool AllowUnexpandedPack)
bool CheckCXXThisType(SourceLocation Loc, QualType Type)
Check whether the type of 'this' is valid in the current context.
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, const IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
IfExistsResult
Describes the result of an "if-exists" condition check.
@ IER_DoesNotExist
The symbol does not exist.
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ IER_Error
An error occurred.
@ IER_Exists
The symbol exists.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, QualType DeclInitType, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
void MarkCaptureUsedInEnclosingContext(ValueDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion, bool AllowBoolOperation, bool ReportInvalid)
type checking for vector binary operators.
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
FPOptionsOverride CurFPFeatureOverrides()
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
concepts::Requirement::SubstitutionDiagnostic * createSubstDiagAt(SourceLocation Location, EntityPrinter Printer)
create a Requirement::SubstitutionDiagnostic with only a SubstitutedEntity and DiagLoc using ASTConte...
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
ExprResult CheckUnevaluatedOperand(Expr *E)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions={}, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false, bool HasMatchedPackOnParmToNonPackOnArg=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
DiagnosticsEngine & getDiagnostics() const
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
void CleanupVarDeclMarking()
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ASTContext & getASTContext() const
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
bool DiagnoseUnexpandedParameterPackInRequiresExpr(RequiresExpr *RE)
If the given requirees-expression contains an unexpanded reference to one of its own parameter packs,...
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
bool tryCaptureVariable(ValueDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace.
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool CheckArgsForPlaceholders(MultiExprArg args)
Check an argument list for placeholders that we won't try to handle later.
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, const SourceRange &, DeclAccessPair FoundDecl)
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
void ActOnFinishRequiresExpr()
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
void DiagnoseUseOfDeletedFunction(SourceLocation Loc, SourceRange Range, DeclarationName Name, OverloadCandidateSet &CandidateSet, FunctionDecl *Fn, MultiExprArg Args, bool IsMember=false)
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
EnumDecl * getStdAlignValT() const
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
NamedReturnInfo getNamedReturnInfo(Expr *&E, SimplerImplicitMoveMode Mode=SimplerImplicitMoveMode::Normal)
Determine whether the given expression might be move-eligible or copy-elidable in either a (co_)retur...
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id, bool IsUDSuffix)
void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
FPOptions & getCurFPFeatures()
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
@ UPPC_IfExists
Microsoft __if_exists.
@ UPPC_IfNotExists
Microsoft __if_not_exists.
const LangOptions & getLangOpts() const
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, QualType ObjectType, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, const MultiLevelTemplateArgumentList &TemplateArgLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
const LangOptions & LangOpts
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
CXXRecordDecl * getStdBadAlloc() const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
CXXRecordDecl * getCurrentClass(Scope *S, const CXXScopeSpec *SS)
Get the class that is directly named by the current context.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
QualType CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, ArithConvKind OperationKind)
llvm::DenseMap< const VarDecl *, int > RefsMinusAssignments
Increment when we find a reference; decrement when we find an ignored assignment.
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
void MarkThisReferenced(CXXThisExpr *This)
ExprResult DefaultLvalueConversion(Expr *E)
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
bool isInLifetimeExtendingContext() const
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
static bool isCast(CheckedConversionKind CCK)
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true, bool WantSize=false, bool WantAligned=false)
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
bool DiagnoseConditionalForNull(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const
If AllowLambda is true, treat lambda as function.
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
@ Compatible
Compatible - the types are compatible according to the standard.
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
Parsed a C++ 'new' expression (C++ 5.3.4).
@ ACK_Conditional
A conditional (?:) operator.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared.
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
ExprResult TransformToPotentiallyEvaluated(Expr *E)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
SourceManager & getSourceManager() const
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
ExprResult FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value, bool SupressSimplerImplicitMoves=false)
Perform the initialization of a potentially-movable value, which is the result of return value.
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
CanThrowResult canThrow(const Stmt *E)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, const ImplicitConversionSequence &ICS, AssignmentAction Action, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType ...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, const IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, const IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc, ImplicitTypenameContext IsImplicitTypename=ImplicitTypenameContext::No)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
void AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FunctionDecl *FD)
If this function is a C++ replaceable global allocation function (C++2a [basic.stc....
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Delete-expressions to be analyzed at the end of translation unit.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
void DiscardCleanupsInEvaluationContext()
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
DiagnosticsEngine & Diags
NamespaceDecl * getStdNamespace() const
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, ArrayRef< TemplateArgument > TemplateArgs, sema::TemplateDeductionInfo &Info)
QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc)
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD=nullptr)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ParsedType getConstructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
TemplateDeductionResult DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result, sema::TemplateDeductionInfo &Info, bool DependentDeduction=false, bool IgnoreConstraints=false, TemplateSpecCandidateSet *FailedTSC=nullptr)
Deduce the type for an auto type-specifier (C++11 [dcl.spec.auto]p6)
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
static ConditionResult ConditionError()
IdentifierResolver IdResolver
const TypoExprState & getTypoExprState(TypoExpr *TE) const
FullExprArg MakeFullExpr(Expr *Arg)
ExprResult ActOnCXXThis(SourceLocation Loc)
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
AllocationFunctionScope
The scope in which to find allocation functions.
@ AFS_Both
Look for allocation functions in both the global scope and in the scope of the allocated class.
@ AFS_Class
Only look for allocation functions in the scope of the allocated class.
@ AFS_Global
Only look for allocation functions in the global scope.
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr, bool SkipImmediateInvocations=true)
Instantiate or parse a C++ default argument expression as necessary.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, const Expr *ThisArg, ArrayRef< const Expr * > Args, bool IsMemberFunction, SourceLocation Loc, SourceRange Range, VariadicCallType CallType)
Handles the checks for format strings, non-POD arguments to vararg functions, NULL arguments passed t...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
DeclAccessPair FoundCopyConstructor
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion,...
ImplicitConversionKind First
First â The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion,...
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
ImplicitConversionKind Dimension
Dimension - Between the second and third conversion a vector or matrix dimension conversion may occur...
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
StringRef getString() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
bool isItaniumFamily() const
Does this ABI generally fall into the Itanium family of ABIs?
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with '::operator new(size_t)' is g...
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target,...
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
A template argument list.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Represents a template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Type
The template argument is a type.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
A semantic tree transformation that allows one to transform one abstract syntax tree into another.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Represents a declaration of a type.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
void pushTrivial(ASTContext &Context, QualType T, SourceLocation Loc)
Pushes 'T' with all locations pointing to 'Loc'.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
The base class of the type hierarchy.
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
bool isStructureType() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isIncompleteArrayType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
bool isRValueReferenceType() const
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
bool isVoidPointerType() const
bool isArithmeticType() const
bool isPointerType() const
bool isArrayParameterType() const
CanQualType getCanonicalTypeUnqualified() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isHLSLIntangibleType() const
bool isEnumeralType() const
bool isScalarType() const
bool isInterfaceType() const
bool isVariableArrayType() const
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isExtVectorType() const
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
bool isMemberDataPointerType() const
bool isLValueReferenceType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type.
bool isAnyComplexType() const
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
bool isWebAssemblyTableType() const
Returns true if this is a WebAssembly table type: either an array of reference types,...
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isMemberPointerType() const
bool isAtomicType() const
bool isMatrixType() const
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isObjectType() const
Determine whether this type is an object type.
bool isPointerOrReferenceType() const
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool isStructureOrClassType() const
bool isMemberFunctionPointerType() const
bool isVectorType() const
bool isRealFloatingType() const
Floating point categories.
bool isFloatingType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isAnyPointerType() const
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool isNullPtrType() const
bool isRecordType() const
bool isObjCRetainableType() const
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
bool isScopedEnumeralType() const
Determine whether this type is a scoped enumeration type.
Simple class containing the result of Sema::CorrectTypo.
SourceRange getCorrectionRange() const
void WillReplaceSpecifier(bool ForceReplacement)
unsigned getEditDistance(bool Normalized=true) const
Gets the "edit distance" of the typo correction from the typo.
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
void setCorrectionDecl(NamedDecl *CDecl)
Clears the list of NamedDecls before adding the new one.
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represents a C++ unqualified-id that has been parsed.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
const IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId,...
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
The iterator over UnresolvedSets.
A set of unresolved declarations.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
VarDecl * getPotentiallyDecomposedVarDecl()
Represents a variable declaration or definition.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isUsableInConstantExpressions(const ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to.
Represents a GCC generic vector type.
bool isTypeConstraint() const
TemplateParameterList * getTypeConstraintTemplateParameterList() const
bool isSubstitutionFailure() const
A requires-expression requirement which queries the validity and properties of an expression ('simple...
@ SS_ConstraintsNotSatisfied
@ SS_TypeRequirementSubstitutionFailure
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
ImplicitCaptureStyle ImpCaptureStyle
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
void addThisCapture(bool isNested, SourceLocation Loc, QualType CaptureType, bool ByCopy)
SourceLocation PotentialThisCaptureLocation
bool hasPotentialThisCapture() const
SourceRange IntroducerRange
Source range covering the lambda introducer [...].
bool lambdaCaptureShouldBeConst() const
void clearPotentialCaptures()
bool hasPotentialCaptures() const
bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const
CXXRecordDecl * Lambda
The class that describes the lambda.
void visitPotentialCaptures(llvm::function_ref< void(ValueDecl *, Expr *)> Callback) const
unsigned NumExplicitCaptures
The number of captures in the Captures list that are explicit captures.
bool AfterParameterList
Indicate that we parsed the parameter list at which point the mutability of the lambda is known.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
Provides information about an attempted template argument deduction, whose success or failure was des...
Defines the clang::TargetInfo interface.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
bool NE(InterpState &S, CodePtr OpPC)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
bool isLambdaCallWithImplicitObjectParameter(const DeclContext *DC)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
ArrayTypeTrait
Names for the array type traits.
unsigned getTypeTraitArity(TypeTrait T) LLVM_READONLY
Return the arity of the type trait T.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ OR_Deleted
Succeeded, but refers to a deleted function.
@ OR_Success
Overload resolution succeeded.
@ OR_Ambiguous
Ambiguous candidates found.
@ OR_No_Viable_Function
No viable function found.
CanThrowResult
Possible results from evaluation of a noexcept expression.
DeclContext * getLambdaAwareParentOfDeclContext(DeclContext *DC)
std::optional< unsigned > getStackIndexOfNearestEnclosingCaptureCapableLambda(ArrayRef< const sema::FunctionScopeInfo * > FunctionScopes, ValueDecl *VarToCapture, Sema &S)
Examines the FunctionScopeInfo stack to determine the nearest enclosing lambda (to the current lambda...
bool isReservedInAllContexts(ReservedIdentifierStatus Status)
Determine whether an identifier is reserved in all contexts.
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
@ OCD_AmbiguousCandidates
Requests that only tied-for-best candidates be shown.
@ OCD_AllCandidates
Requests that all candidates be shown.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ OK_BitField
A bitfield object is a bitfield on a C or C++ record.
@ LCK_StarThis
Capturing the *this object by copy.
@ Bind
'bind' clause, allowed on routine constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ IK_TemplateId
A template-id, e.g., f<int>.
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
@ IK_Identifier
An identifier.
bool isLambdaCallWithExplicitObjectParameter(const DeclContext *DC)
bool isLambdaCallOperator(const CXXMethodDecl *MD)
@ Result
The result type of a method or function.
@ ICK_Complex_Conversion
Complex conversions (C99 6.3.1.6)
@ ICK_Floating_Promotion
Floating point promotions (C++ [conv.fpprom])
@ ICK_Boolean_Conversion
Boolean conversions (C++ [conv.bool])
@ ICK_Integral_Conversion
Integral conversions (C++ [conv.integral])
@ ICK_Fixed_Point_Conversion
Fixed point type conversions according to N1169.
@ ICK_Vector_Conversion
Vector conversions.
@ ICK_Block_Pointer_Conversion
Block Pointer conversions.
@ ICK_Pointer_Member
Pointer-to-member conversions (C++ [conv.mem])
@ ICK_Floating_Integral
Floating-integral conversions (C++ [conv.fpint])
@ ICK_HLSL_Array_RValue
HLSL non-decaying array rvalue cast.
@ ICK_SVE_Vector_Conversion
Arm SVE Vector conversions.
@ ICK_HLSL_Vector_Truncation
HLSL vector truncation.
@ ICK_Incompatible_Pointer_Conversion
C-only conversion between pointers with incompatible types.
@ ICK_Array_To_Pointer
Array-to-pointer conversion (C++ [conv.array])
@ ICK_RVV_Vector_Conversion
RISC-V RVV Vector conversions.
@ ICK_Complex_Promotion
Complex promotions (Clang extension)
@ ICK_Num_Conversion_Kinds
The number of conversion kinds.
@ ICK_Function_Conversion
Function pointer conversion (C++17 [conv.fctptr])
@ ICK_Vector_Splat
A vector splat from an arithmetic type.
@ ICK_Zero_Queue_Conversion
Zero constant to queue.
@ ICK_Identity
Identity conversion (no conversion)
@ ICK_Derived_To_Base
Derived-to-base (C++ [over.best.ics])
@ ICK_Lvalue_To_Rvalue
Lvalue-to-rvalue conversion (C++ [conv.lval])
@ ICK_Qualification
Qualification conversions (C++ [conv.qual])
@ ICK_Pointer_Conversion
Pointer conversions (C++ [conv.ptr])
@ ICK_TransparentUnionConversion
Transparent Union Conversions.
@ ICK_Integral_Promotion
Integral promotions (C++ [conv.prom])
@ ICK_Floating_Conversion
Floating point conversions (C++ [conv.double].
@ ICK_Compatible_Conversion
Conversions between compatible types in C99.
@ ICK_C_Only_Conversion
Conversions allowed in C, but not C++.
@ ICK_Writeback_Conversion
Objective-C ARC writeback conversion.
@ ICK_Zero_Event_Conversion
Zero constant to event (OpenCL1.2 6.12.10)
@ ICK_Complex_Real
Complex-real conversions (C99 6.3.1.7)
@ ICK_Function_To_Pointer
Function-to-pointer (C++ [conv.array])
llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS)
@ NotStartsWithUnderscore
ActionResult< Expr * > ExprResult
@ Class
The "class" keyword.
LangAS
Defines the address space values used by the address space qualifier of QualType.
CastKind
CastKind - The kind of operation required for a conversion.
bool isPtrSizeAddressSpace(LangAS AS)
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
const FunctionProtoType * T
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
TemplateDeductionResult
Describes the result of template argument deduction.
@ Success
Template argument deduction was successful.
@ AlreadyDiagnosed
Some error which was already diagnosed.
@ Generic
not a target-specific vector type
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
@ Other
Other implicit parameter.
TypeTrait
Names for traits that operate specifically on types.
CXXNewInitializationStyle
@ Parens
New-expression has a C++98 paren-delimited initializer.
@ None
New-expression has no initializer as written.
@ Braces
New-expression has a C++11 list-initializer.
@ EST_DynamicNone
throw()
@ EST_BasicNoexcept
noexcept
@ EST_Dynamic
throw(T1, T2)
CheckedConversionKind
The kind of conversion being performed.
@ CStyleCast
A C-style cast.
@ ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
@ FunctionalCast
A functional-style cast.
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
MutableArrayRef< Expr * > MultiExprArg
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static ASTConstraintSatisfaction * Rebuild(const ASTContext &C, const ASTConstraintSatisfaction &Satisfaction)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
unsigned hasStatic
True if this dimension included the 'static' keyword.
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
One instance of this struct is used for each type in a declarator that is parsed.
SourceLocation Loc
Loc - The place where this type was defined.
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionType::ExtInfo ExtInfo
Parts of a decomposed MSGuidDecl.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
Information about a template-id annotation token.
const IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion.
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ....
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4