13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
48#include "llvm/ADT/ArrayRef.h"
49#include "llvm/Support/ErrorHandling.h"
53using namespace llvm::omp;
109template<
typename Derived>
114 class ForgetPartiallySubstitutedPackRAII {
122 ForgetPartiallySubstitutedPackRAII(Derived &Self)
123 : Self(Self), ResetPackSubstIndex(Self.getSema(), -1) {
124 Old = Self.ForgetPartiallySubstitutedPack();
127 ~ForgetPartiallySubstitutedPackRAII() {
128 Self.RememberPartiallySubstitutedPack(Old);
145 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
149 return static_cast<const Derived&
>(*this);
214 OldLocation = Self.getDerived().getBaseLocation();
215 OldEntity = Self.getDerived().getBaseEntity();
218 Self.getDerived().setBase(Location, Entity);
222 Self.getDerived().setBase(OldLocation, OldEntity);
252 return E->isDefaultArgument();
295 bool &ShouldExpand,
bool &RetainExpansion,
296 std::optional<unsigned> &NumExpansions) {
297 ShouldExpand =
false;
412 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
413#include "clang/Basic/AttrList.inc"
423 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
424 const X##Attr *A) { \
425 return getDerived().Transform##X##Attr(A); \
427#include "clang/Basic/AttrList.inc"
473 bool *ArgChanged =
nullptr);
482 llvm::DenseMap<Decl *, Decl *>::iterator Known
485 return Known->second;
513 assert(New.size() == 1 &&
514 "must override transformedLocalDecl if performing pack expansion");
552 NamedDecl *FirstQualifierInScope =
nullptr);
597 NamedDecl *FirstQualifierInScope =
nullptr,
598 bool AllowInjectedClassName =
false);
610 bool Uneval =
false);
633 bool Uneval =
false) {
652 template<
typename InputIterator>
656 bool Uneval =
false);
668#define ABSTRACT_TYPELOC(CLASS, PARENT)
669#define TYPELOC(CLASS, PARENT) \
670 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
671#include "clang/AST/TypeLocNodes.def"
675 bool SuppressObjCLifetime);
679 bool SuppressObjCLifetime);
681 template<
typename Fn>
734 return getDerived().TransformFunctionTypeParams(
735 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
753 KWLoc, Params,
nullptr,
754 nullptr, PTypes, &TransParams, PInfos))
767 std::optional<unsigned> NumExpansions,
768 bool ExpectParameterPack);
795 bool IsAddressOfOperand,
803 bool IsAddressOfOperand);
811#define STMT(Node, Parent) \
812 LLVM_ATTRIBUTE_NOINLINE \
813 StmtResult Transform##Node(Node *S);
814#define VALUESTMT(Node, Parent) \
815 LLVM_ATTRIBUTE_NOINLINE \
816 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
817#define EXPR(Node, Parent) \
818 LLVM_ATTRIBUTE_NOINLINE \
819 ExprResult Transform##Node(Node *E);
820#define ABSTRACT_STMT(Stmt)
821#include "clang/AST/StmtNodes.inc"
823#define GEN_CLANG_CLAUSE_CLASS
824#define CLAUSE_CLASS(Enum, Str, Class) \
825 LLVM_ATTRIBUTE_NOINLINE \
826 OMPClause *Transform##Class(Class *S);
827#include "llvm/Frontend/OpenMP/OMP.inc"
904 const llvm::APInt *Size,
Expr *SizeExpr,
905 unsigned IndexTypeQuals,
SourceRange BracketsRange);
914 const llvm::APInt &Size,
Expr *SizeExpr,
915 unsigned IndexTypeQuals,
925 unsigned IndexTypeQuals,
935 unsigned IndexTypeQuals,
946 unsigned IndexTypeQuals,
984 unsigned NumColumns);
1001 Expr *AddrSpaceExpr,
1071 bool FullySubstituted,
1085 TypeConstraintConcept,
1086 TypeConstraintArgs);
1094 Template, Deduced,
false);
1140 bool AllowInjectedClassName) {
1144 SS.
Adopt(QualifierLoc);
1146 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1147 AllowInjectedClassName);
1161 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1178 bool DeducedTSTContext) {
1180 SS.
Adopt(QualifierLoc);
1193 *
Id, IdLoc, DeducedTSTContext);
1211 switch (
Result.getResultKind()) {
1222 llvm_unreachable(
"Tag lookup cannot find non-tags");
1234 switch (
Result.getResultKind()) {
1240 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1241 << SomeDecl << NTK << llvm::to_underlying(Kind);
1247 << llvm::to_underlying(Kind) <<
Id << DC
1256 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1257 SemaRef.
Diag(Tag->getLocation(), diag::note_previous_use);
1274 std::optional<unsigned> NumExpansions) {
1319 bool AllowInjectedClassName);
1332 bool AllowInjectedClassName);
1342 Decl *AssociatedDecl,
unsigned Index,
1345 ArgPack, AssociatedDecl, Index, Final);
1423 Then, ElseLoc, Else);
1477 Inc, RParenLoc, Body);
1522 bool IsVolatile,
unsigned NumOutputs,
1529 NumInputs, Names, Constraints, Exprs,
1530 AsmString, Clobbers, NumLabels, RParenLoc);
1539 StringRef AsmString,
1540 unsigned NumOutputs,
unsigned NumInputs,
1546 NumOutputs, NumInputs,
1547 Constraints, Clobbers, Exprs, EndLoc);
1576 CoawaitLoc, Operand, OpCoawaitLookup);
1580 Suspend.
get(),
true);
1681 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1693 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1707 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1818 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1831 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1844 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1895 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1922 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1923 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1937 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1938 ReductionId, UnresolvedReductions);
1953 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1954 ReductionId, UnresolvedReductions);
1967 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1968 StepModifierLoc, EndLoc);
1981 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2041 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2054 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2069 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2070 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2071 ColonLoc, VarList, Locs,
2072 false, UnresolvedMappers);
2089 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2090 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2138 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2151 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2186 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2201 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2202 ColonLoc, VarList, Locs, UnresolvedMappers);
2217 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2218 ColonLoc, VarList, Locs, UnresolvedMappers);
2269 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2316 StartLoc, LParenLoc, EndLoc,
Data);
2329 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2341 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2354 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2365 LParenLoc, VarLoc, EndLoc);
2377 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2516 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2564 ForLoc, Element, Collection, RParenLoc);
2582 StartLoc, IdLoc,
Id);
2620 if (RangeStmt->isSingleDecl()) {
2621 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2622 if (RangeVar->isInvalidDecl())
2625 Expr *RangeExpr = RangeVar->getInit();
2632 diag::err_objc_for_range_init_stmt)
2633 <<
Init->getSourceRange();
2636 ForLoc, LoopVar, RangeExpr, RParenLoc);
2643 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2657 QualifierLoc, NameInfo, Nested);
2719 SS.
Adopt(QualifierLoc);
2831 if (IsOMPArraySection)
2833 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2834 Stride, RBracketLoc);
2836 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2837 "Stride/second colon not allowed for OpenACC");
2840 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2852 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2864 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2874 Expr *ExecConfig =
nullptr) {
2876 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2883 nullptr, Callee, LParenLoc, Args, RParenLoc);
2901 if (!
Member->getDeclName()) {
2905 assert(
Member->getType()->isRecordType() &&
2906 "unnamed member not of record type?");
2919 if (!isArrow &&
Base->isPRValue()) {
2928 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2934 SS.
Adopt(QualifierLoc);
2937 if (
Base->containsErrors())
2951 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2952 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2953 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2956 ->getAsCXXRecordDecl()) {
2957 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2960 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2968 FirstQualifierInScope,
2969 R, ExplicitTemplateArgs,
3147 Expr *ControllingExpr,
3152 ControllingExpr, Types, Exprs);
3167 ControllingType, Types, Exprs);
3200 case Stmt::CXXStaticCastExprClass:
3201 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3202 RAngleLoc, LParenLoc,
3203 SubExpr, RParenLoc);
3205 case Stmt::CXXDynamicCastExprClass:
3206 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3207 RAngleLoc, LParenLoc,
3208 SubExpr, RParenLoc);
3210 case Stmt::CXXReinterpretCastExprClass:
3211 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3212 RAngleLoc, LParenLoc,
3216 case Stmt::CXXConstCastExprClass:
3217 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3218 RAngleLoc, LParenLoc,
3219 SubExpr, RParenLoc);
3221 case Stmt::CXXAddrspaceCastExprClass:
3222 return getDerived().RebuildCXXAddrspaceCastExpr(
3223 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3226 llvm_unreachable(
"Invalid C++ named cast");
3304 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3316 bool ListInitialization) {
3320 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3322 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3323 RParenLoc, ListInitialization);
3326 ListInitialization);
3390 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3400 bool IsThrownVariableInScope) {
3410 Expr *RewrittenExpr) {
3412 RewrittenExpr,
getSema().CurContext);
3446 std::optional<Expr *> ArraySize,
3465 bool IsGlobalDelete,
3516 bool IsAddressOfOperand,
3519 SS.
Adopt(QualifierLoc);
3521 if (TemplateArgs || TemplateKWLoc.
isValid())
3523 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3526 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3548 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3549 bool ListInitialization,
bool StdInitListInitialization,
3555 if (Constructor->isInheritingConstructor())
3556 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3559 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3566 HadMultipleCandidates,
3568 StdInitListInitialization,
3569 RequiresZeroInit, ConstructKind,
3577 bool ConstructsVBase,
3578 bool InheritedFromVBase) {
3580 Loc,
T, Constructor, ConstructsVBase, InheritedFromVBase);
3591 bool ListInitialization) {
3593 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3604 bool ListInitialization) {
3606 RParenLoc, ListInitialization);
3623 SS.
Adopt(QualifierLoc);
3626 OperatorLoc, IsArrow,
3628 FirstQualifierInScope,
3630 TemplateArgs,
nullptr);
3646 SS.
Adopt(QualifierLoc);
3649 OperatorLoc, IsArrow,
3651 FirstQualifierInScope,
3652 R, TemplateArgs,
nullptr);
3667 std::optional<unsigned> Length,
3670 RParenLoc, Length, PartialArgs);
3675 Expr *PackIdExpression,
Expr *IndexExpr,
3677 bool FullySubstituted =
false) {
3679 IndexExpr, RSquareLoc, ExpandedExprs,
3716 NamedConcept, TALI);
3734 LocalParameters, RParenLoc, Requirements,
3788 Expr **Elements,
unsigned NumElements) {
3798 RB,
Base, Key, getterMethod, setterMethod);
3830 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3845 Sel, Method, LBracLoc,
3846 SelectorLocs, RBracLoc, Args);
3860 nullptr, SuperType, SuperLoc, Sel, Method, LBracLoc,
3861 SelectorLocs, RBracLoc, Args)
3863 Sel, Method, LBracLoc,
3864 SelectorLocs, RBracLoc, Args);
3873 bool IsArrow,
bool IsFreeIvar) {
3882 if (IsFreeIvar &&
Result.isUsable())
3883 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3919 PropertyLoc,
Base));
3951 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3960 CK_BuiltinFnToFnPtr).
get();
3986 std::optional<unsigned> NumExpansions) {
3991 EllipsisLoc, NumExpansions);
4013 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4034 std::optional<unsigned> NumExpansions) {
4047 std::optional<unsigned> NumExpansions) {
4049 EllipsisLoc, RHS, RParenLoc,
4058 Init->containsUnexpandedParameterPack();
4059 else if (PVD->hasUninstantiatedDefaultArg())
4061 PVD->getUninstantiatedDefaultArg()
4062 ->containsUnexpandedParameterPack();
4207 Exprs.push_back(DevNumExpr);
4208 Exprs.insert(Exprs.end(), QueueIdExprs.begin(), QueueIdExprs.end());
4211 Exprs, RParenLoc, EndLoc, Clauses, {});
4235 bool DeducibleTSTContext);
4247template <
typename Derived>
4252 switch (S->getStmtClass()) {
4257#define STMT(Node, Parent) \
4258 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4259#define VALUESTMT(Node, Parent) \
4260 case Stmt::Node##Class: \
4261 return getDerived().Transform##Node(cast<Node>(S), SDK);
4262#define ABSTRACT_STMT(Node)
4263#define EXPR(Node, Parent)
4264#include "clang/AST/StmtNodes.inc"
4267#define STMT(Node, Parent)
4268#define ABSTRACT_STMT(Stmt)
4269#define EXPR(Node, Parent) case Stmt::Node##Class:
4270#include "clang/AST/StmtNodes.inc"
4272 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4274 if (SDK == SDK_StmtExprResult)
4275 E = getSema().ActOnStmtExprResult(
E);
4276 return getSema().ActOnExprStmt(
E, SDK == SDK_Discarded);
4283template<
typename Derived>
4288 switch (S->getClauseKind()) {
4291#define GEN_CLANG_CLAUSE_CLASS
4292#define CLAUSE_CLASS(Enum, Str, Class) \
4294 return getDerived().Transform##Class(cast<Class>(S));
4295#include "llvm/Frontend/OpenMP/OMP.inc"
4302template<
typename Derived>
4309#define STMT(Node, Parent) case Stmt::Node##Class: break;
4310#define ABSTRACT_STMT(Stmt)
4311#define EXPR(Node, Parent) \
4312 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4313#include "clang/AST/StmtNodes.inc"
4319template<
typename Derived>
4327 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4328 Init = FE->getSubExpr();
4330 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4336 Init = MTE->getSubExpr();
4339 Init = Binder->getSubExpr();
4342 Init = ICE->getSubExprAsWritten();
4345 dyn_cast<CXXStdInitializerListExpr>(
Init))
4346 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4353 return getDerived().TransformExpr(
Init);
4358 return getDerived().RebuildParenListExpr(
Parens.getBegin(), {},
4363 if (isa<ImplicitValueInitExpr>(
Init))
4369 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4370 return getDerived().TransformExpr(
Init);
4375 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4382 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4383 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4384 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4385 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4387 bool ArgChanged =
false;
4389 true, NewArgs, &ArgChanged))
4394 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4399 if (
Parens.isInvalid()) {
4402 assert(NewArgs.empty() &&
4403 "no parens or braces but have direct init with arguments?");
4406 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4410template<
typename Derived>
4416 for (
unsigned I = 0; I != NumInputs; ++I) {
4418 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4426 Expr *Pattern = Expansion->getPattern();
4429 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4430 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4435 bool RetainExpansion =
false;
4436 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4437 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4438 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4441 Expand, RetainExpansion,
4450 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4454 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4455 Expansion->getEllipsisLoc(),
4457 if (Out.isInvalid())
4462 Outputs.push_back(Out.get());
4468 if (ArgChanged) *ArgChanged =
true;
4472 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4474 ExprResult Out = getDerived().TransformExpr(Pattern);
4475 if (Out.isInvalid())
4478 if (Out.get()->containsUnexpandedParameterPack()) {
4479 Out = getDerived().RebuildPackExpansion(
4480 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4481 if (Out.isInvalid())
4485 Outputs.push_back(Out.get());
4490 if (RetainExpansion) {
4491 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4493 ExprResult Out = getDerived().TransformExpr(Pattern);
4494 if (Out.isInvalid())
4497 Out = getDerived().RebuildPackExpansion(
4498 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4499 if (Out.isInvalid())
4502 Outputs.push_back(Out.get());
4509 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4510 : getDerived().TransformExpr(Inputs[I]);
4514 if (
Result.get() != Inputs[I] && ArgChanged)
4517 Outputs.push_back(
Result.get());
4523template <
typename Derived>
4527 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4528 getDerived().TransformDefinition(Var->
getLocation(), Var));
4533 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4542 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4549template <
typename Derived>
4557 Qualifier = Qualifier.getPrefix())
4573 SS, FirstQualifierInScope,
false))
4580 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4588 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4603 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4612 FirstQualifierInScope, SS);
4622 diag::warn_cxx98_compat_enum_nested_name_spec);
4625 SS.
Adopt(ETL.getQualifierLoc());
4626 TL = ETL.getNamedTypeLoc();
4645 FirstQualifierInScope =
nullptr;
4651 !getDerived().AlwaysRebuild())
4664template<
typename Derived>
4672 switch (Name.getNameKind()) {
4683 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4684 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4685 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4701 NewTInfo = getDerived().TransformType(OldTInfo);
4709 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4725 llvm_unreachable(
"Unknown name kind.");
4728template<
typename Derived>
4735 bool AllowInjectedClassName) {
4737 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4738 assert(Template &&
"qualified template name must refer to a template");
4741 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4746 if (!getDerived().AlwaysRebuild() &&
4748 TransTemplate == Template)
4751 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4759 FirstQualifierInScope =
nullptr;
4762 if (!getDerived().AlwaysRebuild() &&
4770 if (DTN->isIdentifier()) {
4771 return getDerived().RebuildTemplateName(SS,
4773 *DTN->getIdentifier(),
4776 FirstQualifierInScope,
4777 AllowInjectedClassName);
4780 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4781 DTN->getOperator(), NameLoc,
4782 ObjectType, AllowInjectedClassName);
4786 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4788 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4793 return getDerived().RebuildTemplateName(SS,
false,
4798 = Name.getAsSubstTemplateTemplateParmPack()) {
4799 return getDerived().RebuildTemplateName(
4800 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4801 SubstPack->getIndex(), SubstPack->getFinal());
4805 llvm_unreachable(
"overloaded function decl survived to here");
4808template<
typename Derived>
4812 Output = getSema().getTrivialTemplateArgumentLoc(
4813 Arg,
QualType(), getDerived().getBaseLocation());
4816template <
typename Derived>
4824 llvm_unreachable(
"Unexpected TemplateArgument");
4834 QualType NewT = getDerived().TransformType(
T);
4841 ValueDecl *NewD =
D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4842 getDerived().getBaseLocation(),
D))
4847 if (NewT ==
T &&
D == NewD)
4864 llvm_unreachable(
"unexpected template argument kind");
4874 DI = getDerived().TransformType(DI);
4885 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4891 SS.
Adopt(QualifierLoc);
4892 TemplateName Template = getDerived().TransformTemplateName(
4903 llvm_unreachable(
"Caller should expand pack expansions");
4918 ExprResult E = getDerived().TransformExpr(InputExpr);
4933template<
typename Derived,
typename InputIterator>
4941 typedef typename std::iterator_traits<InputIterator>::difference_type
4971 Self.InventTemplateArgumentLoc(*
Iter,
Result);
4979 return X.Iter == Y.Iter;
4984 return X.Iter != Y.Iter;
4988template<
typename Derived>
4989template<
typename InputIterator>
5006 if (TransformTemplateArguments(PackLocIterator(*
this,
5007 In.getArgument().pack_begin()),
5008 PackLocIterator(*
this,
5009 In.getArgument().pack_end()),
5016 if (In.getArgument().isPackExpansion()) {
5020 std::optional<unsigned> OrigNumExpansions;
5022 = getSema().getTemplateArgumentPackExpansionPattern(
5023 In, Ellipsis, OrigNumExpansions);
5026 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5027 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5032 bool RetainExpansion =
false;
5033 std::optional<unsigned> NumExpansions = OrigNumExpansions;
5034 if (getDerived().TryExpandParameterPacks(Ellipsis,
5048 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
5051 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
5053 if (Out.getArgument().isNull())
5062 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5065 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
5068 if (Out.getArgument().containsUnexpandedParameterPack()) {
5069 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
5071 if (Out.getArgument().isNull())
5080 if (RetainExpansion) {
5081 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5083 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
5086 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
5088 if (Out.getArgument().isNull())
5098 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
5112template<
typename Derived>
5114 if (getDerived().AlreadyTransformed(
T))
5120 getDerived().getBaseLocation());
5130template<
typename Derived>
5134 getDerived().getBaseEntity());
5135 if (getDerived().AlreadyTransformed(DI->
getType()))
5150template<
typename Derived>
5153 switch (
T.getTypeLocClass()) {
5154#define ABSTRACT_TYPELOC(CLASS, PARENT)
5155#define TYPELOC(CLASS, PARENT) \
5156 case TypeLoc::CLASS: \
5157 return getDerived().Transform##CLASS##Type(TLB, \
5158 T.castAs<CLASS##TypeLoc>());
5159#include "clang/AST/TypeLocNodes.def"
5162 llvm_unreachable(
"unhandled type loc!");
5165template<
typename Derived>
5167 if (!isa<DependentNameType>(
T))
5168 return TransformType(
T);
5170 if (getDerived().AlreadyTransformed(
T))
5173 getDerived().getBaseLocation());
5174 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5178template<
typename Derived>
5181 if (!isa<DependentNameType>(DI->
getType()))
5182 return TransformType(DI);
5186 getDerived().getBaseEntity());
5187 if (getDerived().AlreadyTransformed(DI->
getType()))
5207 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5216template<
typename Derived>
5221 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5222 auto SuppressObjCLifetime =
5223 T.getType().getLocalQualifiers().hasObjCLifetime();
5225 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5226 SuppressObjCLifetime);
5227 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5228 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5229 TLB, STTP, SuppressObjCLifetime);
5231 Result = getDerived().TransformType(TLB, UnqualTL);
5250template <
typename Derived>
5260 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5291 else if (
T.getObjCLifetime()) {
5296 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5312 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5321template<
typename Derived>
5327 if (getDerived().AlreadyTransformed(TL.
getType()))
5331 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5337template<
typename Derived>
5339TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5340 QualType ObjectType,
5341 NamedDecl *UnqualLookup,
5343 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5346 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5350template <
typename Derived>
5351TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5352 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5354 QualType
T = TL.getType();
5355 assert(!getDerived().AlreadyTransformed(
T));
5360 if (isa<TemplateSpecializationType>(
T)) {
5361 TemplateSpecializationTypeLoc SpecTL =
5362 TL.castAs<TemplateSpecializationTypeLoc>();
5364 TemplateName Template = getDerived().TransformTemplateName(
5365 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5366 ObjectType, UnqualLookup,
true);
5367 if (Template.isNull())
5370 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5372 }
else if (isa<DependentTemplateSpecializationType>(
T)) {
5373 DependentTemplateSpecializationTypeLoc SpecTL =
5374 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5376 TemplateName Template
5377 = getDerived().RebuildTemplateName(SS,
5378 SpecTL.getTemplateKeywordLoc(),
5379 *SpecTL.getTypePtr()->getIdentifier(),
5380 SpecTL.getTemplateNameLoc(),
5381 ObjectType, UnqualLookup,
5383 if (Template.isNull())
5386 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5392 Result = getDerived().TransformType(TLB, TL);
5401template <
class TyLoc>
static inline
5403 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5404 NewT.setNameLoc(
T.getNameLoc());
5408template<
typename Derived>
5409QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5411 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5412 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5413 if (
T.needsExtraLocalData())
5414 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5418template<
typename Derived>
5419QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5425template <
typename Derived>
5426QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5427 AdjustedTypeLoc TL) {
5429 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5432template<
typename Derived>
5433QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5434 DecayedTypeLoc TL) {
5435 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5436 if (OriginalType.isNull())
5439 QualType
Result = TL.getType();
5440 if (getDerived().AlwaysRebuild() ||
5441 OriginalType != TL.getOriginalLoc().getType())
5443 TLB.push<DecayedTypeLoc>(
Result);
5448template <
typename Derived>
5450TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5451 ArrayParameterTypeLoc TL) {
5452 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5453 if (OriginalType.isNull())
5456 QualType
Result = TL.getType();
5457 if (getDerived().AlwaysRebuild() ||
5458 OriginalType != TL.getElementLoc().getType())
5460 TLB.push<ArrayParameterTypeLoc>(
Result);
5465template<
typename Derived>
5466QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5467 PointerTypeLoc TL) {
5468 QualType PointeeType
5469 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5470 if (PointeeType.isNull())
5473 QualType
Result = TL.getType();
5474 if (PointeeType->getAs<ObjCObjectType>()) {
5481 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5482 NewT.setStarLoc(TL.getStarLoc());
5486 if (getDerived().AlwaysRebuild() ||
5487 PointeeType != TL.getPointeeLoc().getType()) {
5488 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5495 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5497 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5498 NewT.setSigilLoc(TL.getSigilLoc());
5502template<
typename Derived>
5504TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5505 BlockPointerTypeLoc TL) {
5506 QualType PointeeType
5507 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5508 if (PointeeType.isNull())
5511 QualType
Result = TL.getType();
5512 if (getDerived().AlwaysRebuild() ||
5513 PointeeType != TL.getPointeeLoc().getType()) {
5514 Result = getDerived().RebuildBlockPointerType(PointeeType,
5520 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5521 NewT.setSigilLoc(TL.getSigilLoc());
5529template<
typename Derived>
5537 if (PointeeType.
isNull())
5541 if (getDerived().AlwaysRebuild() ||
5542 PointeeType !=
T->getPointeeTypeAsWritten()) {
5543 Result = getDerived().RebuildReferenceType(PointeeType,
5544 T->isSpelledAsLValue(),
5557 if (isa<LValueReferenceType>(
Result))
5566template<
typename Derived>
5570 return TransformReferenceType(TLB, TL);
5573template<
typename Derived>
5575TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5576 RValueReferenceTypeLoc TL) {
5577 return TransformReferenceType(TLB, TL);
5580template<
typename Derived>
5582TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5583 MemberPointerTypeLoc TL) {
5584 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5585 if (PointeeType.isNull())
5588 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5589 TypeSourceInfo *NewClsTInfo =
nullptr;
5591 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5596 const MemberPointerType *
T = TL.getTypePtr();
5597 QualType OldClsType = QualType(
T->getClass(), 0);
5598 QualType NewClsType;
5600 NewClsType = NewClsTInfo->getType();
5602 NewClsType = getDerived().TransformType(OldClsType);
5603 if (NewClsType.isNull())
5607 QualType
Result = TL.getType();
5608 if (getDerived().AlwaysRebuild() ||
5610 NewClsType != OldClsType) {
5611 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5619 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5620 if (MPT && PointeeType != MPT->getPointeeType()) {
5621 assert(isa<AdjustedType>(MPT->getPointeeType()));
5622 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5625 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5626 NewTL.setSigilLoc(TL.getSigilLoc());
5627 NewTL.setClassTInfo(NewClsTInfo);
5632template<
typename Derived>
5634TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5635 ConstantArrayTypeLoc TL) {
5636 const ConstantArrayType *
T = TL.getTypePtr();
5637 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5638 if (ElementType.isNull())
5642 Expr *
OldSize = TL.getSizeExpr();
5644 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5645 Expr *NewSize =
nullptr;
5649 NewSize = getDerived().TransformExpr(
OldSize).template getAs<Expr>();
5653 QualType
Result = TL.getType();
5654 if (getDerived().AlwaysRebuild() ||
5655 ElementType !=
T->getElementType() ||
5656 (
T->getSizeExpr() && NewSize !=
OldSize)) {
5657 Result = getDerived().RebuildConstantArrayType(ElementType,
5658 T->getSizeModifier(),
5659 T->getSize(), NewSize,
5660 T->getIndexTypeCVRQualifiers(),
5661 TL.getBracketsRange());
5670 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5671 NewTL.setLBracketLoc(TL.getLBracketLoc());
5672 NewTL.setRBracketLoc(TL.getRBracketLoc());
5673 NewTL.setSizeExpr(NewSize);
5678template<
typename Derived>
5679QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5680 TypeLocBuilder &TLB,
5681 IncompleteArrayTypeLoc TL) {
5682 const IncompleteArrayType *
T = TL.getTypePtr();
5683 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5684 if (ElementType.isNull())
5687 QualType
Result = TL.getType();
5688 if (getDerived().AlwaysRebuild() ||
5689 ElementType !=
T->getElementType()) {
5690 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5691 T->getSizeModifier(),
5692 T->getIndexTypeCVRQualifiers(),
5693 TL.getBracketsRange());
5698 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5699 NewTL.setLBracketLoc(TL.getLBracketLoc());
5700 NewTL.setRBracketLoc(TL.getRBracketLoc());
5701 NewTL.setSizeExpr(
nullptr);
5706template<
typename Derived>
5708TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5709 VariableArrayTypeLoc TL) {
5710 const VariableArrayType *
T = TL.getTypePtr();
5711 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5712 if (ElementType.isNull())
5717 EnterExpressionEvaluationContext Context(
5719 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5721 if (SizeResult.isInvalid())
5725 if (SizeResult.isInvalid())
5728 Expr *
Size = SizeResult.get();
5730 QualType
Result = TL.getType();
5731 if (getDerived().AlwaysRebuild() ||
5732 ElementType !=
T->getElementType() ||
5733 Size !=
T->getSizeExpr()) {
5734 Result = getDerived().RebuildVariableArrayType(ElementType,
5735 T->getSizeModifier(),
5737 T->getIndexTypeCVRQualifiers(),
5738 TL.getBracketsRange());
5745 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5746 NewTL.setLBracketLoc(TL.getLBracketLoc());
5747 NewTL.setRBracketLoc(TL.getRBracketLoc());
5748 NewTL.setSizeExpr(Size);
5753template<
typename Derived>
5755TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5756 DependentSizedArrayTypeLoc TL) {
5757 const DependentSizedArrayType *
T = TL.getTypePtr();
5758 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5759 if (ElementType.isNull())
5767 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5770 Expr *origSize = TL.getSizeExpr();
5771 if (!origSize) origSize =
T->getSizeExpr();
5774 = getDerived().TransformExpr(origSize);
5776 if (sizeResult.isInvalid())
5779 Expr *size = sizeResult.get();
5781 QualType
Result = TL.getType();
5782 if (getDerived().AlwaysRebuild() ||
5783 ElementType !=
T->getElementType() ||
5785 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5786 T->getSizeModifier(),
5788 T->getIndexTypeCVRQualifiers(),
5789 TL.getBracketsRange());
5796 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5797 NewTL.setLBracketLoc(TL.getLBracketLoc());
5798 NewTL.setRBracketLoc(TL.getRBracketLoc());
5799 NewTL.setSizeExpr(size);
5804template <
typename Derived>
5805QualType TreeTransform<Derived>::TransformDependentVectorType(
5806 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5807 const DependentVectorType *
T = TL.getTypePtr();
5808 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5809 if (ElementType.isNull())
5817 if (
Size.isInvalid())
5820 QualType
Result = TL.getType();
5821 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5822 Size.get() !=
T->getSizeExpr()) {
5823 Result = getDerived().RebuildDependentVectorType(
5824 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5830 if (isa<DependentVectorType>(
Result)) {
5831 DependentVectorTypeLoc NewTL =
5832 TLB.push<DependentVectorTypeLoc>(
Result);
5833 NewTL.setNameLoc(TL.getNameLoc());
5835 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5836 NewTL.setNameLoc(TL.getNameLoc());
5842template<
typename Derived>
5843QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5844 TypeLocBuilder &TLB,
5845 DependentSizedExtVectorTypeLoc TL) {
5846 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5849 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5850 if (ElementType.isNull())
5859 if (
Size.isInvalid())
5862 QualType
Result = TL.getType();
5863 if (getDerived().AlwaysRebuild() ||
5864 ElementType !=
T->getElementType() ||
5865 Size.get() !=
T->getSizeExpr()) {
5866 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5868 T->getAttributeLoc());
5874 if (isa<DependentSizedExtVectorType>(
Result)) {
5875 DependentSizedExtVectorTypeLoc NewTL
5876 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5877 NewTL.setNameLoc(TL.getNameLoc());
5879 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5880 NewTL.setNameLoc(TL.getNameLoc());
5886template <
typename Derived>
5888TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5889 ConstantMatrixTypeLoc TL) {
5890 const ConstantMatrixType *
T = TL.getTypePtr();
5891 QualType ElementType = getDerived().TransformType(
T->getElementType());
5892 if (ElementType.isNull())
5895 QualType
Result = TL.getType();
5896 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
5897 Result = getDerived().RebuildConstantMatrixType(
5898 ElementType,
T->getNumRows(),
T->getNumColumns());
5903 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5904 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5905 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5906 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5907 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5912template <
typename Derived>
5913QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5914 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5915 const DependentSizedMatrixType *
T = TL.getTypePtr();
5917 QualType ElementType = getDerived().TransformType(
T->getElementType());
5918 if (ElementType.isNull()) {
5926 Expr *origRows = TL.getAttrRowOperand();
5928 origRows =
T->getRowExpr();
5929 Expr *origColumns = TL.getAttrColumnOperand();
5931 origColumns =
T->getColumnExpr();
5933 ExprResult rowResult = getDerived().TransformExpr(origRows);
5935 if (rowResult.isInvalid())
5938 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5940 if (columnResult.isInvalid())
5943 Expr *rows = rowResult.get();
5944 Expr *columns = columnResult.get();
5946 QualType
Result = TL.getType();
5947 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5948 rows != origRows || columns != origColumns) {
5949 Result = getDerived().RebuildDependentSizedMatrixType(
5950 ElementType, rows, columns,
T->getAttributeLoc());
5958 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5959 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5960 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5961 NewTL.setAttrRowOperand(rows);
5962 NewTL.setAttrColumnOperand(columns);
5966template <
typename Derived>
5967QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5968 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5969 const DependentAddressSpaceType *
T = TL.getTypePtr();
5971 QualType pointeeType =
5972 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
5974 if (pointeeType.isNull())
5981 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
5983 if (AddrSpace.isInvalid())
5986 QualType
Result = TL.getType();
5987 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
5988 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
5989 Result = getDerived().RebuildDependentAddressSpaceType(
5990 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
5996 if (isa<DependentAddressSpaceType>(
Result)) {
5997 DependentAddressSpaceTypeLoc NewTL =
5998 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
6000 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6001 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6002 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6005 TLB.TypeWasModifiedSafely(
Result);
6011template <
typename Derived>
6012QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
6014 const VectorType *
T = TL.getTypePtr();
6015 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6016 if (ElementType.isNull())
6019 QualType
Result = TL.getType();
6020 if (getDerived().AlwaysRebuild() ||
6021 ElementType !=
T->getElementType()) {
6022 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6023 T->getVectorKind());
6028 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
6029 NewTL.setNameLoc(TL.getNameLoc());
6034template<
typename Derived>
6035QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
6036 ExtVectorTypeLoc TL) {
6037 const VectorType *
T = TL.getTypePtr();
6038 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6039 if (ElementType.isNull())
6042 QualType
Result = TL.getType();
6043 if (getDerived().AlwaysRebuild() ||
6044 ElementType !=
T->getElementType()) {
6045 Result = getDerived().RebuildExtVectorType(ElementType,
6046 T->getNumElements(),
6052 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
6053 NewTL.setNameLoc(TL.getNameLoc());
6058template <
typename Derived>
6061 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
6065 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
6092 NewDI = getDerived().TransformType(OldDI);
6096 if (NewDI == OldDI && indexAdjustment == 0)
6110 transformedLocalDecl(OldParm, {newParm});
6114template <
typename Derived>
6122 unsigned *LastParamTransformed) {
6123 int indexAdjustment = 0;
6125 unsigned NumParams = Params.size();
6126 for (
unsigned i = 0; i != NumParams; ++i) {
6127 if (LastParamTransformed)
6128 *LastParamTransformed = i;
6130 assert(OldParm->getFunctionScopeIndex() == i);
6132 std::optional<unsigned> NumExpansions;
6134 if (OldParm->isParameterPack()) {
6139 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6145 bool ShouldExpand =
false;
6146 bool RetainExpansion =
false;
6147 std::optional<unsigned> OrigNumExpansions;
6148 if (Unexpanded.size() > 0) {
6150 NumExpansions = OrigNumExpansions;
6151 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
6152 Pattern.getSourceRange(),
6164 "Could not find parameter packs or undeduced auto type!");
6171 getDerived().ExpandingFunctionParameterPack(OldParm);
6172 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6175 = getDerived().TransformFunctionTypeParam(OldParm,
6183 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6184 OutParamTypes.push_back(NewParm->
getType());
6186 PVars->push_back(NewParm);
6191 if (RetainExpansion) {
6192 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6194 = getDerived().TransformFunctionTypeParam(OldParm,
6202 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6203 OutParamTypes.push_back(NewParm->
getType());
6205 PVars->push_back(NewParm);
6221 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6226 "Parameter pack no longer a parameter pack after "
6229 NewParm = getDerived().TransformFunctionTypeParam(
6230 OldParm, indexAdjustment, std::nullopt,
6238 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6239 OutParamTypes.push_back(NewParm->
getType());
6241 PVars->push_back(NewParm);
6249 bool IsPackExpansion =
false;
6250 std::optional<unsigned> NumExpansions;
6253 = dyn_cast<PackExpansionType>(OldType)) {
6255 QualType Pattern = Expansion->getPattern();
6257 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6260 bool ShouldExpand =
false;
6261 bool RetainExpansion =
false;
6273 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6275 QualType NewType = getDerived().TransformType(Pattern);
6280 NewType = getSema().getASTContext().getPackExpansionType(
6281 NewType, std::nullopt);
6288 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6289 OutParamTypes.push_back(NewType);
6291 PVars->push_back(
nullptr);
6300 if (RetainExpansion) {
6301 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6302 QualType NewType = getDerived().TransformType(Pattern);
6307 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6308 OutParamTypes.push_back(NewType);
6310 PVars->push_back(
nullptr);
6315 OldType = Expansion->getPattern();
6316 IsPackExpansion =
true;
6318 NewType = getDerived().TransformType(OldType);
6320 NewType = getDerived().TransformType(OldType);
6326 if (IsPackExpansion)
6327 NewType = getSema().Context.getPackExpansionType(NewType,
6331 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6332 OutParamTypes.push_back(NewType);
6334 PVars->push_back(
nullptr);
6339 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6341 assert(parm->getFunctionScopeIndex() == i);
6348template<
typename Derived>
6353 return getDerived().TransformFunctionProtoType(
6356 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6357 ExceptionStorage, Changed);
6361template<
typename Derived>
template<
typename Fn>
6364 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6381 if (getDerived().TransformFunctionTypeParams(
6385 ParamTypes, &ParamDecls, ExtParamInfos))
6397 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6399 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6405 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6409 if (getDerived().TransformFunctionTypeParams(
6413 ParamTypes, &ParamDecls, ExtParamInfos))
6419 bool EPIChanged =
false;
6424 if (
auto NewExtParamInfos =
6440 std::optional<FunctionEffectSet> NewFX;
6449 ExprResult NewExpr = getDerived().TransformExpr(CondExpr);
6452 std::optional<FunctionEffectMode> Mode =
6472 "FunctionEffectMode::None shouldn't be possible here");
6478 NewFX->insert(NewEC, Errs);
6479 assert(Errs.empty());
6487 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6489 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6500 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6506template<
typename Derived>
6516 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6518 SemaRef, Method ? Method->getParent() :
nullptr,
6519 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6529 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6552 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6557 bool Expand =
false;
6558 bool RetainExpansion =
false;
6559 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6562 if (getDerived().TryExpandParameterPacks(
6564 RetainExpansion, NumExpansions))
6572 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6577 Exceptions.push_back(
U);
6583 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6586 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6590 Exceptions.push_back(
U);
6599 Exceptions.push_back(
U);
6609template<
typename Derived>
6619 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6620 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6631template <
typename Derived>
6632QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6633 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6634 const UnresolvedUsingType *
T = TL.getTypePtr();
6635 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6639 QualType
Result = TL.getType();
6640 if (getDerived().AlwaysRebuild() ||
D !=
T->getDecl()) {
6641 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(),
D);
6648 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6649 NewTL.setNameLoc(TL.getNameLoc());
6654template <
typename Derived>
6655QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6657 const UsingType *
T = TL.getTypePtr();
6659 auto *
Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6660 TL.getLocalSourceRange().getBegin(),
T->getFoundDecl()));
6664 QualType Underlying = getDerived().TransformType(
T->
desugar());
6665 if (Underlying.isNull())
6668 QualType
Result = TL.getType();
6669 if (getDerived().AlwaysRebuild() ||
Found !=
T->getFoundDecl() ||
6670 Underlying !=
T->getUnderlyingType()) {
6671 Result = getDerived().RebuildUsingType(
Found, Underlying);
6676 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6680template<
typename Derived>
6681QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6682 TypedefTypeLoc TL) {
6683 const TypedefType *
T = TL.getTypePtr();
6684 TypedefNameDecl *Typedef
6685 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6690 QualType
Result = TL.getType();
6691 if (getDerived().AlwaysRebuild() ||
6692 Typedef !=
T->getDecl()) {
6693 Result = getDerived().RebuildTypedefType(Typedef);
6698 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6699 NewTL.setNameLoc(TL.getNameLoc());
6704template<
typename Derived>
6705QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6706 TypeOfExprTypeLoc TL) {
6712 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6720 QualType
Result = TL.getType();
6722 if (getDerived().AlwaysRebuild() ||
E.get() != TL.getUnderlyingExpr()) {
6724 getDerived().RebuildTypeOfExprType(
E.get(), TL.getTypeofLoc(), Kind);
6729 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6730 NewTL.setTypeofLoc(TL.getTypeofLoc());
6731 NewTL.setLParenLoc(TL.getLParenLoc());
6732 NewTL.setRParenLoc(TL.getRParenLoc());
6737template<
typename Derived>
6738QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6740 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6741 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6745 QualType
Result = TL.getType();
6747 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6748 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6753 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6754 NewTL.setTypeofLoc(TL.getTypeofLoc());
6755 NewTL.setLParenLoc(TL.getLParenLoc());
6756 NewTL.setRParenLoc(TL.getRParenLoc());
6757 NewTL.setUnmodifiedTInfo(New_Under_TI);
6762template<
typename Derived>
6763QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6764 DecltypeTypeLoc TL) {
6765 const DecltypeType *
T = TL.getTypePtr();
6772 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6776 E = getSema().ActOnDecltypeExpression(
E.get());
6780 QualType
Result = TL.getType();
6781 if (getDerived().AlwaysRebuild() ||
6782 E.get() !=
T->getUnderlyingExpr()) {
6783 Result = getDerived().RebuildDecltypeType(
E.get(), TL.getDecltypeLoc());
6789 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6790 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6791 NewTL.setRParenLoc(TL.getRParenLoc());
6795template <
typename Derived>
6797TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6798 PackIndexingTypeLoc TL) {
6802 EnterExpressionEvaluationContext ConstantContext(
6805 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6806 if (IndexExpr.isInvalid())
6809 QualType Pattern = TL.getPattern();
6811 const PackIndexingType *PIT = TL.getTypePtr();
6815 bool NotYetExpanded = Types.empty();
6816 bool FullySubstituted =
true;
6818 if (Types.empty() && !PIT->expandsToEmptyPack())
6821 for (QualType
T : Types) {
6823 QualType Transformed = getDerived().TransformType(
T);
6824 if (Transformed.isNull())
6826 SubtitutedTypes.push_back(Transformed);
6831 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
6832 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6835 bool ShouldExpand =
true;
6836 bool RetainExpansion =
false;
6837 std::optional<unsigned> OrigNumExpansions;
6838 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6839 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6840 Unexpanded, ShouldExpand,
6841 RetainExpansion, NumExpansions))
6843 if (!ShouldExpand) {
6844 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6847 TypeSourceInfo *TI =
6849 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6852 if (NotYetExpanded) {
6853 FullySubstituted =
false;
6854 QualType Out = getDerived().RebuildPackIndexingType(
6855 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6860 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6861 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6864 SubtitutedTypes.push_back(Pack);
6867 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6868 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6869 QualType Out = getDerived().TransformType(
T);
6872 SubtitutedTypes.push_back(Out);
6873 FullySubstituted &= !Out->containsUnexpandedParameterPack();
6877 if (RetainExpansion) {
6878 FullySubstituted =
false;
6879 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6880 QualType Out = getDerived().TransformType(
T);
6883 SubtitutedTypes.push_back(Out);
6890 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6891 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6893 QualType Out = getDerived().RebuildPackIndexingType(
6894 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6895 FullySubstituted, SubtitutedTypes);
6899 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6900 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6904template<
typename Derived>
6905QualType TreeTransform<Derived>::TransformUnaryTransformType(
6906 TypeLocBuilder &TLB,
6907 UnaryTransformTypeLoc TL) {
6908 QualType
Result = TL.getType();
6909 if (
Result->isDependentType()) {
6910 const UnaryTransformType *
T = TL.getTypePtr();
6912 TypeSourceInfo *NewBaseTSI =
6913 getDerived().TransformType(TL.getUnderlyingTInfo());
6916 QualType NewBase = NewBaseTSI->getType();
6918 Result = getDerived().RebuildUnaryTransformType(NewBase,
6925 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6926 NewTL.setKWLoc(TL.getKWLoc());
6927 NewTL.setParensRange(TL.getParensRange());
6928 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6932template<
typename Derived>
6933QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6934 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6935 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
6938 TemplateName TemplateName = getDerived().TransformTemplateName(
6939 SS,
T->getTemplateName(), TL.getTemplateNameLoc());
6940 if (TemplateName.isNull())
6943 QualType OldDeduced =
T->getDeducedType();
6944 QualType NewDeduced;
6945 if (!OldDeduced.isNull()) {
6946 NewDeduced = getDerived().TransformType(OldDeduced);
6947 if (NewDeduced.isNull())
6951 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6952 TemplateName, NewDeduced);
6956 DeducedTemplateSpecializationTypeLoc NewTL =
6957 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6958 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6963template<
typename Derived>
6964QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6966 const RecordType *
T = TL.getTypePtr();
6968 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6973 QualType
Result = TL.getType();
6974 if (getDerived().AlwaysRebuild() ||
6981 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6982 NewTL.setNameLoc(TL.getNameLoc());
6987template<
typename Derived>
6988QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
6990 const EnumType *
T = TL.getTypePtr();
6992 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6997 QualType
Result = TL.getType();
6998 if (getDerived().AlwaysRebuild() ||
6999 Enum !=
T->getDecl()) {
7005 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
7006 NewTL.setNameLoc(TL.getNameLoc());
7011template<
typename Derived>
7012QualType TreeTransform<Derived>::TransformInjectedClassNameType(
7013 TypeLocBuilder &TLB,
7014 InjectedClassNameTypeLoc TL) {
7015 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
7016 TL.getTypePtr()->getDecl());
7017 if (!
D)
return QualType();
7020 TLB.pushTypeSpec(
T).setNameLoc(TL.getNameLoc());
7024template<
typename Derived>
7028 return getDerived().TransformTemplateTypeParmType(
7033template <
typename Derived>
7039template<
typename Derived>
7040QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7041 TypeLocBuilder &TLB,
7042 SubstTemplateTypeParmTypeLoc TL) {
7043 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
7046 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
7051 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7052 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
7053 if (Replacement.isNull())
7057 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex());
7060 SubstTemplateTypeParmTypeLoc NewTL
7061 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7062 NewTL.setNameLoc(TL.getNameLoc());
7067template<
typename Derived>
7071 return getDerived().TransformSubstTemplateTypeParmPackType(
7075template <
typename Derived>
7081template<
typename Derived>
7091 = getDerived().TransformTemplateName(SS,
T->getTemplateName(),
7096 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
7099template<
typename Derived>
7107 if (getDerived().AlwaysRebuild() ||
7109 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
7114 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
7122template <
typename Derived>
7123QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
7125 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7126 if (ValueType.isNull())
7129 QualType
Result = TL.getType();
7130 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7131 const PipeType *PT =
Result->castAs<PipeType>();
7132 bool isReadPipe = PT->isReadOnly();
7133 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7138 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
7139 NewTL.setKWLoc(TL.getKWLoc());
7144template <
typename Derived>
7145QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
7147 const BitIntType *EIT = TL.getTypePtr();
7148 QualType
Result = TL.getType();
7150 if (getDerived().AlwaysRebuild()) {
7151 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7152 EIT->getNumBits(), TL.getNameLoc());
7157 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7158 NewTL.setNameLoc(TL.getNameLoc());
7162template <
typename Derived>
7163QualType TreeTransform<Derived>::TransformDependentBitIntType(
7164 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
7165 const DependentBitIntType *EIT = TL.getTypePtr();
7169 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7172 if (BitsExpr.isInvalid())
7175 QualType
Result = TL.getType();
7177 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7178 Result = getDerived().RebuildDependentBitIntType(
7179 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7185 if (isa<DependentBitIntType>(
Result)) {
7186 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
7187 NewTL.setNameLoc(TL.getNameLoc());
7189 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7190 NewTL.setNameLoc(TL.getNameLoc());
7200 template<
typename ArgLocContainer>
7202 ArgLocContainer *Container;
7227 : Container(&Container), Index(Index) { }
7241 return Container->getArgLoc(Index);
7245 return pointer(Container->getArgLoc(Index));
7250 return X.Container == Y.Container &&
X.Index == Y.Index;
7259template<
typename Derived>
7260QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7262 const AutoType *
T = TL.getTypePtr();
7263 QualType OldDeduced =
T->getDeducedType();
7264 QualType NewDeduced;
7265 if (!OldDeduced.isNull()) {
7266 NewDeduced = getDerived().TransformType(OldDeduced);
7267 if (NewDeduced.isNull())
7271 ConceptDecl *NewCD =
nullptr;
7272 TemplateArgumentListInfo NewTemplateArgs;
7273 NestedNameSpecifierLoc NewNestedNameSpec;
7274 if (
T->isConstrained()) {
7275 assert(TL.getConceptReference());
7276 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7277 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7279 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7280 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7281 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7282 if (getDerived().TransformTemplateArguments(
7283 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7287 if (TL.getNestedNameSpecifierLoc()) {
7289 = getDerived().TransformNestedNameSpecifierLoc(
7290 TL.getNestedNameSpecifierLoc());
7291 if (!NewNestedNameSpec)
7296 QualType
Result = TL.getType();
7297 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7301 NewArgList.reserve(NewTemplateArgs.size());
7302 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7303 NewArgList.push_back(ArgLoc.getArgument());
7304 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7310 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7311 NewTL.setNameLoc(TL.getNameLoc());
7312 NewTL.setRParenLoc(TL.getRParenLoc());
7313 NewTL.setConceptReference(
nullptr);
7315 if (
T->isConstrained()) {
7316 DeclarationNameInfo DNI = DeclarationNameInfo(
7317 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7318 TL.getConceptNameLoc(),
7319 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7321 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7322 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7324 NewTL.setConceptReference(CR);
7330template <
typename Derived>
7332 TypeLocBuilder &TLB,
7333 TemplateSpecializationTypeLoc TL,
7334 TemplateName Template) {
7335 TemplateArgumentListInfo NewTemplateArgs;
7336 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7337 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7338 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7340 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7341 ArgIterator(TL, TL.getNumArgs()),
7350 getDerived().RebuildTemplateSpecializationType(Template,
7351 TL.getTemplateNameLoc(),
7359 if (isa<DependentTemplateSpecializationType>(
Result)) {
7360 DependentTemplateSpecializationTypeLoc NewTL
7361 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7362 NewTL.setElaboratedKeywordLoc(SourceLocation());
7363 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7364 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7365 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7366 NewTL.setLAngleLoc(TL.getLAngleLoc());
7367 NewTL.setRAngleLoc(TL.getRAngleLoc());
7368 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7369 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7373 TemplateSpecializationTypeLoc NewTL
7374 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7375 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7376 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7377 NewTL.setLAngleLoc(TL.getLAngleLoc());
7378 NewTL.setRAngleLoc(TL.getRAngleLoc());
7379 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7380 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7386template <
typename Derived>
7397 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7405 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7407 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7417 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7423 = getDerived().RebuildTemplateSpecializationType(Template,
7435 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7442template<
typename Derived>
7457 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7458 if (NamedT.isNull())
7467 if (
const TemplateSpecializationType *TST =
7468 NamedT->getAs<TemplateSpecializationType>()) {
7469 TemplateName Template = TST->getTemplateName();
7470 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7471 Template.getAsTemplateDecl())) {
7473 diag::err_tag_reference_non_tag)
7475 << llvm::to_underlying(
7477 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7483 if (getDerived().AlwaysRebuild() ||
7485 NamedT !=
T->getNamedType()) {
7488 QualifierLoc, NamedT);
7493 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7495 NewTL.setQualifierLoc(QualifierLoc);
7499template <
typename Derived>
7500QualType TreeTransform<Derived>::TransformAttributedType(TypeLocBuilder &TLB,
7501 AttributedTypeLoc TL) {
7503 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7504 if (modifiedType.isNull())
7508 const Attr *oldAttr = TL.getAttr();
7509 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7510 if (oldAttr && !newAttr)
7513 QualType result = TL.getType();
7516 if (getDerived().AlwaysRebuild() ||
7517 modifiedType != oldType->getModifiedType()) {
7530 QualType equivalentType = modifiedType;
7531 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7532 TypeLocBuilder AuxiliaryTLB;
7533 AuxiliaryTLB.reserve(TL.getFullDataSize());
7535 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7536 if (equivalentType.isNull())
7542 if (
auto nullability = oldType->getImmediateNullability()) {
7543 if (!modifiedType->canHaveNullability()) {
7544 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7545 : TL.getModifiedLoc().getBeginLoc()),
7546 diag::err_nullability_nonpointer)
7558 AttributedTypeLoc newTL = TLB.push<AttributedTypeLoc>(result);
7559 newTL.setAttr(newAttr);
7563template <
typename Derived>
7564QualType TreeTransform<Derived>::TransformCountAttributedType(
7565 TypeLocBuilder &TLB, CountAttributedTypeLoc TL) {
7566 const CountAttributedType *OldTy = TL.
getTypePtr();
7567 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7568 if (InnerTy.isNull())
7571 Expr *OldCount = TL.getCountExpr();
7572 Expr *NewCount =
nullptr;
7574 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7575 if (CountResult.isInvalid())
7577 NewCount = CountResult.get();
7580 QualType
Result = TL.getType();
7581 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7582 OldCount != NewCount) {
7585 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7588 TLB.push<CountAttributedTypeLoc>(
Result);
7592template <
typename Derived>
7593QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7594 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7596 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7599template <
typename Derived>
7600QualType TreeTransform<Derived>::TransformHLSLAttributedResourceType(
7601 TypeLocBuilder &TLB, HLSLAttributedResourceTypeLoc TL) {
7603 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7605 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7606 if (WrappedTy.isNull())
7609 QualType ContainedTy = QualType();
7610 QualType OldContainedTy = oldType->getContainedType();
7611 if (!OldContainedTy.isNull()) {
7612 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7613 if (!oldContainedTSI)
7614 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7615 OldContainedTy, SourceLocation());
7616 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7619 ContainedTy = ContainedTSI->getType();
7622 QualType
Result = TL.getType();
7623 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7624 ContainedTy != oldType->getContainedType()) {
7626 WrappedTy, ContainedTy, oldType->getAttrs());
7629 TLB.push<HLSLAttributedResourceTypeLoc>(
Result);
7633template<
typename Derived>
7635TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7637 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7641 QualType
Result = TL.getType();
7642 if (getDerived().AlwaysRebuild() ||
7643 Inner != TL.getInnerLoc().getType()) {
7644 Result = getDerived().RebuildParenType(Inner);
7649 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7650 NewTL.setLParenLoc(TL.getLParenLoc());
7651 NewTL.setRParenLoc(TL.getRParenLoc());
7655template <
typename Derived>
7657TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7658 MacroQualifiedTypeLoc TL) {
7659 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7663 QualType
Result = TL.getType();
7664 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7666 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7671 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7672 NewTL.setExpansionLoc(TL.getExpansionLoc());
7676template<
typename Derived>
7677QualType TreeTransform<Derived>::TransformDependentNameType(
7678 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7679 return TransformDependentNameType(TLB, TL,
false);
7682template<
typename Derived>
7683QualType TreeTransform<Derived>::TransformDependentNameType(
7684 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7685 const DependentNameType *
T = TL.getTypePtr();
7687 NestedNameSpecifierLoc QualifierLoc
7688 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7693 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7694 TL.getElaboratedKeywordLoc(),
7702 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7703 QualType NamedT = ElabT->getNamedType();
7704 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7706 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7707 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7708 NewTL.setQualifierLoc(QualifierLoc);
7710 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7711 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7712 NewTL.setQualifierLoc(QualifierLoc);
7713 NewTL.setNameLoc(TL.getNameLoc());
7718template<
typename Derived>
7721 DependentTemplateSpecializationTypeLoc TL) {
7722 NestedNameSpecifierLoc QualifierLoc;
7723 if (TL.getQualifierLoc()) {
7725 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7731 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7734template<
typename Derived>
7747 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7752 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7760 QualType NamedT = ElabT->getNamedType();
7769 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7776 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7785 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7794 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7800template<
typename Derived>
7809 if (getDerived().AlwaysRebuild() ||
7811 Result = getDerived().RebuildPackExpansionType(Pattern,
7819 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7824template<
typename Derived>
7826TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7827 ObjCInterfaceTypeLoc TL) {
7829 TLB.pushFullCopy(TL);
7830 return TL.getType();
7833template<
typename Derived>
7835TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7836 ObjCTypeParamTypeLoc TL) {
7837 const ObjCTypeParamType *
T = TL.getTypePtr();
7838 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7839 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7843 QualType
Result = TL.getType();
7844 if (getDerived().AlwaysRebuild() ||
7845 OTP !=
T->getDecl()) {
7846 Result = getDerived().RebuildObjCTypeParamType(
7847 OTP, TL.getProtocolLAngleLoc(),
7848 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7849 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7854 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7855 if (TL.getNumProtocols()) {
7856 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7857 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7858 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7859 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7864template<
typename Derived>
7866TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7867 ObjCObjectTypeLoc TL) {
7869 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7870 if (BaseType.isNull())
7873 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7877 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7878 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7879 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7880 QualType TypeArg = TypeArgInfo->getType();
7881 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7885 const auto *PackExpansion = PackExpansionLoc.getType()
7886 ->castAs<PackExpansionType>();
7890 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7894 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7895 bool Expand =
false;
7896 bool RetainExpansion =
false;
7897 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7898 if (getDerived().TryExpandParameterPacks(
7899 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7900 Unexpanded, Expand, RetainExpansion, NumExpansions))
7907 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7909 TypeLocBuilder TypeArgBuilder;
7910 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7911 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7913 if (NewPatternType.isNull())
7917 NewPatternType, NumExpansions);
7918 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7919 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7920 NewTypeArgInfos.push_back(
7921 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7927 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7928 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7930 TypeLocBuilder TypeArgBuilder;
7931 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7933 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7935 if (NewTypeArg.isNull())
7938 NewTypeArgInfos.push_back(
7939 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7945 TypeLocBuilder TypeArgBuilder;
7946 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7947 QualType NewTypeArg =
7948 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7949 if (NewTypeArg.isNull())
7953 if (NewTypeArg == TypeArg) {
7954 NewTypeArgInfos.push_back(TypeArgInfo);
7958 NewTypeArgInfos.push_back(
7959 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7963 QualType
Result = TL.getType();
7964 if (getDerived().AlwaysRebuild() || AnyChanged) {
7966 Result = getDerived().RebuildObjCObjectType(
7967 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7968 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7969 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7970 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7976 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7977 NewT.setHasBaseTypeAsWritten(
true);
7978 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7979 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7980 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7981 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7982 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7983 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7984 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7985 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7989template<
typename Derived>
7991TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
7992 ObjCObjectPointerTypeLoc TL) {
7993 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7994 if (PointeeType.isNull())
7997 QualType
Result = TL.getType();
7998 if (getDerived().AlwaysRebuild() ||
7999 PointeeType != TL.getPointeeLoc().getType()) {
8000 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8006 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
8007 NewT.setStarLoc(TL.getStarLoc());
8014template<
typename Derived>
8016TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
8020template<
typename Derived>
8023 return getDerived().TransformCompoundStmt(S,
false);
8026template<
typename Derived>
8032 if (S->hasStoredFPFeatures())
8033 getSema().resetFPOptions(
8034 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
8037 bool SubStmtInvalid =
false;
8038 bool SubStmtChanged =
false;
8040 for (
auto *B : S->body()) {
8042 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
8044 if (
Result.isInvalid()) {
8047 if (isa<DeclStmt>(B))
8051 SubStmtInvalid =
true;
8055 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8056 Statements.push_back(
Result.getAs<Stmt>());
8062 if (!getDerived().AlwaysRebuild() &&
8066 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
8072template<
typename Derived>
8074TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
8081 LHS = getDerived().TransformExpr(S->getLHS());
8083 if (LHS.isInvalid())
8087 RHS = getDerived().TransformExpr(S->getRHS());
8089 if (RHS.isInvalid())
8096 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8098 S->getEllipsisLoc(),
8101 if (Case.isInvalid())
8106 getDerived().TransformStmt(S->getSubStmt());
8107 if (SubStmt.isInvalid())
8111 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8114template <
typename Derived>
8115StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
8118 getDerived().TransformStmt(S->getSubStmt());
8119 if (SubStmt.isInvalid())
8123 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8127template<
typename Derived>
8129TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
8130 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8131 if (SubStmt.isInvalid())
8134 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8142 if (LD == S->getDecl())
8143 S->getDecl()->setStmt(
nullptr);
8146 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8147 cast<LabelDecl>(LD), SourceLocation(),
8151template <
typename Derived>
8160 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8161#include "clang/Basic/AttrList.inc"
8166template <
typename Derived>
8177 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8178#include "clang/Basic/AttrList.inc"
8180 return TransformAttr(R);
8183template <
typename Derived>
8186 StmtDiscardKind SDK) {
8187 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8191 bool AttrsChanged =
false;
8195 for (
const auto *I : S->getAttrs()) {
8197 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
8198 AttrsChanged |= (I != R);
8203 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
8211 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8215template<
typename Derived>
8217TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
8220 if (
Init.isInvalid())
8223 Sema::ConditionResult Cond;
8224 if (!S->isConsteval()) {
8226 Cond = getDerived().TransformCondition(
8227 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8230 if (Cond.isInvalid())
8235 std::optional<bool> ConstexprConditionValue;
8236 if (S->isConstexpr())
8237 ConstexprConditionValue = Cond.getKnownValue();
8241 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8242 EnterExpressionEvaluationContext Ctx(
8245 S->isNonNegatedConsteval());
8247 Then = getDerived().TransformStmt(S->getThen());
8248 if (Then.isInvalid())
8254 Then =
new (getSema().Context)
8255 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8260 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8261 EnterExpressionEvaluationContext Ctx(
8264 S->isNegatedConsteval());
8266 Else = getDerived().TransformStmt(S->getElse());
8267 if (Else.isInvalid())
8269 }
else if (S->getElse() && ConstexprConditionValue &&
8270 *ConstexprConditionValue) {
8274 Else =
new (getSema().Context)
8275 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8278 if (!getDerived().AlwaysRebuild() &&
8279 Init.get() == S->getInit() &&
8280 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8281 Then.get() == S->getThen() &&
8282 Else.get() == S->getElse())
8285 return getDerived().RebuildIfStmt(
8286 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8287 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8290template<
typename Derived>
8292TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8295 if (
Init.isInvalid())
8299 Sema::ConditionResult Cond = getDerived().TransformCondition(
8300 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8302 if (Cond.isInvalid())
8307 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8308 Init.get(), Cond, S->getRParenLoc());
8313 StmtResult Body = getDerived().TransformStmt(S->getBody());
8314 if (Body.isInvalid())
8318 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8322template<
typename Derived>
8324TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8326 Sema::ConditionResult Cond = getDerived().TransformCondition(
8327 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8329 if (Cond.isInvalid())
8334 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8338 StmtResult Body = getDerived().TransformStmt(S->getBody());
8339 if (Body.isInvalid())
8342 if (!getDerived().AlwaysRebuild() &&
8343 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8344 Body.get() == S->getBody())
8347 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8348 Cond, S->getRParenLoc(), Body.get());
8351template<
typename Derived>
8353TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8356 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8360 StmtResult Body = getDerived().TransformStmt(S->getBody());
8361 if (Body.isInvalid())
8365 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8366 if (Cond.isInvalid())
8369 if (!getDerived().AlwaysRebuild() &&
8370 Cond.get() == S->getCond() &&
8371 Body.get() == S->getBody())
8374 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8375 S->getWhileLoc(), Cond.get(),
8379template<
typename Derived>
8381TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8382 if (getSema().getLangOpts().OpenMP)
8383 getSema().OpenMP().startOpenMPLoop();
8387 if (
Init.isInvalid())
8392 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8393 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8397 Sema::ConditionResult Cond = getDerived().TransformCondition(
8398 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8400 if (Cond.isInvalid())
8405 if (
Inc.isInvalid())
8408 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8409 if (S->getInc() && !FullInc.get())
8414 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8416 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8417 Cond.get().second, S->getInc(),
Inc.get());
8420 StmtResult Body = getDerived().TransformStmt(S->getBody());
8421 if (Body.isInvalid())
8426 if (!getDerived().AlwaysRebuild() &&
8427 Init.get() == S->getInit() &&
8428 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8429 Inc.get() == S->getInc() &&
8430 Body.get() == S->getBody())
8433 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8434 Init.get(), Cond, FullInc,
8435 S->getRParenLoc(), Body.get());
8438template<
typename Derived>
8440TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8441 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8447 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8448 cast<LabelDecl>(LD));
8451template<
typename Derived>
8453TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8459 if (!getDerived().AlwaysRebuild() &&
8460 Target.get() == S->getTarget())
8463 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8467template<
typename Derived>
8469TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8473template<
typename Derived>
8475TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8479template<
typename Derived>
8481TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8489 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8492template<
typename Derived>
8494TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8495 bool DeclChanged =
false;
8497 LambdaScopeInfo *LSI = getSema().getCurLambda();
8498 for (
auto *
D : S->decls()) {
8503 if (Transformed !=
D)
8507 if (
auto *TD = dyn_cast<TypeDecl>(Transformed))
8508 LSI->ContainsUnexpandedParameterPack |=
8511 .getTypeDeclType(TD)
8512 .getSingleStepDesugaredType(getSema().getASTContext())
8513 ->containsUnexpandedParameterPack();
8515 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8516 LSI->ContainsUnexpandedParameterPack |=
8517 VD->getType()->containsUnexpandedParameterPack();
8520 Decls.push_back(Transformed);
8523 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8526 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8529template<
typename Derived>
8531TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8540 bool ExprsChanged =
false;
8543 for (
unsigned I = 0,
E = S->getNumOutputs(); I !=
E; ++I) {
8544 Names.push_back(S->getOutputIdentifier(I));
8547 Constraints.push_back(S->getOutputConstraintLiteral(I));
8550 Expr *OutputExpr = S->getOutputExpr(I);
8555 ExprsChanged |=
Result.get() != OutputExpr;
8557 Exprs.push_back(
Result.get());
8561 for (
unsigned I = 0,
E = S->getNumInputs(); I !=
E; ++I) {
8562 Names.push_back(S->getInputIdentifier(I));
8565 Constraints.push_back(S->getInputConstraintLiteral(I));
8568 Expr *InputExpr = S->getInputExpr(I);
8573 ExprsChanged |=
Result.get() != InputExpr;
8575 Exprs.push_back(
Result.get());
8579 for (
unsigned I = 0,
E = S->getNumLabels(); I !=
E; ++I) {
8580 Names.push_back(S->getLabelIdentifier(I));
8585 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8586 Exprs.push_back(
Result.get());
8588 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8592 for (
unsigned I = 0,
E = S->getNumClobbers(); I !=
E; ++I)
8593 Clobbers.push_back(S->getClobberStringLiteral(I));
8596 AsmString = S->getAsmString();
8597 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8598 S->isVolatile(), S->getNumOutputs(),
8599 S->getNumInputs(), Names.data(),
8600 Constraints, Exprs, AsmString.get(),
8601 Clobbers, S->getNumLabels(),
8605template<
typename Derived>
8607TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8610 bool HadError =
false, HadChange =
false;
8614 TransformedExprs.reserve(SrcExprs.size());
8615 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8617 if (!
Result.isUsable()) {
8620 HadChange |= (
Result.get() != SrcExprs[i]);
8621 TransformedExprs.push_back(
Result.get());
8626 if (!HadChange && !getDerived().AlwaysRebuild())
8629 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8630 AsmToks, S->getAsmString(),
8631 S->getNumOutputs(), S->getNumInputs(),
8632 S->getAllConstraints(), S->getClobbers(),
8633 TransformedExprs, S->getEndLoc());
8637template<
typename Derived>
8639TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8641 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8642 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8643 ScopeInfo->NeedsCoroutineSuspends &&
8644 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8645 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8646 "expected clean scope info");
8650 ScopeInfo->setNeedsCoroutineSuspends(
false);
8663 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8664 ScopeInfo->CoroutinePromise = Promise;
8669 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8670 if (InitSuspend.isInvalid())
8673 getDerived().TransformStmt(S->getFinalSuspendStmt());
8674 if (FinalSuspend.isInvalid() ||
8677 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8678 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8680 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8681 if (BodyRes.isInvalid())
8684 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8685 if (Builder.isInvalid())
8688 Expr *ReturnObject = S->getReturnValueInit();
8689 assert(ReturnObject &&
"the return object is expected to be valid");
8690 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8692 if (Res.isInvalid())
8694 Builder.ReturnValue = Res.get();
8699 if (S->hasDependentPromiseType()) {
8702 if (!Promise->getType()->isDependentType()) {
8703 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8704 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8705 "these nodes should not have been built yet");
8706 if (!Builder.buildDependentStatements())
8710 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8711 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8712 if (Res.isInvalid())
8714 Builder.OnFallthrough = Res.get();
8717 if (
auto *OnException = S->getExceptionHandler()) {
8718 StmtResult Res = getDerived().TransformStmt(OnException);
8719 if (Res.isInvalid())
8721 Builder.OnException = Res.get();
8724 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8725 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8726 if (Res.isInvalid())
8728 Builder.ReturnStmtOnAllocFailure = Res.get();
8732 assert(S->getAllocate() && S->getDeallocate() &&
8733 "allocation and deallocation calls must already be built");
8734 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8735 if (AllocRes.isInvalid())
8737 Builder.Allocate = AllocRes.get();
8739 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8740 if (DeallocRes.isInvalid())
8742 Builder.Deallocate = DeallocRes.get();
8744 if (
auto *ResultDecl = S->getResultDecl()) {
8745 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8746 if (Res.isInvalid())
8748 Builder.ResultDecl = Res.get();
8751 if (
auto *ReturnStmt = S->getReturnStmt()) {
8752 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8753 if (Res.isInvalid())
8755 Builder.ReturnStmt = Res.get();
8759 return getDerived().RebuildCoroutineBodyStmt(Builder);
8762template<
typename Derived>
8764TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8772 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8776template <
typename Derived>
8777ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *
E) {
8789 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8790 getSema().getCurScope(),
E->getKeywordLoc());
8794 return getDerived().RebuildCoawaitExpr(
8796 cast<UnresolvedLookupExpr>(Lookup.get()),
E->isImplicit());
8799template <
typename Derived>
8801TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *
E) {
8802 ExprResult OperandResult = getDerived().TransformInitializer(
E->getOperand(),
8804 if (OperandResult.isInvalid())
8807 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8808 E->getOperatorCoawaitLookup());
8810 if (LookupResult.isInvalid())
8815 return getDerived().RebuildDependentCoawaitExpr(
8816 E->getKeywordLoc(), OperandResult.get(),
8817 cast<UnresolvedLookupExpr>(LookupResult.get()));
8820template<
typename Derived>
8822TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *
E) {
8830 return getDerived().RebuildCoyieldExpr(
E->getKeywordLoc(),
Result.get());
8835template<
typename Derived>
8837TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8839 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8840 if (TryBody.isInvalid())
8844 bool AnyCatchChanged =
false;
8846 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8847 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8848 if (Catch.isInvalid())
8850 if (Catch.get() != S->getCatchStmt(I))
8851 AnyCatchChanged =
true;
8852 CatchStmts.push_back(Catch.get());
8857 if (S->getFinallyStmt()) {
8858 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8859 if (Finally.isInvalid())
8864 if (!getDerived().AlwaysRebuild() &&
8865 TryBody.get() == S->getTryBody() &&
8867 Finally.get() == S->getFinallyStmt())
8871 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8872 CatchStmts, Finally.get());
8875template<
typename Derived>
8877TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8879 VarDecl *Var =
nullptr;
8880 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8881 TypeSourceInfo *TSInfo =
nullptr;
8882 if (FromVar->getTypeSourceInfo()) {
8883 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8890 T = TSInfo->getType();
8892 T = getDerived().TransformType(FromVar->getType());
8897 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8902 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8903 if (Body.isInvalid())
8906 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8911template<
typename Derived>
8913TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8915 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8916 if (Body.isInvalid())
8920 if (!getDerived().AlwaysRebuild() &&
8921 Body.get() == S->getFinallyBody())
8925 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8929template<
typename Derived>
8931TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8933 if (S->getThrowExpr()) {
8934 Operand = getDerived().TransformExpr(S->getThrowExpr());
8939 if (!getDerived().AlwaysRebuild() &&
8940 Operand.get() == S->getThrowExpr())
8943 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8946template<
typename Derived>
8948TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8949 ObjCAtSynchronizedStmt *S) {
8955 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8961 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8962 if (Body.isInvalid())
8966 if (!getDerived().AlwaysRebuild() &&
8967 Object.get() == S->getSynchExpr() &&
8968 Body.get() == S->getSynchBody())
8972 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8973 Object.get(), Body.get());
8976template<
typename Derived>
8978TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8979 ObjCAutoreleasePoolStmt *S) {
8981 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8982 if (Body.isInvalid())
8986 if (!getDerived().AlwaysRebuild() &&
8987 Body.get() == S->getSubStmt())
8991 return getDerived().RebuildObjCAutoreleasePoolStmt(
8992 S->getAtLoc(), Body.get());
8995template<
typename Derived>
8997TreeTransform<Derived>::TransformObjCForCollectionStmt(
8998 ObjCForCollectionStmt *S) {
9001 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
9002 if (Element.isInvalid())
9006 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9007 if (Collection.isInvalid())
9011 StmtResult Body = getDerived().TransformStmt(S->getBody());
9012 if (Body.isInvalid())
9016 if (!getDerived().AlwaysRebuild() &&
9017 Element.get() == S->getElement() &&
9018 Collection.get() == S->getCollection() &&
9019 Body.get() == S->getBody())
9023 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9030template <
typename Derived>
9031StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
9033 VarDecl *Var =
nullptr;
9034 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9036 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9040 Var = getDerived().RebuildExceptionDecl(
9041 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9042 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9043 if (!Var || Var->isInvalidDecl())
9048 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9049 if (Handler.isInvalid())
9052 if (!getDerived().AlwaysRebuild() && !Var &&
9053 Handler.get() == S->getHandlerBlock())
9056 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9059template <
typename Derived>
9060StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
9062 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9063 if (TryBlock.isInvalid())
9067 bool HandlerChanged =
false;
9069 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9070 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9071 if (Handler.isInvalid())
9074 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9075 Handlers.push_back(Handler.getAs<Stmt>());
9078 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9082 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9086template<
typename Derived>
9088TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
9089 EnterExpressionEvaluationContext ForRangeInitContext(
9097 auto &LastRecord = getSema().currentEvaluationContext();
9098 LastRecord.InLifetimeExtendingContext =
true;
9099 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9102 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9103 if (
Init.isInvalid())
9112 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9113 auto ForRangeLifetimeExtendTemps =
9114 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9119 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9120 if (End.isInvalid())
9123 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9124 if (Cond.isInvalid())
9128 if (Cond.isInvalid())
9134 if (
Inc.isInvalid())
9139 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9140 if (LoopVar.isInvalid())
9144 if (getDerived().AlwaysRebuild() ||
9145 Init.get() != S->getInit() ||
9146 Range.get() != S->getRangeStmt() ||
9147 Begin.get() != S->getBeginStmt() ||
9148 End.get() != S->getEndStmt() ||
9149 Cond.get() != S->getCond() ||
9150 Inc.get() != S->getInc() ||
9151 LoopVar.get() != S->getLoopVarStmt()) {
9152 NewStmt = getDerived().RebuildCXXForRangeStmt(
9153 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9155 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9156 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9159 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
9166 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
9169 StmtResult Body = getDerived().TransformStmt(S->getBody());
9170 if (Body.isInvalid())
9177 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9178 NewStmt = getDerived().RebuildCXXForRangeStmt(
9179 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9181 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9182 if (NewStmt.isInvalid())
9186 if (NewStmt.get() == S)
9189 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9192template<
typename Derived>
9194TreeTransform<Derived>::TransformMSDependentExistsStmt(
9195 MSDependentExistsStmt *S) {
9197 NestedNameSpecifierLoc QualifierLoc;
9198 if (S->getQualifierLoc()) {
9200 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9206 DeclarationNameInfo NameInfo = S->getNameInfo();
9207 if (NameInfo.getName()) {
9208 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9209 if (!NameInfo.getName())
9214 if (!getDerived().AlwaysRebuild() &&
9215 QualifierLoc == S->getQualifierLoc() &&
9216 NameInfo.getName() == S->getNameInfo().getName())
9221 SS.Adopt(QualifierLoc);
9223 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9225 if (S->isIfExists())
9228 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9231 if (S->isIfNotExists())
9234 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9245 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9246 if (SubStmt.isInvalid())
9254 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9261template<
typename Derived>
9263TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *
E) {
9264 NestedNameSpecifierLoc QualifierLoc;
9265 if (
E->getQualifierLoc()) {
9267 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
9272 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
9273 getDerived().TransformDecl(
E->getMemberLoc(),
E->getPropertyDecl()));
9278 if (
Base.isInvalid())
9282 MSPropertyRefExpr(
Base.get(), PD,
E->isArrow(),
9284 QualifierLoc,
E->getMemberLoc());
9287template <
typename Derived>
9288ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
9289 MSPropertySubscriptExpr *
E) {
9290 auto BaseRes = getDerived().TransformExpr(
E->getBase());
9291 if (BaseRes.isInvalid())
9293 auto IdxRes = getDerived().TransformExpr(
E->getIdx());
9294 if (IdxRes.isInvalid())
9297 if (!getDerived().AlwaysRebuild() &&
9298 BaseRes.get() ==
E->getBase() &&
9299 IdxRes.get() ==
E->getIdx())
9302 return getDerived().RebuildArraySubscriptExpr(
9303 BaseRes.get(), SourceLocation(), IdxRes.get(),
E->getRBracketLoc());
9306template <
typename Derived>
9307StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
9308 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9309 if (TryBlock.isInvalid())
9312 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9313 if (Handler.isInvalid())
9316 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9317 Handler.get() == S->getHandler())
9320 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9321 TryBlock.get(), Handler.get());
9324template <
typename Derived>
9325StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9327 if (
Block.isInvalid())
9330 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9333template <
typename Derived>
9334StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9335 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9336 if (FilterExpr.isInvalid())
9340 if (
Block.isInvalid())
9343 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9347template <
typename Derived>
9349 if (isa<SEHFinallyStmt>(Handler))
9350 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9352 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9355template<
typename Derived>
9365template <
typename Derived>
9367TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9371 return getDerived().TransformStmt(L->getLoopStmt());
9374template <
typename Derived>
9381 TClauses.reserve(Clauses.size());
9385 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9386 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9387 getDerived().getSema().OpenMP().EndOpenMPClause();
9389 TClauses.push_back(Clause);
9391 TClauses.push_back(
nullptr);
9395 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9396 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9397 D->getDirectiveKind(),
9403 if (
D->getDirectiveKind() == OMPD_atomic ||
9404 D->getDirectiveKind() == OMPD_critical ||
9405 D->getDirectiveKind() == OMPD_section ||
9406 D->getDirectiveKind() == OMPD_master)
9407 CS =
D->getAssociatedStmt();
9409 CS =
D->getRawStmt();
9410 Body = getDerived().TransformStmt(CS);
9412 getSema().getLangOpts().OpenMPIRBuilder)
9413 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9416 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9421 if (TClauses.size() != Clauses.size()) {
9427 if (
D->getDirectiveKind() == OMPD_critical) {
9428 DirName = cast<OMPCriticalDirective>(
D)->getDirectiveName();
9429 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9432 if (
D->getDirectiveKind() == OMPD_cancellation_point) {
9433 CancelRegion = cast<OMPCancellationPointDirective>(
D)->getCancelRegion();
9434 }
else if (
D->getDirectiveKind() == OMPD_cancel) {
9435 CancelRegion = cast<OMPCancelDirective>(
D)->getCancelRegion();
9438 return getDerived().RebuildOMPExecutableDirective(
9439 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9448template <
typename Derived>
9455 TClauses.reserve(Clauses.size());
9458 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9459 OMPClause *Clause = getDerived().TransformOMPClause(
C);
9460 getDerived().getSema().OpenMP().EndOpenMPClause();
9462 TClauses.push_back(Clause);
9464 TClauses.push_back(
nullptr);
9468 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9469 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9470 D->getDirectiveKind(),
9475 assert(
D->getDirectiveKind() == OMPD_assume &&
9476 "Unexpected informational directive");
9477 Stmt *CS =
D->getAssociatedStmt();
9478 Body = getDerived().TransformStmt(CS);
9481 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9485 if (TClauses.size() != Clauses.size())
9490 return getDerived().RebuildOMPInformationalDirective(
9491 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9495template <
typename Derived>
9500 << getOpenMPDirectiveName(
D->getDirectiveKind());
9504template <
typename Derived>
9506TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *
D) {
9507 DeclarationNameInfo DirName;
9508 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9510 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9511 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9515template <
typename Derived>
9517TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *
D) {
9518 DeclarationNameInfo DirName;
9519 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9521 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9522 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9526template <
typename Derived>
9528TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *
D) {
9529 DeclarationNameInfo DirName;
9530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9532 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9537template <
typename Derived>
9539TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *
D) {
9540 DeclarationNameInfo DirName;
9541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9543 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9548template <
typename Derived>
9550TreeTransform<Derived>::TransformOMPReverseDirective(OMPReverseDirective *
D) {
9551 DeclarationNameInfo DirName;
9552 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9554 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9555 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9559template <
typename Derived>
9560StmtResult TreeTransform<Derived>::TransformOMPInterchangeDirective(
9561 OMPInterchangeDirective *
D) {
9562 DeclarationNameInfo DirName;
9563 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9565 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9566 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9570template <
typename Derived>
9572TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *
D) {
9573 DeclarationNameInfo DirName;
9574 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9576 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9577 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9581template <
typename Derived>
9583TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *
D) {
9584 DeclarationNameInfo DirName;
9585 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9587 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9588 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9592template <
typename Derived>
9594TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *
D) {
9595 DeclarationNameInfo DirName;
9596 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9598 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9599 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9603template <
typename Derived>
9605TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *
D) {
9606 DeclarationNameInfo DirName;
9607 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9609 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9610 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9614template <
typename Derived>
9616TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *
D) {
9617 DeclarationNameInfo DirName;
9618 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9620 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9621 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9625template <
typename Derived>
9627TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *
D) {
9628 DeclarationNameInfo DirName;
9629 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9631 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9632 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9636template <
typename Derived>
9638TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *
D) {
9639 DeclarationNameInfo DirName;
9640 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9642 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9643 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9647template <
typename Derived>
9649TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *
D) {
9650 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9651 OMPD_critical,
D->getDirectiveName(),
nullptr,
D->
getBeginLoc());
9652 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9653 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9657template <
typename Derived>
9658StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9659 OMPParallelForDirective *
D) {
9660 DeclarationNameInfo DirName;
9661 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9662 OMPD_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9663 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9664 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9668template <
typename Derived>
9669StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9670 OMPParallelForSimdDirective *
D) {
9671 DeclarationNameInfo DirName;
9672 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9673 OMPD_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9674 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9675 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9679template <
typename Derived>
9680StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9681 OMPParallelMasterDirective *
D) {
9682 DeclarationNameInfo DirName;
9683 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9684 OMPD_parallel_master, DirName,
nullptr,
D->
getBeginLoc());
9685 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9686 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9690template <
typename Derived>
9691StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9692 OMPParallelMaskedDirective *
D) {
9693 DeclarationNameInfo DirName;
9694 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9695 OMPD_parallel_masked, DirName,
nullptr,
D->
getBeginLoc());
9696 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9697 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9701template <
typename Derived>
9702StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9703 OMPParallelSectionsDirective *
D) {
9704 DeclarationNameInfo DirName;
9705 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9706 OMPD_parallel_sections, DirName,
nullptr,
D->
getBeginLoc());
9707 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9708 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9712template <
typename Derived>
9714TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *
D) {
9715 DeclarationNameInfo DirName;
9716 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9718 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9719 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9723template <
typename Derived>
9724StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9725 OMPTaskyieldDirective *
D) {
9726 DeclarationNameInfo DirName;
9727 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9729 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9730 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9734template <
typename Derived>
9736TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *
D) {
9737 DeclarationNameInfo DirName;
9738 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9740 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9741 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9745template <
typename Derived>
9747TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *
D) {
9748 DeclarationNameInfo DirName;
9749 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9751 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9752 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9756template <
typename Derived>
9758TreeTransform<Derived>::TransformOMPAssumeDirective(OMPAssumeDirective *
D) {
9759 DeclarationNameInfo DirName;
9760 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9762 StmtResult Res = getDerived().TransformOMPInformationalDirective(
D);
9763 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9767template <
typename Derived>
9769TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *
D) {
9770 DeclarationNameInfo DirName;
9771 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9773 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9774 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9778template <
typename Derived>
9779StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9780 OMPTaskgroupDirective *
D) {
9781 DeclarationNameInfo DirName;
9782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9784 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9789template <
typename Derived>
9791TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *
D) {
9792 DeclarationNameInfo DirName;
9793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9795 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9796 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9800template <
typename Derived>
9802TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *
D) {
9803 DeclarationNameInfo DirName;
9804 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9806 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9807 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9811template <
typename Derived>
9813TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *
D) {
9814 DeclarationNameInfo DirName;
9815 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9817 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9818 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9822template <
typename Derived>
9824TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *
D) {
9825 DeclarationNameInfo DirName;
9826 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9828 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9829 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9833template <
typename Derived>
9835TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *
D) {
9836 DeclarationNameInfo DirName;
9837 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9839 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9840 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9844template <
typename Derived>
9846TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *
D) {
9847 DeclarationNameInfo DirName;
9848 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9850 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9851 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9855template <
typename Derived>
9856StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9857 OMPTargetDataDirective *
D) {
9858 DeclarationNameInfo DirName;
9859 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9861 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9862 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9866template <
typename Derived>
9867StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9868 OMPTargetEnterDataDirective *
D) {
9869 DeclarationNameInfo DirName;
9870 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9871 OMPD_target_enter_data, DirName,
nullptr,
D->
getBeginLoc());
9872 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9873 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9877template <
typename Derived>
9878StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9879 OMPTargetExitDataDirective *
D) {
9880 DeclarationNameInfo DirName;
9881 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9882 OMPD_target_exit_data, DirName,
nullptr,
D->
getBeginLoc());
9883 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9884 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9888template <
typename Derived>
9889StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9890 OMPTargetParallelDirective *
D) {
9891 DeclarationNameInfo DirName;
9892 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9893 OMPD_target_parallel, DirName,
nullptr,
D->
getBeginLoc());
9894 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9895 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9899template <
typename Derived>
9900StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9901 OMPTargetParallelForDirective *
D) {
9902 DeclarationNameInfo DirName;
9903 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9904 OMPD_target_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9905 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9906 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9910template <
typename Derived>
9911StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9912 OMPTargetUpdateDirective *
D) {
9913 DeclarationNameInfo DirName;
9914 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9915 OMPD_target_update, DirName,
nullptr,
D->
getBeginLoc());
9916 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9917 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9921template <
typename Derived>
9923TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *
D) {
9924 DeclarationNameInfo DirName;
9925 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9927 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9928 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9932template <
typename Derived>
9933StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9934 OMPCancellationPointDirective *
D) {
9935 DeclarationNameInfo DirName;
9936 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9937 OMPD_cancellation_point, DirName,
nullptr,
D->
getBeginLoc());
9938 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9939 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9943template <
typename Derived>
9945TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *
D) {
9946 DeclarationNameInfo DirName;
9947 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9949 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9950 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9954template <
typename Derived>
9956TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *
D) {
9957 DeclarationNameInfo DirName;
9958 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9960 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9961 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9965template <
typename Derived>
9966StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9967 OMPTaskLoopSimdDirective *
D) {
9968 DeclarationNameInfo DirName;
9969 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9970 OMPD_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9971 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9972 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9976template <
typename Derived>
9977StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9978 OMPMasterTaskLoopDirective *
D) {
9979 DeclarationNameInfo DirName;
9980 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9981 OMPD_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9982 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9983 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9987template <
typename Derived>
9988StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
9989 OMPMaskedTaskLoopDirective *
D) {
9990 DeclarationNameInfo DirName;
9991 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9992 OMPD_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9993 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9994 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9998template <
typename Derived>
9999StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
10000 OMPMasterTaskLoopSimdDirective *
D) {
10001 DeclarationNameInfo DirName;
10002 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10003 OMPD_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10004 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10005 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10009template <
typename Derived>
10010StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
10011 OMPMaskedTaskLoopSimdDirective *
D) {
10012 DeclarationNameInfo DirName;
10013 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10014 OMPD_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10015 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10016 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10020template <
typename Derived>
10021StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
10022 OMPParallelMasterTaskLoopDirective *
D) {
10023 DeclarationNameInfo DirName;
10024 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10025 OMPD_parallel_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10026 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10027 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10031template <
typename Derived>
10032StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
10033 OMPParallelMaskedTaskLoopDirective *
D) {
10034 DeclarationNameInfo DirName;
10035 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10036 OMPD_parallel_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10037 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10038 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10042template <
typename Derived>
10044TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
10045 OMPParallelMasterTaskLoopSimdDirective *
D) {
10046 DeclarationNameInfo DirName;
10047 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10048 OMPD_parallel_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10049 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10050 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10054template <
typename Derived>
10056TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
10057 OMPParallelMaskedTaskLoopSimdDirective *
D) {
10058 DeclarationNameInfo DirName;
10059 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10060 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10061 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10062 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10066template <
typename Derived>
10067StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
10068 OMPDistributeDirective *
D) {
10069 DeclarationNameInfo DirName;
10070 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10072 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10073 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10077template <
typename Derived>
10078StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
10079 OMPDistributeParallelForDirective *
D) {
10080 DeclarationNameInfo DirName;
10081 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10082 OMPD_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10083 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10084 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10088template <
typename Derived>
10090TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
10091 OMPDistributeParallelForSimdDirective *
D) {
10092 DeclarationNameInfo DirName;
10093 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10094 OMPD_distribute_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10095 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10096 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10100template <
typename Derived>
10101StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
10102 OMPDistributeSimdDirective *
D) {
10103 DeclarationNameInfo DirName;
10104 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10105 OMPD_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10106 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10107 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10111template <
typename Derived>
10112StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
10113 OMPTargetParallelForSimdDirective *
D) {
10114 DeclarationNameInfo DirName;
10115 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10116 OMPD_target_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10117 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10118 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10122template <
typename Derived>
10123StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
10124 OMPTargetSimdDirective *
D) {
10125 DeclarationNameInfo DirName;
10126 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10127 OMPD_target_simd, DirName,
nullptr,
D->
getBeginLoc());
10128 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10129 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10133template <
typename Derived>
10134StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
10135 OMPTeamsDistributeDirective *
D) {
10136 DeclarationNameInfo DirName;
10137 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10138 OMPD_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10139 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10140 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10144template <
typename Derived>
10145StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
10146 OMPTeamsDistributeSimdDirective *
D) {
10147 DeclarationNameInfo DirName;
10148 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10149 OMPD_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10150 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10151 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10155template <
typename Derived>
10156StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
10157 OMPTeamsDistributeParallelForSimdDirective *
D) {
10158 DeclarationNameInfo DirName;
10159 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10160 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10162 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10163 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10167template <
typename Derived>
10168StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
10169 OMPTeamsDistributeParallelForDirective *
D) {
10170 DeclarationNameInfo DirName;
10171 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10172 OMPD_teams_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10173 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10174 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10178template <
typename Derived>
10179StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
10180 OMPTargetTeamsDirective *
D) {
10181 DeclarationNameInfo DirName;
10182 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10183 OMPD_target_teams, DirName,
nullptr,
D->
getBeginLoc());
10184 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10185 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10189template <
typename Derived>
10190StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
10191 OMPTargetTeamsDistributeDirective *
D) {
10192 DeclarationNameInfo DirName;
10193 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10194 OMPD_target_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10195 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10196 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10200template <
typename Derived>
10202TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
10203 OMPTargetTeamsDistributeParallelForDirective *
D) {
10204 DeclarationNameInfo DirName;
10205 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10206 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10208 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10209 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10213template <
typename Derived>
10215 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
10216 OMPTargetTeamsDistributeParallelForSimdDirective *
D) {
10217 DeclarationNameInfo DirName;
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10221 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10222 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10226template <
typename Derived>
10228TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
10229 OMPTargetTeamsDistributeSimdDirective *
D) {
10230 DeclarationNameInfo DirName;
10231 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10232 OMPD_target_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10233 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10234 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10238template <
typename Derived>
10240TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *
D) {
10241 DeclarationNameInfo DirName;
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10244 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10249template <
typename Derived>
10251TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *
D) {
10252 DeclarationNameInfo DirName;
10253 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10255 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10256 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10260template <
typename Derived>
10262TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *
D) {
10263 DeclarationNameInfo DirName;
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10266 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10272StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
10273 OMPGenericLoopDirective *
D) {
10274 DeclarationNameInfo DirName;
10275 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10277 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10278 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10282template <
typename Derived>
10283StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
10284 OMPTeamsGenericLoopDirective *
D) {
10285 DeclarationNameInfo DirName;
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10294StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
10295 OMPTargetTeamsGenericLoopDirective *
D) {
10296 DeclarationNameInfo DirName;
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_target_teams_loop, DirName,
nullptr,
D->
getBeginLoc());
10299 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10304template <
typename Derived>
10305StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
10306 OMPParallelGenericLoopDirective *
D) {
10307 DeclarationNameInfo DirName;
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10310 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10317TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
10318 OMPTargetParallelGenericLoopDirective *
D) {
10319 DeclarationNameInfo DirName;
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_target_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10322 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10323 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10330template <
typename Derived>
10331OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
10332 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10333 if (Cond.isInvalid())
10335 return getDerived().RebuildOMPIfClause(
10336 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10337 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10340template <
typename Derived>
10341OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
10342 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10343 if (Cond.isInvalid())
10345 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10346 C->getLParenLoc(),
C->getEndLoc());
10349template <
typename Derived>
10351TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
10352 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10353 if (NumThreads.isInvalid())
10355 return getDerived().RebuildOMPNumThreadsClause(
10356 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10359template <
typename Derived>
10361TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
10362 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10365 return getDerived().RebuildOMPSafelenClause(
10366 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10369template <
typename Derived>
10371TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
10372 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10375 return getDerived().RebuildOMPAllocatorClause(
10376 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10379template <
typename Derived>
10381TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
10382 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10385 return getDerived().RebuildOMPSimdlenClause(
10386 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10389template <
typename Derived>
10390OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
10392 TransformedSizes.reserve(
C->getNumSizes());
10394 for (Expr *
E :
C->getSizesRefs()) {
10396 TransformedSizes.push_back(
nullptr);
10405 TransformedSizes.push_back(
T.get());
10408 if (!Changed && !getDerived().AlwaysRebuild())
10410 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10411 C->getLParenLoc(),
C->getEndLoc());
10414template <
typename Derived>
10416TreeTransform<Derived>::TransformOMPPermutationClause(OMPPermutationClause *
C) {
10418 TransformedArgs.reserve(
C->getNumLoops());
10420 for (Expr *
E :
C->getArgsRefs()) {
10422 TransformedArgs.push_back(
nullptr);
10431 TransformedArgs.push_back(
T.get());
10434 if (!Changed && !getDerived().AlwaysRebuild())
10436 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10437 C->getLParenLoc(),
C->getEndLoc());
10440template <
typename Derived>
10441OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10442 if (!getDerived().AlwaysRebuild())
10444 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10447template <
typename Derived>
10449TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10450 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10453 Expr *Factor =
T.get();
10454 bool Changed = Factor !=
C->getFactor();
10456 if (!Changed && !getDerived().AlwaysRebuild())
10458 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10462template <
typename Derived>
10464TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10465 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10468 return getDerived().RebuildOMPCollapseClause(
10469 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10472template <
typename Derived>
10474TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10475 return getDerived().RebuildOMPDefaultClause(
10476 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10477 C->getLParenLoc(),
C->getEndLoc());
10480template <
typename Derived>
10482TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10483 return getDerived().RebuildOMPProcBindClause(
10484 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10485 C->getLParenLoc(),
C->getEndLoc());
10488template <
typename Derived>
10490TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10491 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10494 return getDerived().RebuildOMPScheduleClause(
10495 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10496 C->getScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10497 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10498 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10501template <
typename Derived>
10503TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10505 if (
auto *
Num =
C->getNumForLoops()) {
10506 E = getDerived().TransformExpr(
Num);
10510 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10511 C->getLParenLoc(),
E.get());
10514template <
typename Derived>
10516TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10518 if (Expr *Evt =
C->getEventHandler()) {
10519 E = getDerived().TransformExpr(Evt);
10523 return getDerived().RebuildOMPDetachClause(
E.get(),
C->getBeginLoc(),
10524 C->getLParenLoc(),
C->getEndLoc());
10527template <
typename Derived>
10529TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10534template <
typename Derived>
10536TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10541template <
typename Derived>
10543TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10548template <
typename Derived>
10549OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10554template <
typename Derived>
10555OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10560template <
typename Derived>
10562TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10567template <
typename Derived>
10569TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10574template <
typename Derived>
10576TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10581template <
typename Derived>
10582OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10587template <
typename Derived>
10589TreeTransform<Derived>::TransformOMPAbsentClause(OMPAbsentClause *
C) {
10593template <
typename Derived>
10594OMPClause *TreeTransform<Derived>::TransformOMPHoldsClause(OMPHoldsClause *
C) {
10595 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10598 return getDerived().RebuildOMPHoldsClause(
E.get(),
C->getBeginLoc(),
10599 C->getLParenLoc(),
C->getEndLoc());
10602template <
typename Derived>
10604TreeTransform<Derived>::TransformOMPContainsClause(OMPContainsClause *
C) {
10608template <
typename Derived>
10610TreeTransform<Derived>::TransformOMPNoOpenMPClause(OMPNoOpenMPClause *
C) {
10613template <
typename Derived>
10614OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPRoutinesClause(
10615 OMPNoOpenMPRoutinesClause *
C) {
10618template <
typename Derived>
10619OMPClause *TreeTransform<Derived>::TransformOMPNoParallelismClause(
10620 OMPNoParallelismClause *
C) {
10624template <
typename Derived>
10626TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10631template <
typename Derived>
10633TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10638template <
typename Derived>
10640TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10645template <
typename Derived>
10647TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10652template <
typename Derived>
10654TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10659template <
typename Derived>
10660OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10665template <
typename Derived>
10667TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10672template <
typename Derived>
10673OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10678template <
typename Derived>
10680TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10685template <
typename Derived>
10686OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10687 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10688 if (IVR.isInvalid())
10691 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10692 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10693 for (Expr *
E : llvm::drop_begin(
C->varlist())) {
10694 ExprResult ER = getDerived().TransformExpr(cast<Expr>(
E));
10695 if (ER.isInvalid())
10697 InteropInfo.PreferTypes.push_back(ER.get());
10699 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10700 C->getBeginLoc(),
C->getLParenLoc(),
10701 C->getVarLoc(),
C->getEndLoc());
10704template <
typename Derived>
10705OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10706 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10707 if (ER.isInvalid())
10709 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10710 C->getLParenLoc(),
C->getVarLoc(),
10714template <
typename Derived>
10716TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10718 if (Expr *IV =
C->getInteropVar()) {
10719 ER = getDerived().TransformExpr(IV);
10720 if (ER.isInvalid())
10723 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10724 C->getLParenLoc(),
C->getVarLoc(),
10728template <
typename Derived>
10730TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10731 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10732 if (Cond.isInvalid())
10734 return getDerived().RebuildOMPNovariantsClause(
10735 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10738template <
typename Derived>
10740TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10741 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10742 if (Cond.isInvalid())
10744 return getDerived().RebuildOMPNocontextClause(
10745 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10748template <
typename Derived>
10750TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10751 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10752 if (ThreadID.isInvalid())
10754 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10755 C->getLParenLoc(),
C->getEndLoc());
10758template <
typename Derived>
10759OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10760 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10763 return getDerived().RebuildOMPAlignClause(
E.get(),
C->getBeginLoc(),
10764 C->getLParenLoc(),
C->getEndLoc());
10767template <
typename Derived>
10768OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10769 OMPUnifiedAddressClause *
C) {
10770 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10773template <
typename Derived>
10774OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10775 OMPUnifiedSharedMemoryClause *
C) {
10777 "unified_shared_memory clause cannot appear in dependent context");
10780template <
typename Derived>
10781OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10782 OMPReverseOffloadClause *
C) {
10783 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10786template <
typename Derived>
10787OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10788 OMPDynamicAllocatorsClause *
C) {
10790 "dynamic_allocators clause cannot appear in dependent context");
10793template <
typename Derived>
10794OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10795 OMPAtomicDefaultMemOrderClause *
C) {
10797 "atomic_default_mem_order clause cannot appear in dependent context");
10800template <
typename Derived>
10801OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10802 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10803 C->getBeginLoc(),
C->getLParenLoc(),
10807template <
typename Derived>
10809TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10810 return getDerived().RebuildOMPSeverityClause(
10811 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10812 C->getLParenLoc(),
C->getEndLoc());
10815template <
typename Derived>
10817TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10818 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10821 return getDerived().RebuildOMPMessageClause(
10822 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10826template <
typename Derived>
10828TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10830 Vars.reserve(
C->varlist_size());
10831 for (
auto *VE :
C->varlist()) {
10832 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10833 if (EVar.isInvalid())
10835 Vars.push_back(EVar.get());
10837 return getDerived().RebuildOMPPrivateClause(
10838 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10841template <
typename Derived>
10842OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10843 OMPFirstprivateClause *
C) {
10845 Vars.reserve(
C->varlist_size());
10846 for (
auto *VE :
C->varlist()) {
10847 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10848 if (EVar.isInvalid())
10850 Vars.push_back(EVar.get());
10852 return getDerived().RebuildOMPFirstprivateClause(
10853 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10856template <
typename Derived>
10858TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10860 Vars.reserve(
C->varlist_size());
10861 for (
auto *VE :
C->varlist()) {
10862 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10863 if (EVar.isInvalid())
10865 Vars.push_back(EVar.get());
10867 return getDerived().RebuildOMPLastprivateClause(
10868 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10869 C->getLParenLoc(),
C->getEndLoc());
10872template <
typename Derived>
10874TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10876 Vars.reserve(
C->varlist_size());
10877 for (
auto *VE :
C->varlist()) {
10878 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10879 if (EVar.isInvalid())
10881 Vars.push_back(EVar.get());
10883 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10884 C->getLParenLoc(),
C->getEndLoc());
10887template <
typename Derived>
10889TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10891 Vars.reserve(
C->varlist_size());
10892 for (
auto *VE :
C->varlist()) {
10893 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10894 if (EVar.isInvalid())
10896 Vars.push_back(EVar.get());
10898 CXXScopeSpec ReductionIdScopeSpec;
10899 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10901 DeclarationNameInfo NameInfo =
C->getNameInfo();
10902 if (NameInfo.getName()) {
10903 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10904 if (!NameInfo.getName())
10910 for (
auto *
E :
C->reduction_ops()) {
10913 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10914 UnresolvedSet<8> Decls;
10915 for (
auto *
D : ULE->decls()) {
10917 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10918 Decls.addDecl(InstD, InstD->getAccess());
10922 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10923 true, Decls.begin(), Decls.end(),
10926 UnresolvedReductions.push_back(
nullptr);
10928 return getDerived().RebuildOMPReductionClause(
10929 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10930 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10931 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10934template <
typename Derived>
10935OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10936 OMPTaskReductionClause *
C) {
10938 Vars.reserve(
C->varlist_size());
10939 for (
auto *VE :
C->varlist()) {
10940 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10941 if (EVar.isInvalid())
10943 Vars.push_back(EVar.get());
10945 CXXScopeSpec ReductionIdScopeSpec;
10946 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10948 DeclarationNameInfo NameInfo =
C->getNameInfo();
10949 if (NameInfo.getName()) {
10950 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10951 if (!NameInfo.getName())
10957 for (
auto *
E :
C->reduction_ops()) {
10960 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10961 UnresolvedSet<8> Decls;
10962 for (
auto *
D : ULE->decls()) {
10964 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10965 Decls.addDecl(InstD, InstD->getAccess());
10969 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10970 true, Decls.begin(), Decls.end(),
10973 UnresolvedReductions.push_back(
nullptr);
10975 return getDerived().RebuildOMPTaskReductionClause(
10976 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10977 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10980template <
typename Derived>
10982TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10984 Vars.reserve(
C->varlist_size());
10985 for (
auto *VE :
C->varlist()) {
10986 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10987 if (EVar.isInvalid())
10989 Vars.push_back(EVar.get());
10991 CXXScopeSpec ReductionIdScopeSpec;
10992 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10994 DeclarationNameInfo NameInfo =
C->getNameInfo();
10995 if (NameInfo.getName()) {
10996 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10997 if (!NameInfo.getName())
11003 for (
auto *
E :
C->reduction_ops()) {
11006 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11007 UnresolvedSet<8> Decls;
11008 for (
auto *
D : ULE->decls()) {
11010 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
11011 Decls.addDecl(InstD, InstD->getAccess());
11015 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11016 true, Decls.begin(), Decls.end(),
11019 UnresolvedReductions.push_back(
nullptr);
11021 return getDerived().RebuildOMPInReductionClause(
11022 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11023 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11026template <
typename Derived>
11028TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
11030 Vars.reserve(
C->varlist_size());
11031 for (
auto *VE :
C->varlist()) {
11032 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11033 if (EVar.isInvalid())
11035 Vars.push_back(EVar.get());
11037 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11038 if (Step.isInvalid())
11040 return getDerived().RebuildOMPLinearClause(
11041 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11042 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11046template <
typename Derived>
11048TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
11050 Vars.reserve(
C->varlist_size());
11051 for (
auto *VE :
C->varlist()) {
11052 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11053 if (EVar.isInvalid())
11055 Vars.push_back(EVar.get());
11057 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11058 if (Alignment.isInvalid())
11060 return getDerived().RebuildOMPAlignedClause(
11061 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11062 C->getColonLoc(),
C->getEndLoc());
11065template <
typename Derived>
11067TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
11069 Vars.reserve(
C->varlist_size());
11070 for (
auto *VE :
C->varlist()) {
11071 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11072 if (EVar.isInvalid())
11074 Vars.push_back(EVar.get());
11076 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11077 C->getLParenLoc(),
C->getEndLoc());
11080template <
typename Derived>
11082TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
11084 Vars.reserve(
C->varlist_size());
11085 for (
auto *VE :
C->varlist()) {
11086 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11087 if (EVar.isInvalid())
11089 Vars.push_back(EVar.get());
11091 return getDerived().RebuildOMPCopyprivateClause(
11092 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11095template <
typename Derived>
11096OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
11098 Vars.reserve(
C->varlist_size());
11099 for (
auto *VE :
C->varlist()) {
11100 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11101 if (EVar.isInvalid())
11103 Vars.push_back(EVar.get());
11105 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11106 C->getLParenLoc(),
C->getEndLoc());
11109template <
typename Derived>
11111TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
11112 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11115 return getDerived().RebuildOMPDepobjClause(
E.get(),
C->getBeginLoc(),
11116 C->getLParenLoc(),
C->getEndLoc());
11119template <
typename Derived>
11121TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
11123 Expr *DepModifier =
C->getModifier();
11125 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11126 if (DepModRes.isInvalid())
11128 DepModifier = DepModRes.
get();
11130 Vars.reserve(
C->varlist_size());
11131 for (
auto *VE :
C->varlist()) {
11132 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11133 if (EVar.isInvalid())
11135 Vars.push_back(EVar.get());
11137 return getDerived().RebuildOMPDependClause(
11138 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11139 C->getOmpAllMemoryLoc()},
11140 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11143template <
typename Derived>
11145TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
11146 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11149 return getDerived().RebuildOMPDeviceClause(
11150 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11151 C->getModifierLoc(),
C->getEndLoc());
11154template <
typename Derived,
class T>
11161 Vars.reserve(
C->varlist_size());
11162 for (
auto *VE :
C->varlist()) {
11166 Vars.push_back(EVar.
get());
11170 if (
C->getMapperQualifierLoc()) {
11171 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11172 C->getMapperQualifierLoc());
11176 MapperIdScopeSpec.
Adopt(QualifierLoc);
11177 MapperIdInfo =
C->getMapperIdInfo();
11178 if (MapperIdInfo.
getName()) {
11179 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11185 for (
auto *
E :
C->mapperlists()) {
11188 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11190 for (
auto *
D : ULE->decls()) {
11198 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
11201 UnresolvedMappers.push_back(
nullptr);
11207template <
typename Derived>
11208OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11209 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11211 Expr *IteratorModifier =
C->getIteratorModifier();
11212 if (IteratorModifier) {
11213 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11214 if (MapModRes.isInvalid())
11216 IteratorModifier = MapModRes.
get();
11218 CXXScopeSpec MapperIdScopeSpec;
11219 DeclarationNameInfo MapperIdInfo;
11221 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
11222 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11224 return getDerived().RebuildOMPMapClause(
11225 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11226 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11227 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11230template <
typename Derived>
11232TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
11233 Expr *Allocator =
C->getAllocator();
11235 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11236 if (AllocatorRes.isInvalid())
11238 Allocator = AllocatorRes.get();
11240 Expr *Alignment =
C->getAlignment();
11242 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11243 if (AlignmentRes.isInvalid())
11245 Alignment = AlignmentRes.
get();
11248 Vars.reserve(
C->varlist_size());
11249 for (
auto *VE :
C->varlist()) {
11250 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11251 if (EVar.isInvalid())
11253 Vars.push_back(EVar.get());
11255 return getDerived().RebuildOMPAllocateClause(
11256 Allocator, Alignment,
C->getFirstAllocateModifier(),
11257 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11258 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11259 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11262template <
typename Derived>
11264TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
11266 Vars.reserve(
C->varlist_size());
11267 for (
auto *VE :
C->varlist()) {
11268 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11269 if (EVar.isInvalid())
11271 Vars.push_back(EVar.get());
11273 return getDerived().RebuildOMPNumTeamsClause(
11274 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11277template <
typename Derived>
11279TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
11281 Vars.reserve(
C->varlist_size());
11282 for (
auto *VE :
C->varlist()) {
11283 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11284 if (EVar.isInvalid())
11286 Vars.push_back(EVar.get());
11288 return getDerived().RebuildOMPThreadLimitClause(
11289 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11292template <
typename Derived>
11294TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
11295 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11298 return getDerived().RebuildOMPPriorityClause(
11299 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11302template <
typename Derived>
11304TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
11305 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11308 return getDerived().RebuildOMPGrainsizeClause(
11309 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11310 C->getModifierLoc(),
C->getEndLoc());
11313template <
typename Derived>
11315TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
11316 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11319 return getDerived().RebuildOMPNumTasksClause(
11320 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11321 C->getModifierLoc(),
C->getEndLoc());
11324template <
typename Derived>
11325OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
11326 ExprResult E = getDerived().TransformExpr(
C->getHint());
11329 return getDerived().RebuildOMPHintClause(
E.get(),
C->getBeginLoc(),
11330 C->getLParenLoc(),
C->getEndLoc());
11333template <
typename Derived>
11334OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
11335 OMPDistScheduleClause *
C) {
11336 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11339 return getDerived().RebuildOMPDistScheduleClause(
11340 C->getDistScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11341 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11344template <
typename Derived>
11346TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
11349 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
11350 C->getDefaultmapKind(),
11353 C->getDefaultmapModifierLoc(),
11354 C->getDefaultmapKindLoc(),
11358template <
typename Derived>
11359OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
11360 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11362 CXXScopeSpec MapperIdScopeSpec;
11363 DeclarationNameInfo MapperIdInfo;
11365 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
11366 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11368 return getDerived().RebuildOMPToClause(
11369 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11370 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11373template <
typename Derived>
11374OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
11375 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11377 CXXScopeSpec MapperIdScopeSpec;
11378 DeclarationNameInfo MapperIdInfo;
11380 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
11381 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11383 return getDerived().RebuildOMPFromClause(
11384 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11385 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11388template <
typename Derived>
11389OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
11390 OMPUseDevicePtrClause *
C) {
11392 Vars.reserve(
C->varlist_size());
11393 for (
auto *VE :
C->varlist()) {
11394 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11395 if (EVar.isInvalid())
11397 Vars.push_back(EVar.get());
11399 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11400 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11403template <
typename Derived>
11404OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
11405 OMPUseDeviceAddrClause *
C) {
11407 Vars.reserve(
C->varlist_size());
11408 for (
auto *VE :
C->varlist()) {
11409 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11410 if (EVar.isInvalid())
11412 Vars.push_back(EVar.get());
11414 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11415 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11418template <
typename Derived>
11420TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
11422 Vars.reserve(
C->varlist_size());
11423 for (
auto *VE :
C->varlist()) {
11424 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11425 if (EVar.isInvalid())
11427 Vars.push_back(EVar.get());
11429 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11430 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11433template <
typename Derived>
11434OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
11435 OMPHasDeviceAddrClause *
C) {
11437 Vars.reserve(
C->varlist_size());
11438 for (
auto *VE :
C->varlist()) {
11439 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11440 if (EVar.isInvalid())
11442 Vars.push_back(EVar.get());
11444 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11445 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11448template <
typename Derived>
11450TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
11452 Vars.reserve(
C->varlist_size());
11453 for (
auto *VE :
C->varlist()) {
11454 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11455 if (EVar.isInvalid())
11457 Vars.push_back(EVar.get());
11459 return getDerived().RebuildOMPNontemporalClause(
11460 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11463template <
typename Derived>
11465TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
11467 Vars.reserve(
C->varlist_size());
11468 for (
auto *VE :
C->varlist()) {
11469 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11470 if (EVar.isInvalid())
11472 Vars.push_back(EVar.get());
11474 return getDerived().RebuildOMPInclusiveClause(
11475 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11478template <
typename Derived>
11480TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
11482 Vars.reserve(
C->varlist_size());
11483 for (
auto *VE :
C->varlist()) {
11484 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11485 if (EVar.isInvalid())
11487 Vars.push_back(EVar.get());
11489 return getDerived().RebuildOMPExclusiveClause(
11490 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11493template <
typename Derived>
11494OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11495 OMPUsesAllocatorsClause *
C) {
11497 Data.reserve(
C->getNumberOfAllocators());
11498 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
11499 OMPUsesAllocatorsClause::Data
D =
C->getAllocatorData(I);
11500 ExprResult Allocator = getDerived().TransformExpr(
D.Allocator);
11501 if (Allocator.isInvalid())
11504 if (Expr *AT =
D.AllocatorTraits) {
11505 AllocatorTraits = getDerived().TransformExpr(AT);
11506 if (AllocatorTraits.isInvalid())
11509 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11510 NewD.Allocator = Allocator.get();
11511 NewD.AllocatorTraits = AllocatorTraits.get();
11512 NewD.LParenLoc =
D.LParenLoc;
11513 NewD.RParenLoc =
D.RParenLoc;
11515 return getDerived().RebuildOMPUsesAllocatorsClause(
11516 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11519template <
typename Derived>
11521TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11523 Locators.reserve(
C->varlist_size());
11525 if (Expr *Modifier =
C->getModifier()) {
11526 ModifierRes = getDerived().TransformExpr(Modifier);
11527 if (ModifierRes.isInvalid())
11530 for (Expr *
E :
C->varlist()) {
11531 ExprResult Locator = getDerived().TransformExpr(
E);
11532 if (Locator.isInvalid())
11534 Locators.push_back(Locator.get());
11536 return getDerived().RebuildOMPAffinityClause(
11537 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11538 ModifierRes.get(), Locators);
11541template <
typename Derived>
11542OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11543 return getDerived().RebuildOMPOrderClause(
11544 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11545 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11548template <
typename Derived>
11549OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11550 return getDerived().RebuildOMPBindClause(
11551 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11552 C->getLParenLoc(),
C->getEndLoc());
11555template <
typename Derived>
11556OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11557 OMPXDynCGroupMemClause *
C) {
11559 if (
Size.isInvalid())
11561 return getDerived().RebuildOMPXDynCGroupMemClause(
11562 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11565template <
typename Derived>
11567TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11569 Vars.reserve(
C->varlist_size());
11570 for (
auto *VE :
C->varlist()) {
11571 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11572 if (EVar.isInvalid())
11574 Vars.push_back(EVar.get());
11576 return getDerived().RebuildOMPDoacrossClause(
11577 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11578 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11581template <
typename Derived>
11583TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11585 for (
auto *A :
C->getAttrs())
11586 NewAttrs.push_back(getDerived().TransformAttr(A));
11587 return getDerived().RebuildOMPXAttributeClause(
11588 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11591template <
typename Derived>
11592OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11593 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11600template <
typename Derived>
11601class OpenACCClauseTransform final
11602 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11603 TreeTransform<Derived> &Self;
11605 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11606 OpenACCClause *NewClause =
nullptr;
11610 for (Expr *CurVar : VarList) {
11611 ExprResult Res = Self.TransformExpr(CurVar);
11613 if (!Res.isUsable())
11616 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getClauseKind(),
11619 if (Res.isUsable())
11620 InstantiatedVarList.push_back(Res.get());
11623 return InstantiatedVarList;
11627 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11629 SemaOpenACC::OpenACCParsedClause &PC)
11630 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11632 OpenACCClause *CreatedClause()
const {
return NewClause; }
11634#define VISIT_CLAUSE(CLAUSE_NAME) \
11635 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11636#include "clang/Basic/OpenACCClauses.def"
11639template <
typename Derived>
11640void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11641 const OpenACCDefaultClause &
C) {
11650template <
typename Derived>
11651void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11652 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11653 assert(Cond &&
"If constructed with invalid Condition");
11654 Sema::ConditionResult Res =
Self.TransformCondition(
11657 if (Res.isInvalid() || !Res.get().second)
11668template <
typename Derived>
11669void OpenACCClauseTransform<Derived>::VisitSelfClause(
11670 const OpenACCSelfClause &
C) {
11675 for (Expr *CurVar :
C.getVarList()) {
11678 if (!Res.isUsable())
11684 if (Res.isUsable())
11685 InstantiatedVarList.push_back(Res.get());
11697 if (
C.hasConditionExpr()) {
11698 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11699 Sema::ConditionResult Res =
11700 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11703 if (Res.isInvalid() || !Res.get().second)
11716template <
typename Derived>
11717void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11718 const OpenACCNumGangsClause &
C) {
11721 for (Expr *CurIntExpr :
C.getIntExprs()) {
11724 if (!Res.isUsable())
11729 C.getBeginLoc(), Res.get());
11730 if (!Res.isUsable())
11733 InstantiatedIntExprs.push_back(Res.get());
11743template <
typename Derived>
11744void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11745 const OpenACCPrivateClause &
C) {
11755template <
typename Derived>
11756void OpenACCClauseTransform<Derived>::VisitHostClause(
11757 const OpenACCHostClause &
C) {
11767template <
typename Derived>
11768void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11769 const OpenACCDeviceClause &
C) {
11779template <
typename Derived>
11780void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11781 const OpenACCFirstPrivateClause &
C) {
11791template <
typename Derived>
11792void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11793 const OpenACCNoCreateClause &
C) {
11803template <
typename Derived>
11804void OpenACCClauseTransform<Derived>::VisitPresentClause(
11805 const OpenACCPresentClause &
C) {
11815template <
typename Derived>
11816void OpenACCClauseTransform<Derived>::VisitCopyClause(
11817 const OpenACCCopyClause &
C) {
11827template <
typename Derived>
11828void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11829 const OpenACCCopyInClause &
C) {
11840template <
typename Derived>
11841void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11842 const OpenACCCopyOutClause &
C) {
11844 false,
C.isZero());
11853template <
typename Derived>
11854void OpenACCClauseTransform<Derived>::VisitCreateClause(
11855 const OpenACCCreateClause &
C) {
11857 false,
C.isZero());
11865template <
typename Derived>
11866void OpenACCClauseTransform<Derived>::VisitAttachClause(
11867 const OpenACCAttachClause &
C) {
11871 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11872 return Self.getSema().OpenACC().CheckVarIsPointerType(
11873 OpenACCClauseKind::Attach, E);
11874 }), VarList.end());
11884template <
typename Derived>
11885void OpenACCClauseTransform<Derived>::VisitDetachClause(
11886 const OpenACCDetachClause &
C) {
11891 std::remove_if(VarList.begin(), VarList.end(),
11893 return Self.getSema().OpenACC().CheckVarIsPointerType(
11894 OpenACCClauseKind::Detach, E);
11906template <
typename Derived>
11907void OpenACCClauseTransform<Derived>::VisitDeleteClause(
11908 const OpenACCDeleteClause &
C) {
11917template <
typename Derived>
11918void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
11919 const OpenACCUseDeviceClause &
C) {
11928template <
typename Derived>
11929void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
11930 const OpenACCDevicePtrClause &
C) {
11934 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11935 return Self.getSema().OpenACC().CheckVarIsPointerType(
11936 OpenACCClauseKind::DevicePtr, E);
11937 }), VarList.end());
11947template <
typename Derived>
11948void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
11949 const OpenACCNumWorkersClause &
C) {
11950 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11951 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
11954 if (!Res.isUsable())
11959 C.getBeginLoc(), Res.get());
11960 if (!Res.isUsable())
11970template <
typename Derived>
11971void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
11972 const OpenACCDeviceNumClause &
C) {
11973 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11974 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
11977 if (!Res.isUsable())
11982 C.getBeginLoc(), Res.get());
11983 if (!Res.isUsable())
11993template <
typename Derived>
11994void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
11995 const OpenACCDefaultAsyncClause &
C) {
11996 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11997 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12000 if (!Res.isUsable())
12005 C.getBeginLoc(), Res.get());
12006 if (!Res.isUsable())
12016template <
typename Derived>
12017void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12018 const OpenACCVectorLengthClause &
C) {
12019 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12020 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12023 if (!Res.isUsable())
12028 C.getBeginLoc(), Res.get());
12029 if (!Res.isUsable())
12039template <
typename Derived>
12040void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12041 const OpenACCAsyncClause &
C) {
12042 if (
C.hasIntExpr()) {
12043 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12044 if (!Res.isUsable())
12049 C.getBeginLoc(), Res.get());
12050 if (!Res.isUsable())
12063template <
typename Derived>
12064void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12065 const OpenACCWorkerClause &
C) {
12066 if (
C.hasIntExpr()) {
12070 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12071 if (!Res.isUsable())
12076 C.getBeginLoc(), Res.get());
12077 if (!Res.isUsable())
12090template <
typename Derived>
12091void OpenACCClauseTransform<Derived>::VisitVectorClause(
12092 const OpenACCVectorClause &
C) {
12093 if (
C.hasIntExpr()) {
12097 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12098 if (!Res.isUsable())
12103 C.getBeginLoc(), Res.get());
12104 if (!Res.isUsable())
12117template <
typename Derived>
12118void OpenACCClauseTransform<Derived>::VisitWaitClause(
12119 const OpenACCWaitClause &
C) {
12120 if (!
C.getLParenLoc().isInvalid()) {
12121 Expr *DevNumExpr =
nullptr;
12125 if (
C.getDevNumExpr()) {
12127 if (!Res.isUsable())
12131 C.getBeginLoc(), Res.get());
12132 if (!Res.isUsable())
12135 DevNumExpr = Res.get();
12139 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12141 if (!Res.isUsable())
12145 C.getBeginLoc(), Res.get());
12146 if (!Res.isUsable())
12149 InstantiatedQueueIdExprs.push_back(Res.get());
12153 std::move(InstantiatedQueueIdExprs));
12163template <
typename Derived>
12164void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12165 const OpenACCDeviceTypeClause &
C) {
12168 Self.getSema().getASTContext(),
C.getClauseKind(),
12170 C.getArchitectures(), ParsedClause.
getEndLoc());
12173template <
typename Derived>
12174void OpenACCClauseTransform<Derived>::VisitAutoClause(
12175 const OpenACCAutoClause &
C) {
12182template <
typename Derived>
12183void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12184 const OpenACCIndependentClause &
C) {
12190template <
typename Derived>
12191void OpenACCClauseTransform<Derived>::VisitSeqClause(
12192 const OpenACCSeqClause &
C) {
12197template <
typename Derived>
12198void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12199 const OpenACCFinalizeClause &
C) {
12205template <
typename Derived>
12206void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12207 const OpenACCIfPresentClause &
C) {
12213template <
typename Derived>
12214void OpenACCClauseTransform<Derived>::VisitReductionClause(
12215 const OpenACCReductionClause &
C) {
12219 for (Expr *Var : TransformedVars) {
12222 if (Res.isUsable())
12223 ValidVars.push_back(Res.get());
12226 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12229 C.getReductionOp(), ValidVars, ParsedClause.
getEndLoc());
12232template <
typename Derived>
12233void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12234 const OpenACCCollapseClause &
C) {
12235 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12236 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12240 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12242 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12245 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12247 if (!NewLoopCount.isUsable())
12257template <
typename Derived>
12258void OpenACCClauseTransform<Derived>::VisitTileClause(
12259 const OpenACCTileClause &
C) {
12263 for (Expr *
E :
C.getSizeExprs()) {
12266 if (!NewSizeExpr.isUsable())
12269 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12271 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12273 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12275 if (!NewSizeExpr.isUsable())
12277 TransformedExprs.push_back(NewSizeExpr.get());
12286template <
typename Derived>
12287void OpenACCClauseTransform<Derived>::VisitGangClause(
12288 const OpenACCGangClause &
C) {
12292 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12293 ExprResult ER =
Self.TransformExpr(
const_cast<Expr *
>(
C.getExpr(I).second));
12294 if (!ER.isUsable())
12297 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12299 C.getExpr(I).first, ER.get());
12300 if (!ER.isUsable())
12302 TransformedGangKinds.push_back(
C.getExpr(I).first);
12303 TransformedIntExprs.push_back(ER.get());
12306 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12309 TransformedGangKinds, TransformedIntExprs, ParsedClause.
getEndLoc());
12312template <
typename Derived>
12313OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12317 SemaOpenACC::OpenACCParsedClause ParsedClause(
12318 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12319 ParsedClause.
setEndLoc(OldClause->getEndLoc());
12321 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12324 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12326 Transform.Visit(OldClause);
12328 return Transform.CreatedClause();
12331template <
typename Derived>
12333TreeTransform<Derived>::TransformOpenACCClauseList(
12336 for (
const auto *Clause : OldClauses) {
12337 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12338 TransformedClauses, DirKind, Clause))
12339 TransformedClauses.push_back(TransformedClause);
12341 return TransformedClauses;
12344template <
typename Derived>
12345StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
12346 OpenACCComputeConstruct *
C) {
12347 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12350 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12353 if (getSema().OpenACC().ActOnStartStmtDirective(
12354 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12358 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12359 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12360 C->clauses(), TransformedClauses);
12361 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12362 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12363 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12365 return getDerived().RebuildOpenACCComputeConstruct(
12366 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12367 C->getEndLoc(), TransformedClauses, StrBlock);
12370template <
typename Derived>
12372TreeTransform<Derived>::TransformOpenACCLoopConstruct(OpenACCLoopConstruct *
C) {
12374 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12377 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12380 if (getSema().OpenACC().ActOnStartStmtDirective(
12381 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12385 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12386 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12387 C->clauses(), TransformedClauses);
12389 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12390 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12392 return getDerived().RebuildOpenACCLoopConstruct(
12393 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12394 TransformedClauses,
Loop);
12397template <
typename Derived>
12398StmtResult TreeTransform<Derived>::TransformOpenACCCombinedConstruct(
12399 OpenACCCombinedConstruct *
C) {
12400 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12403 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12406 if (getSema().OpenACC().ActOnStartStmtDirective(
12407 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12411 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12412 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12413 C->clauses(), TransformedClauses);
12415 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12416 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12418 return getDerived().RebuildOpenACCCombinedConstruct(
12419 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12420 C->getEndLoc(), TransformedClauses,
Loop);
12423template <
typename Derived>
12425TreeTransform<Derived>::TransformOpenACCDataConstruct(OpenACCDataConstruct *
C) {
12426 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12429 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12431 if (getSema().OpenACC().ActOnStartStmtDirective(
12432 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12435 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12436 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12437 C->clauses(), TransformedClauses);
12438 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12439 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12440 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12442 return getDerived().RebuildOpenACCDataConstruct(
12443 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12444 TransformedClauses, StrBlock);
12447template <
typename Derived>
12448StmtResult TreeTransform<Derived>::TransformOpenACCEnterDataConstruct(
12449 OpenACCEnterDataConstruct *
C) {
12450 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12453 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12455 if (getSema().OpenACC().ActOnStartStmtDirective(
12456 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12459 return getDerived().RebuildOpenACCEnterDataConstruct(
12460 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12461 TransformedClauses);
12464template <
typename Derived>
12465StmtResult TreeTransform<Derived>::TransformOpenACCExitDataConstruct(
12466 OpenACCExitDataConstruct *
C) {
12467 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12470 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12472 if (getSema().OpenACC().ActOnStartStmtDirective(
12473 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12476 return getDerived().RebuildOpenACCExitDataConstruct(
12477 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12478 TransformedClauses);
12481template <
typename Derived>
12482StmtResult TreeTransform<Derived>::TransformOpenACCHostDataConstruct(
12483 OpenACCHostDataConstruct *
C) {
12484 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12487 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12489 if (getSema().OpenACC().ActOnStartStmtDirective(
12490 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12493 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12494 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12495 C->clauses(), TransformedClauses);
12496 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12497 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12498 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12500 return getDerived().RebuildOpenACCHostDataConstruct(
12501 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12502 TransformedClauses, StrBlock);
12505template <
typename Derived>
12507TreeTransform<Derived>::TransformOpenACCInitConstruct(OpenACCInitConstruct *
C) {
12508 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12511 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12513 if (getSema().OpenACC().ActOnStartStmtDirective(
12514 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12517 return getDerived().RebuildOpenACCInitConstruct(
12518 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12519 TransformedClauses);
12522template <
typename Derived>
12523StmtResult TreeTransform<Derived>::TransformOpenACCShutdownConstruct(
12524 OpenACCShutdownConstruct *
C) {
12525 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12528 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12530 if (getSema().OpenACC().ActOnStartStmtDirective(
12531 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12534 return getDerived().RebuildOpenACCShutdownConstruct(
12535 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12536 TransformedClauses);
12538template <
typename Derived>
12540TreeTransform<Derived>::TransformOpenACCSetConstruct(OpenACCSetConstruct *
C) {
12541 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12544 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12546 if (getSema().OpenACC().ActOnStartStmtDirective(
12547 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12550 return getDerived().RebuildOpenACCSetConstruct(
12551 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12552 TransformedClauses);
12555template <
typename Derived>
12556StmtResult TreeTransform<Derived>::TransformOpenACCUpdateConstruct(
12557 OpenACCUpdateConstruct *
C) {
12558 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12561 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12563 if (getSema().OpenACC().ActOnStartStmtDirective(
12564 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12567 return getDerived().RebuildOpenACCUpdateConstruct(
12568 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12569 TransformedClauses);
12572template <
typename Derived>
12574TreeTransform<Derived>::TransformOpenACCWaitConstruct(OpenACCWaitConstruct *
C) {
12575 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12578 if (
C->hasDevNumExpr()) {
12579 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12581 if (DevNumExpr.isUsable())
12582 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12584 C->getBeginLoc(), DevNumExpr.get());
12589 for (Expr *QE :
C->getQueueIdExprs()) {
12590 assert(QE &&
"Null queue id expr?");
12591 ExprResult NewEQ = getDerived().TransformExpr(QE);
12593 if (!NewEQ.isUsable())
12597 C->getBeginLoc(), NewEQ.get());
12598 if (NewEQ.isUsable())
12599 QueueIdExprs.push_back(NewEQ.get());
12603 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12606 if (getSema().OpenACC().ActOnStartStmtDirective(
12607 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12610 return getDerived().RebuildOpenACCWaitConstruct(
12611 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12612 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12613 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12616template <
typename Derived>
12617ExprResult TreeTransform<Derived>::TransformOpenACCAsteriskSizeExpr(
12618 OpenACCAsteriskSizeExpr *
E) {
12619 if (getDerived().AlwaysRebuild())
12620 return getDerived().RebuildOpenACCAsteriskSizeExpr(
E->getLocation());
12628template<
typename Derived>
12630TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *
E) {
12631 return TransformExpr(
E->getSubExpr());
12634template <
typename Derived>
12635ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
12636 SYCLUniqueStableNameExpr *
E) {
12640 TypeSourceInfo *NewT = getDerived().TransformType(
E->getTypeSourceInfo());
12645 if (!getDerived().AlwaysRebuild() &&
E->getTypeSourceInfo() == NewT)
12648 return getDerived().RebuildSYCLUniqueStableNameExpr(
12649 E->getLocation(),
E->getLParenLocation(),
E->getRParenLocation(), NewT);
12652template<
typename Derived>
12654TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *
E) {
12658 return getDerived().RebuildPredefinedExpr(
E->getLocation(),
12659 E->getIdentKind());
12662template<
typename Derived>
12664TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *
E) {
12665 NestedNameSpecifierLoc QualifierLoc;
12666 if (
E->getQualifierLoc()) {
12668 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
12674 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getLocation(),
12679 NamedDecl *
Found = ND;
12680 if (
E->getFoundDecl() !=
E->getDecl()) {
12681 Found = cast_or_null<NamedDecl>(
12682 getDerived().TransformDecl(
E->getLocation(),
E->getFoundDecl()));
12687 DeclarationNameInfo NameInfo =
E->getNameInfo();
12688 if (NameInfo.getName()) {
12689 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12690 if (!NameInfo.getName())
12694 if (!getDerived().AlwaysRebuild() &&
12695 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12696 QualifierLoc ==
E->getQualifierLoc() && ND ==
E->getDecl() &&
12697 Found ==
E->getFoundDecl() &&
12698 NameInfo.getName() ==
E->getDecl()->getDeclName() &&
12699 !
E->hasExplicitTemplateArgs()) {
12708 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
12709 if (
E->hasExplicitTemplateArgs()) {
12710 TemplateArgs = &TransArgs;
12711 TransArgs.setLAngleLoc(
E->getLAngleLoc());
12712 TransArgs.setRAngleLoc(
E->getRAngleLoc());
12713 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
12714 E->getNumTemplateArgs(),
12719 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
12720 Found, TemplateArgs);
12723template<
typename Derived>
12725TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *
E) {
12729template <
typename Derived>
12730ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
12731 FixedPointLiteral *
E) {
12735template<
typename Derived>
12737TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *
E) {
12741template<
typename Derived>
12743TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *
E) {
12747template<
typename Derived>
12749TreeTransform<Derived>::TransformStringLiteral(StringLiteral *
E) {
12753template<
typename Derived>
12755TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *
E) {
12759template<
typename Derived>
12761TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *
E) {
12762 return getDerived().TransformCallExpr(
E);
12765template<
typename Derived>
12767TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *
E) {
12769 TypeSourceInfo *ControllingType =
nullptr;
12770 if (
E->isExprPredicate())
12771 ControllingExpr = getDerived().TransformExpr(
E->getControllingExpr());
12773 ControllingType = getDerived().TransformType(
E->getControllingType());
12775 if (ControllingExpr.isInvalid() && !ControllingType)
12781 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
12783 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
12786 AssocTypes.push_back(AssocType);
12788 AssocTypes.push_back(
nullptr);
12792 getDerived().TransformExpr(Assoc.getAssociationExpr());
12793 if (AssocExpr.isInvalid())
12795 AssocExprs.push_back(AssocExpr.get());
12798 if (!ControllingType)
12799 return getDerived().RebuildGenericSelectionExpr(
E->getGenericLoc(),
12800 E->getDefaultLoc(),
12802 ControllingExpr.get(),
12805 return getDerived().RebuildGenericSelectionExpr(
12806 E->getGenericLoc(),
E->getDefaultLoc(),
E->getRParenLoc(),
12807 ControllingType, AssocTypes, AssocExprs);
12810template<
typename Derived>
12812TreeTransform<Derived>::TransformParenExpr(ParenExpr *
E) {
12813 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
12814 if (SubExpr.isInvalid())
12817 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getSubExpr())
12820 return getDerived().RebuildParenExpr(SubExpr.get(),
E->getLParen(),
12827template<
typename Derived>
12831 return getDerived().TransformDependentScopeDeclRefExpr(
12832 DRE,
true,
nullptr);
12834 return getDerived().TransformUnresolvedLookupExpr(
12837 return getDerived().TransformExpr(
E);
12840template<
typename Derived>
12844 if (
E->getOpcode() == UO_AddrOf)
12845 SubExpr = TransformAddressOfOperand(
E->getSubExpr());
12847 SubExpr = TransformExpr(
E->getSubExpr());
12851 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getSubExpr())
12854 return getDerived().RebuildUnaryOperator(
E->getOperatorLoc(),
12859template<
typename Derived>
12861TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *
E) {
12863 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
12873 bool ExprChanged =
false;
12874 typedef Sema::OffsetOfComponent Component;
12876 for (
unsigned I = 0, N =
E->getNumComponents(); I != N; ++I) {
12877 const OffsetOfNode &ON =
E->getComponent(I);
12879 Comp.isBrackets =
true;
12880 Comp.LocStart = ON.getSourceRange().getBegin();
12881 Comp.LocEnd = ON.getSourceRange().getEnd();
12882 switch (ON.getKind()) {
12884 Expr *FromIndex =
E->getIndexExpr(ON.getArrayExprIndex());
12885 ExprResult Index = getDerived().TransformExpr(FromIndex);
12886 if (Index.isInvalid())
12889 ExprChanged = ExprChanged || Index.get() != FromIndex;
12890 Comp.isBrackets =
true;
12891 Comp.U.E = Index.get();
12897 Comp.isBrackets =
false;
12898 Comp.U.IdentInfo = ON.getFieldName();
12899 if (!
Comp.U.IdentInfo)
12909 Components.push_back(Comp);
12913 if (!getDerived().AlwaysRebuild() &&
12914 Type ==
E->getTypeSourceInfo() &&
12919 return getDerived().RebuildOffsetOfExpr(
E->getOperatorLoc(), Type,
12920 Components,
E->getRParenLoc());
12923template<
typename Derived>
12925TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *
E) {
12926 assert((!
E->getSourceExpr() || getDerived().AlreadyTransformed(
E->
getType())) &&
12927 "opaque value expression requires transformation");
12931template<
typename Derived>
12933TreeTransform<Derived>::TransformTypoExpr(TypoExpr *
E) {
12937template <
typename Derived>
12938ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *
E) {
12941 for (Expr *
C :
E->subExpressions()) {
12943 if (NewC.isInvalid())
12945 Children.push_back(NewC.get());
12949 if (!getDerived().AlwaysRebuild() && !Changed)
12955template<
typename Derived>
12957TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *
E) {
12965 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
12966 if (result.isInvalid())
return ExprError();
12971 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
12977template<
typename Derived>
12979TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
12980 UnaryExprOrTypeTraitExpr *
E) {
12981 if (
E->isArgumentType()) {
12982 TypeSourceInfo *OldT =
E->getArgumentTypeInfo();
12984 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12988 if (!getDerived().AlwaysRebuild() && OldT == NewT)
12991 return getDerived().RebuildUnaryExprOrTypeTrait(NewT,
E->getOperatorLoc(),
13005 TypeSourceInfo *RecoveryTSI =
nullptr;
13007 auto *PE = dyn_cast<ParenExpr>(
E->getArgumentExpr());
13009 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13010 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13011 PE, DRE,
false, &RecoveryTSI);
13013 SubExpr = getDerived().TransformExpr(
E->getArgumentExpr());
13016 return getDerived().RebuildUnaryExprOrTypeTrait(
13018 }
else if (SubExpr.isInvalid())
13021 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getArgumentExpr())
13024 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13025 E->getOperatorLoc(),
13030template<
typename Derived>
13032TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *
E) {
13033 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13034 if (LHS.isInvalid())
13037 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13038 if (RHS.isInvalid())
13042 if (!getDerived().AlwaysRebuild() &&
13043 LHS.get() ==
E->getLHS() &&
13044 RHS.get() ==
E->getRHS())
13047 return getDerived().RebuildArraySubscriptExpr(
13049 E->getLHS()->
getBeginLoc(), RHS.get(),
E->getRBracketLoc());
13052template <
typename Derived>
13054TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *
E) {
13056 if (
Base.isInvalid())
13059 ExprResult RowIdx = getDerived().TransformExpr(
E->getRowIdx());
13060 if (RowIdx.isInvalid())
13063 ExprResult ColumnIdx = getDerived().TransformExpr(
E->getColumnIdx());
13064 if (ColumnIdx.isInvalid())
13067 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
13068 RowIdx.get() ==
E->getRowIdx() && ColumnIdx.get() ==
E->getColumnIdx())
13071 return getDerived().RebuildMatrixSubscriptExpr(
13072 Base.get(), RowIdx.get(), ColumnIdx.get(),
E->getRBracketLoc());
13075template <
typename Derived>
13077TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *
E) {
13079 if (
Base.isInvalid())
13083 if (
E->getLowerBound()) {
13084 LowerBound = getDerived().TransformExpr(
E->getLowerBound());
13085 if (LowerBound.isInvalid())
13090 if (
E->getLength()) {
13091 Length = getDerived().TransformExpr(
E->getLength());
13092 if (Length.isInvalid())
13097 if (
E->isOMPArraySection()) {
13098 if (Expr *Str =
E->getStride()) {
13099 Stride = getDerived().TransformExpr(Str);
13100 if (Stride.isInvalid())
13105 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
13106 LowerBound.get() ==
E->getLowerBound() &&
13107 Length.get() ==
E->getLength() &&
13108 (
E->isOpenACCArraySection() || Stride.get() ==
E->getStride()))
13111 return getDerived().RebuildArraySectionExpr(
13113 LowerBound.get(),
E->getColonLocFirst(),
13114 E->isOMPArraySection() ?
E->getColonLocSecond() : SourceLocation{},
13115 Length.get(), Stride.get(),
E->getRBracketLoc());
13118template <
typename Derived>
13120TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *
E) {
13122 if (
Base.isInvalid())
13126 bool ErrorFound =
false;
13127 for (Expr *
Dim :
E->getDimensions()) {
13129 if (DimRes.isInvalid()) {
13133 Dims.push_back(DimRes.get());
13138 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(),
E->getLParenLoc(),
13139 E->getRParenLoc(), Dims,
13140 E->getBracketsRanges());
13143template <
typename Derived>
13145TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *
E) {
13146 unsigned NumIterators =
E->numOfIterators();
13149 bool ErrorFound =
false;
13150 bool NeedToRebuild = getDerived().AlwaysRebuild();
13151 for (
unsigned I = 0; I < NumIterators; ++I) {
13152 auto *
D = cast<VarDecl>(
E->getIteratorDecl(I));
13153 Data[I].DeclIdent =
D->getIdentifier();
13157 "Implicit type must be int.");
13159 TypeSourceInfo *TSI = getDerived().TransformType(
D->getTypeSourceInfo());
13160 QualType
DeclTy = getDerived().TransformType(
D->getType());
13163 OMPIteratorExpr::IteratorRange
Range =
E->getIteratorRange(I);
13167 ErrorFound = ErrorFound ||
13168 !(!
D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
13169 !
Data[I].Type.get().isNull())) ||
13174 Data[I].Range.End = End.get();
13175 Data[I].Range.Step = Step.get();
13176 Data[I].AssignLoc =
E->getAssignLoc(I);
13177 Data[I].ColonLoc =
E->getColonLoc(I);
13178 Data[I].SecColonLoc =
E->getSecondColonLoc(I);
13181 (
D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
13182 D->getType().getTypePtrOrNull()) ||
13188 if (!NeedToRebuild)
13191 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13192 E->getIteratorKwLoc(),
E->getLParenLoc(),
E->getRParenLoc(),
Data);
13193 if (!Res.isUsable())
13195 auto *IE = cast<OMPIteratorExpr>(Res.get());
13196 for (
unsigned I = 0; I < NumIterators; ++I)
13197 getDerived().transformedLocalDecl(
E->getIteratorDecl(I),
13198 IE->getIteratorDecl(I));
13202template<
typename Derived>
13204TreeTransform<Derived>::TransformCallExpr(CallExpr *
E) {
13211 bool ArgChanged =
false;
13213 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13217 if (!getDerived().AlwaysRebuild() &&
13218 Callee.get() ==
E->getCallee() &&
13223 SourceLocation FakeLParenLoc
13226 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13227 if (
E->hasStoredFPFeatures()) {
13228 FPOptionsOverride NewOverrides =
E->getFPFeatures();
13229 getSema().CurFPFeatures =
13230 NewOverrides.applyOverrides(getSema().getLangOpts());
13231 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13234 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13236 E->getRParenLoc());
13239template<
typename Derived>
13241TreeTransform<Derived>::TransformMemberExpr(MemberExpr *
E) {
13243 if (
Base.isInvalid())
13246 NestedNameSpecifierLoc QualifierLoc;
13247 if (
E->hasQualifier()) {
13249 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
13254 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
13257 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getMemberLoc(),
13258 E->getMemberDecl()));
13262 NamedDecl *FoundDecl =
E->getFoundDecl();
13263 if (FoundDecl ==
E->getMemberDecl()) {
13266 FoundDecl = cast_or_null<NamedDecl>(
13267 getDerived().TransformDecl(
E->getMemberLoc(), FoundDecl));
13272 if (!getDerived().AlwaysRebuild() &&
13273 Base.get() ==
E->getBase() &&
13274 QualifierLoc ==
E->getQualifierLoc() &&
13275 Member ==
E->getMemberDecl() &&
13276 FoundDecl ==
E->getFoundDecl() &&
13277 !
E->hasExplicitTemplateArgs()) {
13281 if (!(isa<CXXThisExpr>(
E->getBase()) &&
13282 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13283 cast<ValueDecl>(
Member)))) {
13291 TemplateArgumentListInfo TransArgs;
13292 if (
E->hasExplicitTemplateArgs()) {
13293 TransArgs.setLAngleLoc(
E->getLAngleLoc());
13294 TransArgs.setRAngleLoc(
E->getRAngleLoc());
13295 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
13296 E->getNumTemplateArgs(),
13302 SourceLocation FakeOperatorLoc =
13309 NamedDecl *FirstQualifierInScope =
nullptr;
13310 DeclarationNameInfo MemberNameInfo =
E->getMemberNameInfo();
13311 if (MemberNameInfo.getName()) {
13312 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13313 if (!MemberNameInfo.getName())
13317 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13324 (
E->hasExplicitTemplateArgs()
13325 ? &TransArgs :
nullptr),
13326 FirstQualifierInScope);
13329template<
typename Derived>
13331TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *
E) {
13332 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13333 if (LHS.isInvalid())
13337 getDerived().TransformInitializer(
E->getRHS(),
false);
13338 if (RHS.isInvalid())
13341 if (!getDerived().AlwaysRebuild() &&
13342 LHS.get() ==
E->getLHS() &&
13343 RHS.get() ==
E->getRHS())
13346 if (
E->isCompoundAssignmentOp())
13348 return getDerived().RebuildBinaryOperator(
13349 E->getOperatorLoc(),
E->getOpcode(), LHS.get(), RHS.get());
13350 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13351 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13352 getSema().CurFPFeatures =
13353 NewOverrides.applyOverrides(getSema().getLangOpts());
13354 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13355 return getDerived().RebuildBinaryOperator(
E->getOperatorLoc(),
E->getOpcode(),
13356 LHS.get(), RHS.get());
13359template <
typename Derived>
13360ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
13361 CXXRewrittenBinaryOperator *
E) {
13362 CXXRewrittenBinaryOperator::DecomposedForm Decomp =
E->getDecomposedForm();
13364 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13365 if (LHS.isInvalid())
13368 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13369 if (RHS.isInvalid())
13374 UnresolvedSet<2> UnqualLookups;
13375 bool ChangedAnyLookups =
false;
13376 Expr *PossibleBinOps[] = {
E->getSemanticForm(),
13377 const_cast<Expr *
>(Decomp.InnerBinOp)};
13378 for (Expr *PossibleBinOp : PossibleBinOps) {
13379 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13382 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13383 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
13388 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13389 E->getOperatorLoc(),
Callee->getFoundDecl()));
13393 ChangedAnyLookups =
true;
13394 UnqualLookups.addDecl(
Found);
13397 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13398 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13404 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13409 return getDerived().RebuildCXXRewrittenBinaryOperator(
13410 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13413template<
typename Derived>
13415TreeTransform<Derived>::TransformCompoundAssignOperator(
13416 CompoundAssignOperator *
E) {
13417 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13418 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13419 getSema().CurFPFeatures =
13420 NewOverrides.applyOverrides(getSema().getLangOpts());
13421 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13422 return getDerived().TransformBinaryOperator(
E);
13425template<
typename Derived>
13427TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
13431 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13432 if (commonExpr.isInvalid())
13435 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13436 if (rhs.isInvalid())
13439 if (!getDerived().AlwaysRebuild() &&
13440 commonExpr.get() == e->getCommon() &&
13441 rhs.get() == e->getFalseExpr())
13444 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13445 e->getQuestionLoc(),
13451template<
typename Derived>
13453TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *
E) {
13454 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13455 if (Cond.isInvalid())
13458 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13459 if (LHS.isInvalid())
13462 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13463 if (RHS.isInvalid())
13466 if (!getDerived().AlwaysRebuild() &&
13467 Cond.get() ==
E->getCond() &&
13468 LHS.get() ==
E->getLHS() &&
13469 RHS.get() ==
E->getRHS())
13472 return getDerived().RebuildConditionalOperator(Cond.get(),
13473 E->getQuestionLoc(),
13479template<
typename Derived>
13481TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *
E) {
13484 return getDerived().TransformExpr(
E->getSubExprAsWritten());
13487template<
typename Derived>
13489TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *
E) {
13490 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeInfoAsWritten());
13495 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13496 if (SubExpr.isInvalid())
13499 if (!getDerived().AlwaysRebuild() &&
13500 Type ==
E->getTypeInfoAsWritten() &&
13501 SubExpr.get() ==
E->getSubExpr())
13504 return getDerived().RebuildCStyleCastExpr(
E->getLParenLoc(),
13510template<
typename Derived>
13512TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *
E) {
13513 TypeSourceInfo *OldT =
E->getTypeSourceInfo();
13514 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
13519 if (
Init.isInvalid())
13522 if (!getDerived().AlwaysRebuild() &&
13524 Init.get() ==
E->getInitializer())
13531 return getDerived().RebuildCompoundLiteralExpr(
13532 E->getLParenLoc(), NewT,
13536template<
typename Derived>
13538TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *
E) {
13540 if (
Base.isInvalid())
13543 if (!getDerived().AlwaysRebuild() &&
13544 Base.get() ==
E->getBase())
13548 SourceLocation FakeOperatorLoc =
13550 return getDerived().RebuildExtVectorElementExpr(
13551 Base.get(), FakeOperatorLoc,
E->isArrow(),
E->getAccessorLoc(),
13555template<
typename Derived>
13557TreeTransform<Derived>::TransformInitListExpr(InitListExpr *
E) {
13558 if (InitListExpr *Syntactic =
E->getSyntacticForm())
13561 bool InitChanged =
false;
13563 EnterExpressionEvaluationContext Context(
13567 if (getDerived().TransformExprs(
E->getInits(),
E->getNumInits(),
false,
13568 Inits, &InitChanged))
13571 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13578 return getDerived().RebuildInitList(
E->getLBraceLoc(), Inits,
13579 E->getRBraceLoc());
13582template<
typename Derived>
13584TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *
E) {
13589 if (
Init.isInvalid())
13594 bool ExprChanged =
false;
13595 for (
const DesignatedInitExpr::Designator &
D :
E->designators()) {
13596 if (
D.isFieldDesignator()) {
13597 if (
D.getFieldDecl()) {
13598 FieldDecl *
Field = cast_or_null<FieldDecl>(
13599 getDerived().TransformDecl(
D.getFieldLoc(),
D.getFieldDecl()));
13600 if (Field !=
D.getFieldDecl())
13603 ExprChanged =
true;
13604 if (
Field->isAnonymousStructOrUnion())
13610 ExprChanged =
true;
13613 D.getFieldName(),
D.getDotLoc(),
D.getFieldLoc()));
13617 if (
D.isArrayDesignator()) {
13618 ExprResult Index = getDerived().TransformExpr(
E->getArrayIndex(
D));
13619 if (Index.isInvalid())
13622 Desig.AddDesignator(
13625 ExprChanged = ExprChanged ||
Init.get() !=
E->getArrayIndex(
D);
13626 ArrayExprs.push_back(Index.get());
13630 assert(
D.isArrayRangeDesignator() &&
"New kind of designator?");
13632 = getDerived().TransformExpr(
E->getArrayRangeStart(
D));
13633 if (Start.isInvalid())
13636 ExprResult End = getDerived().TransformExpr(
E->getArrayRangeEnd(
D));
13637 if (End.isInvalid())
13641 Start.get(), End.get(),
D.getLBracketLoc(),
D.getEllipsisLoc()));
13643 ExprChanged = ExprChanged || Start.get() !=
E->getArrayRangeStart(
D) ||
13644 End.get() !=
E->getArrayRangeEnd(
D);
13646 ArrayExprs.push_back(Start.get());
13647 ArrayExprs.push_back(End.get());
13650 if (!getDerived().AlwaysRebuild() &&
13651 Init.get() ==
E->getInit() &&
13655 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13656 E->getEqualOrColonLoc(),
13657 E->usesGNUSyntax(),
Init.get());
13662template<
typename Derived>
13664TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
13665 DesignatedInitUpdateExpr *
E) {
13666 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13671template<
typename Derived>
13673TreeTransform<Derived>::TransformNoInitExpr(
13675 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13679template<
typename Derived>
13681TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *
E) {
13682 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13686template<
typename Derived>
13688TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *
E) {
13689 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13693template<
typename Derived>
13695TreeTransform<Derived>::TransformImplicitValueInitExpr(
13696 ImplicitValueInitExpr *
E) {
13697 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
13701 QualType
T = getDerived().TransformType(
E->
getType());
13705 if (!getDerived().AlwaysRebuild() &&
13709 return getDerived().RebuildImplicitValueInitExpr(
T);
13712template<
typename Derived>
13714TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *
E) {
13715 TypeSourceInfo *TInfo = getDerived().TransformType(
E->getWrittenTypeInfo());
13719 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
13720 if (SubExpr.isInvalid())
13723 if (!getDerived().AlwaysRebuild() &&
13724 TInfo ==
E->getWrittenTypeInfo() &&
13725 SubExpr.get() ==
E->getSubExpr())
13728 return getDerived().RebuildVAArgExpr(
E->getBuiltinLoc(), SubExpr.get(),
13729 TInfo,
E->getRParenLoc());
13732template<
typename Derived>
13734TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *
E) {
13735 bool ArgumentChanged =
false;
13737 if (TransformExprs(
E->getExprs(),
E->getNumExprs(),
true, Inits,
13741 return getDerived().RebuildParenListExpr(
E->getLParenLoc(),
13743 E->getRParenLoc());
13751template<
typename Derived>
13753TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *
E) {
13754 Decl *LD = getDerived().TransformDecl(
E->getLabel()->getLocation(),
13759 return getDerived().RebuildAddrLabelExpr(
E->getAmpAmpLoc(),
E->getLabelLoc(),
13760 cast<LabelDecl>(LD));
13763template<
typename Derived>
13765TreeTransform<Derived>::TransformStmtExpr(StmtExpr *
E) {
13768 = getDerived().TransformCompoundStmt(
E->getSubStmt(),
true);
13769 if (SubStmt.isInvalid()) {
13774 unsigned OldDepth =
E->getTemplateDepth();
13775 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13777 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13778 SubStmt.get() ==
E->getSubStmt()) {
13784 return getDerived().RebuildStmtExpr(
E->getLParenLoc(), SubStmt.get(),
13785 E->getRParenLoc(), NewDepth);
13788template<
typename Derived>
13790TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *
E) {
13791 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13792 if (Cond.isInvalid())
13795 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13796 if (LHS.isInvalid())
13799 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13800 if (RHS.isInvalid())
13803 if (!getDerived().AlwaysRebuild() &&
13804 Cond.get() ==
E->getCond() &&
13805 LHS.get() ==
E->getLHS() &&
13806 RHS.get() ==
E->getRHS())
13809 return getDerived().RebuildChooseExpr(
E->getBuiltinLoc(),
13810 Cond.get(), LHS.get(), RHS.get(),
13811 E->getRParenLoc());
13814template<
typename Derived>
13816TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *
E) {
13820template<
typename Derived>
13822TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *
E) {
13823 switch (
E->getOperator()) {
13827 case OO_Array_Delete:
13828 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
13833 assert(
E->getNumArgs() >= 1 &&
"Object call is missing arguments");
13842 static_cast<Expr *
>(
Object.get())->getEndLoc());
13846 if (getDerived().TransformExprs(
E->getArgs() + 1,
E->getNumArgs() - 1,
true,
13850 if (
E->getOperator() == OO_Subscript)
13851 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
13854 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
13858#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
13862#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
13863#include "clang/Basic/OperatorKinds.def"
13865 case OO_Conditional:
13866 llvm_unreachable(
"conditional operator is not actually overloadable");
13870 llvm_unreachable(
"not an overloaded operator?");
13874 if (
E->getNumArgs() == 1 &&
E->getOperator() == OO_Amp)
13875 First = getDerived().TransformAddressOfOperand(
E->getArg(0));
13877 First = getDerived().TransformExpr(
E->getArg(0));
13878 if (
First.isInvalid())
13882 if (
E->getNumArgs() == 2) {
13884 getDerived().TransformInitializer(
E->getArg(1),
false);
13885 if (Second.isInvalid())
13889 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13890 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13891 getSema().CurFPFeatures =
13892 NewOverrides.applyOverrides(getSema().getLangOpts());
13893 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13895 Expr *
Callee =
E->getCallee();
13896 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
13897 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
13899 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
13902 return getDerived().RebuildCXXOperatorCallExpr(
13903 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13904 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
13907 UnresolvedSet<1> Functions;
13908 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
13909 Callee = ICE->getSubExprAsWritten();
13910 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
13911 ValueDecl *VD = cast_or_null<ValueDecl>(
13912 getDerived().TransformDecl(DR->getLocation(), DR));
13916 if (!isa<CXXMethodDecl>(VD))
13917 Functions.addDecl(VD);
13919 return getDerived().RebuildCXXOperatorCallExpr(
13920 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13921 false, Functions,
First.get(), Second.get());
13924template<
typename Derived>
13926TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *
E) {
13927 return getDerived().TransformCallExpr(
E);
13930template <
typename Derived>
13931ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *
E) {
13933 getSema().CurContext !=
E->getParentContext();
13935 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
13938 return getDerived().RebuildSourceLocExpr(
E->getIdentKind(),
E->
getType(),
13940 getSema().CurContext);
13943template <
typename Derived>
13944ExprResult TreeTransform<Derived>::TransformEmbedExpr(EmbedExpr *
E) {
13948template<
typename Derived>
13950TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *
E) {
13957 ExprResult EC = getDerived().TransformCallExpr(
E->getConfig());
13958 if (EC.isInvalid())
13962 bool ArgChanged =
false;
13964 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13968 if (!getDerived().AlwaysRebuild() &&
13969 Callee.get() ==
E->getCallee() &&
13974 SourceLocation FakeLParenLoc
13976 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13978 E->getRParenLoc(), EC.get());
13981template<
typename Derived>
13989 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13993 if (!getDerived().AlwaysRebuild() &&
13994 Type ==
E->getTypeInfoAsWritten() &&
13995 SubExpr.
get() ==
E->getSubExpr())
13997 return getDerived().RebuildCXXNamedCastExpr(
13998 E->getOperatorLoc(),
E->
getStmtClass(),
E->getAngleBrackets().getBegin(),
13999 Type,
E->getAngleBrackets().getEnd(),
14001 E->getAngleBrackets().getEnd(), SubExpr.
get(),
E->getRParenLoc());
14004template<
typename Derived>
14013 if (Sub.isInvalid())
14016 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14020template<
typename Derived>
14022TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *
E) {
14023 return getDerived().TransformCXXNamedCastExpr(
E);
14026template<
typename Derived>
14028TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *
E) {
14029 return getDerived().TransformCXXNamedCastExpr(
E);
14032template<
typename Derived>
14034TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
14035 CXXReinterpretCastExpr *
E) {
14036 return getDerived().TransformCXXNamedCastExpr(
E);
14039template<
typename Derived>
14041TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *
E) {
14042 return getDerived().TransformCXXNamedCastExpr(
E);
14045template<
typename Derived>
14047TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *
E) {
14048 return getDerived().TransformCXXNamedCastExpr(
E);
14051template<
typename Derived>
14053TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
14054 CXXFunctionalCastExpr *
E) {
14055 TypeSourceInfo *
Type =
14056 getDerived().TransformTypeWithDeducedTST(
E->getTypeInfoAsWritten());
14061 = getDerived().TransformExpr(
E->getSubExprAsWritten());
14062 if (SubExpr.isInvalid())
14065 if (!getDerived().AlwaysRebuild() &&
14066 Type ==
E->getTypeInfoAsWritten() &&
14067 SubExpr.get() ==
E->getSubExpr())
14070 return getDerived().RebuildCXXFunctionalCastExpr(Type,
14074 E->isListInitialization());
14077template<
typename Derived>
14079TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *
E) {
14080 if (
E->isTypeOperand()) {
14081 TypeSourceInfo *TInfo
14082 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
14086 if (!getDerived().AlwaysRebuild() &&
14087 TInfo ==
E->getTypeOperandSourceInfo())
14097 Expr *Op =
E->getExprOperand();
14100 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
14101 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
14104 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
14107 ExprResult SubExpr = getDerived().TransformExpr(Op);
14108 if (SubExpr.isInvalid())
14111 if (!getDerived().AlwaysRebuild() &&
14112 SubExpr.get() ==
E->getExprOperand())
14119template<
typename Derived>
14121TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *
E) {
14122 if (
E->isTypeOperand()) {
14123 TypeSourceInfo *TInfo
14124 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
14128 if (!getDerived().AlwaysRebuild() &&
14129 TInfo ==
E->getTypeOperandSourceInfo())
14139 ExprResult SubExpr = getDerived().TransformExpr(
E->getExprOperand());
14140 if (SubExpr.isInvalid())
14143 if (!getDerived().AlwaysRebuild() &&
14144 SubExpr.get() ==
E->getExprOperand())
14151template<
typename Derived>
14153TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *
E) {
14157template<
typename Derived>
14159TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
14160 CXXNullPtrLiteralExpr *
E) {
14164template<
typename Derived>
14166TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *
E) {
14177 QualType
T = [&]() {
14178 auto &S = getSema();
14179 if (
E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14182 return getDerived().TransformType(
E->
getType());
14186 if (!getDerived().AlwaysRebuild() &&
T ==
E->
getType()) {
14189 getSema().MarkThisReferenced(
E);
14193 return getDerived().RebuildCXXThisExpr(
E->
getBeginLoc(),
T,
E->isImplicit());
14196template<
typename Derived>
14198TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *
E) {
14199 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
14200 if (SubExpr.isInvalid())
14203 if (!getDerived().AlwaysRebuild() &&
14204 SubExpr.get() ==
E->getSubExpr())
14207 return getDerived().RebuildCXXThrowExpr(
E->getThrowLoc(), SubExpr.get(),
14208 E->isThrownVariableInScope());
14211template<
typename Derived>
14213TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *
E) {
14214 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
14215 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getParam()));
14220 if (
E->hasRewrittenInit()) {
14221 InitRes = getDerived().TransformExpr(
E->getRewrittenExpr());
14222 if (InitRes.isInvalid())
14226 if (!getDerived().AlwaysRebuild() && Param ==
E->getParam() &&
14228 InitRes.get() ==
E->getRewrittenExpr())
14231 return getDerived().RebuildCXXDefaultArgExpr(
E->getUsedLocation(), Param,
14235template<
typename Derived>
14237TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *
E) {
14238 FieldDecl *
Field = cast_or_null<FieldDecl>(
14239 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getField()));
14243 if (!getDerived().AlwaysRebuild() && Field ==
E->getField() &&
14247 return getDerived().RebuildCXXDefaultInitExpr(
E->
getExprLoc(), Field);
14250template<
typename Derived>
14252TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
14253 CXXScalarValueInitExpr *
E) {
14254 TypeSourceInfo *
T = getDerived().TransformType(
E->getTypeSourceInfo());
14258 if (!getDerived().AlwaysRebuild() &&
14259 T ==
E->getTypeSourceInfo())
14262 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14263 T->getTypeLoc().getEndLoc(),
14264 E->getRParenLoc());
14267template<
typename Derived>
14269TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *
E) {
14271 TypeSourceInfo *AllocTypeInfo =
14272 getDerived().TransformTypeWithDeducedTST(
E->getAllocatedTypeSourceInfo());
14273 if (!AllocTypeInfo)
14277 std::optional<Expr *> ArraySize;
14278 if (
E->isArray()) {
14280 if (std::optional<Expr *> OldArraySize =
E->getArraySize()) {
14281 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14282 if (NewArraySize.isInvalid())
14285 ArraySize = NewArraySize.get();
14289 bool ArgumentChanged =
false;
14291 if (getDerived().TransformExprs(
E->getPlacementArgs(),
14292 E->getNumPlacementArgs(),
true,
14293 PlacementArgs, &ArgumentChanged))
14297 Expr *OldInit =
E->getInitializer();
14300 NewInit = getDerived().TransformInitializer(OldInit,
true);
14301 if (NewInit.isInvalid())
14305 FunctionDecl *OperatorNew =
nullptr;
14306 if (
E->getOperatorNew()) {
14307 OperatorNew = cast_or_null<FunctionDecl>(
14308 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorNew()));
14313 FunctionDecl *OperatorDelete =
nullptr;
14314 if (
E->getOperatorDelete()) {
14315 OperatorDelete = cast_or_null<FunctionDecl>(
14316 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14317 if (!OperatorDelete)
14321 if (!getDerived().AlwaysRebuild() &&
14322 AllocTypeInfo ==
E->getAllocatedTypeSourceInfo() &&
14323 ArraySize ==
E->getArraySize() &&
14324 NewInit.get() == OldInit &&
14325 OperatorNew ==
E->getOperatorNew() &&
14326 OperatorDelete ==
E->getOperatorDelete() &&
14327 !ArgumentChanged) {
14332 if (OperatorDelete)
14335 if (
E->isArray() && !
E->getAllocatedType()->isDependentType()) {
14336 QualType ElementType
14338 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
14339 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
14349 QualType AllocType = AllocTypeInfo->
getType();
14359 }
else if (
const ConstantArrayType *ConsArrayT
14360 = dyn_cast<ConstantArrayType>(ArrayT)) {
14364 AllocType = ConsArrayT->getElementType();
14365 }
else if (
const DependentSizedArrayType *DepArrayT
14366 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14367 if (DepArrayT->getSizeExpr()) {
14368 ArraySize = DepArrayT->getSizeExpr();
14369 AllocType = DepArrayT->getElementType();
14374 return getDerived().RebuildCXXNewExpr(
14378 AllocTypeInfo, ArraySize,
E->getDirectInitRange(), NewInit.get());
14381template<
typename Derived>
14383TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *
E) {
14389 FunctionDecl *OperatorDelete =
nullptr;
14390 if (
E->getOperatorDelete()) {
14391 OperatorDelete = cast_or_null<FunctionDecl>(
14392 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14393 if (!OperatorDelete)
14397 if (!getDerived().AlwaysRebuild() &&
14398 Operand.get() ==
E->getArgument() &&
14399 OperatorDelete ==
E->getOperatorDelete()) {
14402 if (OperatorDelete)
14407 E->getDestroyedType());
14408 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
14409 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
14418 return getDerived().RebuildCXXDeleteExpr(
14422template<
typename Derived>
14424TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
14425 CXXPseudoDestructorExpr *
E) {
14427 if (
Base.isInvalid())
14431 bool MayBePseudoDestructor =
false;
14433 E->getOperatorLoc(),
14434 E->isArrow()? tok::arrow : tok::period,
14436 MayBePseudoDestructor);
14437 if (
Base.isInvalid())
14440 QualType ObjectType = ObjectTypePtr.get();
14441 NestedNameSpecifierLoc QualifierLoc =
E->getQualifierLoc();
14442 if (QualifierLoc) {
14444 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14449 SS.Adopt(QualifierLoc);
14451 PseudoDestructorTypeStorage Destroyed;
14452 if (
E->getDestroyedTypeInfo()) {
14453 TypeSourceInfo *DestroyedTypeInfo
14454 = getDerived().TransformTypeInObjectScope(
E->getDestroyedTypeInfo(),
14455 ObjectType,
nullptr, SS);
14456 if (!DestroyedTypeInfo)
14458 Destroyed = DestroyedTypeInfo;
14459 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14462 Destroyed = PseudoDestructorTypeStorage(
E->getDestroyedTypeIdentifier(),
14463 E->getDestroyedTypeLoc());
14467 *
E->getDestroyedTypeIdentifier(),
E->getDestroyedTypeLoc(),
14468 nullptr, SS, ObjectTypePtr,
false);
14474 E->getDestroyedTypeLoc());
14477 TypeSourceInfo *ScopeTypeInfo =
nullptr;
14478 if (
E->getScopeTypeInfo()) {
14479 CXXScopeSpec EmptySS;
14480 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14481 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
14482 if (!ScopeTypeInfo)
14486 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14487 E->getOperatorLoc(),
14491 E->getColonColonLoc(),
14496template <
typename Derived>
14501 bool AllEmptyPacks =
true;
14502 for (
auto *OldD : Old->
decls()) {
14503 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
14507 if (isa<UsingShadowDecl>(OldD))
14516 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
14518 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14519 Decls = UPD->expansions();
14522 for (
auto *
D : Decls) {
14523 if (
auto *UD = dyn_cast<UsingDecl>(
D)) {
14524 for (
auto *SD : UD->shadows())
14531 AllEmptyPacks &= Decls.empty();
14540 if (AllEmptyPacks && !RequiresADL) {
14541 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
14542 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
14552 getSema().FilterAcceptableTemplateNames(R,
14559 diag::err_template_kw_refers_to_non_template)
14563 diag::note_template_kw_refers_to_non_template)
14572template <
typename Derived>
14575 return TransformUnresolvedLookupExpr(Old,
false);
14578template <
typename Derived>
14581 bool IsAddressOfOperand) {
14586 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14593 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14597 SS.
Adopt(QualifierLoc);
14601 CXXRecordDecl *NamingClass
14602 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14605 if (!NamingClass) {
14610 R.setNamingClass(NamingClass);
14631 SS, TemplateKWLoc, R,
14638 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14641 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14645template<
typename Derived>
14647TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *
E) {
14648 bool ArgChanged =
false;
14650 for (
unsigned I = 0, N =
E->getNumArgs(); I != N; ++I) {
14651 TypeSourceInfo *From =
E->getArg(I);
14652 TypeLoc FromTL = From->getTypeLoc();
14653 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
14654 TypeLocBuilder TLB;
14655 TLB.reserve(FromTL.getFullDataSize());
14656 QualType To = getDerived().TransformType(TLB, FromTL);
14660 if (To == From->getType())
14661 Args.push_back(From);
14663 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14672 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
14673 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14679 bool Expand =
true;
14680 bool RetainExpansion =
false;
14681 std::optional<unsigned> OrigNumExpansions =
14682 ExpansionTL.getTypePtr()->getNumExpansions();
14683 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14684 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
14685 PatternTL.getSourceRange(),
14687 Expand, RetainExpansion,
14695 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14697 TypeLocBuilder TLB;
14698 TLB.reserve(From->getTypeLoc().getFullDataSize());
14700 QualType To = getDerived().TransformType(TLB, PatternTL);
14704 To = getDerived().RebuildPackExpansionType(To,
14705 PatternTL.getSourceRange(),
14706 ExpansionTL.getEllipsisLoc(),
14711 PackExpansionTypeLoc ToExpansionTL
14712 = TLB.push<PackExpansionTypeLoc>(To);
14713 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14714 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14720 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14721 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
14722 TypeLocBuilder TLB;
14723 TLB.reserve(PatternTL.getFullDataSize());
14724 QualType To = getDerived().TransformType(TLB, PatternTL);
14728 if (To->containsUnexpandedParameterPack()) {
14729 To = getDerived().RebuildPackExpansionType(To,
14730 PatternTL.getSourceRange(),
14731 ExpansionTL.getEllipsisLoc(),
14736 PackExpansionTypeLoc ToExpansionTL
14737 = TLB.push<PackExpansionTypeLoc>(To);
14738 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14741 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14744 if (!RetainExpansion)
14749 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14751 TypeLocBuilder TLB;
14752 TLB.reserve(From->getTypeLoc().getFullDataSize());
14754 QualType To = getDerived().TransformType(TLB, PatternTL);
14758 To = getDerived().RebuildPackExpansionType(To,
14759 PatternTL.getSourceRange(),
14760 ExpansionTL.getEllipsisLoc(),
14765 PackExpansionTypeLoc ToExpansionTL
14766 = TLB.push<PackExpansionTypeLoc>(To);
14767 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14768 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14771 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14774 return getDerived().RebuildTypeTrait(
E->getTrait(),
E->
getBeginLoc(), Args,
14778template<
typename Derived>
14780TreeTransform<Derived>::TransformConceptSpecializationExpr(
14781 ConceptSpecializationExpr *
E) {
14782 const ASTTemplateArgumentListInfo *Old =
E->getTemplateArgsAsWritten();
14783 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
14784 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14785 Old->NumTemplateArgs, TransArgs))
14788 return getDerived().RebuildConceptSpecializationExpr(
14789 E->getNestedNameSpecifierLoc(),
E->getTemplateKWLoc(),
14790 E->getConceptNameInfo(),
E->getFoundDecl(),
E->getNamedConcept(),
14794template<
typename Derived>
14796TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *
E) {
14799 Sema::ExtParameterInfoBuilder ExtParamInfos;
14803 EnterExpressionEvaluationContext Ctx(
14808 getSema().Context, getSema().CurContext,
14811 Sema::ContextRAII SavedContext(getSema(), Body,
false);
14813 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
14814 E->getRequiresKWLoc(),
E->getRBraceLoc(),
E, Body,
14815 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
14817 for (ParmVarDecl *Param : TransParams)
14819 Param->setDeclContext(Body);
14825 if (!TypeParamResult.isUnset())
14826 return TypeParamResult;
14829 if (getDerived().TransformRequiresExprRequirements(
E->getRequirements(),
14833 for (concepts::Requirement *Req : TransReqs) {
14834 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
14835 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
14836 ER->getReturnTypeRequirement()
14837 .getTypeConstraintTemplateParameterList()->getParam(0)
14838 ->setDeclContext(Body);
14843 return getDerived().RebuildRequiresExpr(
14844 E->getRequiresKWLoc(), Body,
E->getLParenLoc(), TransParams,
14845 E->getRParenLoc(), TransReqs,
E->getRBraceLoc());
14848template<
typename Derived>
14854 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
14855 TransReq = getDerived().TransformTypeRequirement(TypeReq);
14856 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
14857 TransReq = getDerived().TransformExprRequirement(ExprReq);
14859 TransReq = getDerived().TransformNestedRequirement(
14860 cast<concepts::NestedRequirement>(Req));
14863 Transformed.push_back(TransReq);
14868template<
typename Derived>
14873 if (getDerived().AlwaysRebuild())
14874 return getDerived().RebuildTypeRequirement(
14881 return getDerived().RebuildTypeRequirement(TransType);
14884template<
typename Derived>
14887 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
14896 TransExpr = TransExprRes.
get();
14899 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
14901 if (RetReq.isEmpty())
14902 TransRetReq.emplace();
14903 else if (RetReq.isSubstitutionFailure())
14904 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
14905 else if (RetReq.isTypeConstraint()) {
14907 RetReq.getTypeConstraintTemplateParameterList();
14909 getDerived().TransformTemplateParameterList(OrigTPL);
14912 TransRetReq.emplace(TPL);
14914 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
14915 if (
Expr *
E = dyn_cast<Expr *>(TransExpr))
14916 return getDerived().RebuildExprRequirement(
E, Req->
isSimple(),
14918 std::move(*TransRetReq));
14919 return getDerived().RebuildExprRequirement(
14920 cast<concepts::Requirement::SubstitutionDiagnostic *>(TransExpr),
14924template<
typename Derived>
14929 if (getDerived().AlwaysRebuild())
14930 return getDerived().RebuildNestedRequirement(
14938 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
14941template<
typename Derived>
14944 TypeSourceInfo *
T = getDerived().TransformType(
E->getQueriedTypeSourceInfo());
14948 if (!getDerived().AlwaysRebuild() &&
14949 T ==
E->getQueriedTypeSourceInfo())
14956 SubExpr = getDerived().TransformExpr(
E->getDimensionExpression());
14961 return getDerived().RebuildArrayTypeTrait(
E->getTrait(),
E->
getBeginLoc(),
T,
14965template<
typename Derived>
14967TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *
E) {
14972 SubExpr = getDerived().TransformExpr(
E->getQueriedExpression());
14973 if (SubExpr.isInvalid())
14976 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getQueriedExpression())
14980 return getDerived().RebuildExpressionTrait(
E->getTrait(),
E->
getBeginLoc(),
14984template <
typename Derived>
14988 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
14989 DRE, AddrTaken, RecoveryTSI);
14996 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
14998 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
15002template <
typename Derived>
15005 return TransformDependentScopeDeclRefExpr(
E,
false,
15009template <
typename Derived>
15013 assert(
E->getQualifierLoc());
15015 getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
15025 getDerived().TransformDeclarationNameInfo(
E->getNameInfo());
15029 if (!
E->hasExplicitTemplateArgs()) {
15030 if (!getDerived().AlwaysRebuild() && QualifierLoc ==
E->getQualifierLoc() &&
15033 NameInfo.
getName() ==
E->getDeclName())
15036 return getDerived().RebuildDependentScopeDeclRefExpr(
15037 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15038 IsAddressOfOperand, RecoveryTSI);
15041 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15042 if (getDerived().TransformTemplateArguments(
15043 E->getTemplateArgs(),
E->getNumTemplateArgs(), TransArgs))
15046 return getDerived().RebuildDependentScopeDeclRefExpr(
15047 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15051template<
typename Derived>
15053TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *
E) {
15057 if (getDerived().AllowSkippingCXXConstructExpr() &&
15058 ((
E->getNumArgs() == 1 ||
15059 (
E->getNumArgs() > 1 && getDerived().DropCallArgument(
E->getArg(1)))) &&
15060 (!getDerived().DropCallArgument(
E->getArg(0))) &&
15061 !
E->isListInitialization()))
15062 return getDerived().TransformInitializer(
E->getArg(0),
15065 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
15067 QualType
T = getDerived().TransformType(
E->
getType());
15071 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15072 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15076 bool ArgumentChanged =
false;
15079 EnterExpressionEvaluationContext Context(
15081 E->isListInitialization());
15082 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15087 if (!getDerived().AlwaysRebuild() &&
15089 Constructor ==
E->getConstructor() &&
15090 !ArgumentChanged) {
15097 return getDerived().RebuildCXXConstructExpr(
15099 E->hadMultipleCandidates(),
E->isListInitialization(),
15100 E->isStdInitListInitialization(),
E->requiresZeroInitialization(),
15101 E->getConstructionKind(),
E->getParenOrBraceRange());
15104template<
typename Derived>
15105ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
15106 CXXInheritedCtorInitExpr *
E) {
15107 QualType
T = getDerived().TransformType(
E->
getType());
15111 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15112 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15116 if (!getDerived().AlwaysRebuild() &&
15118 Constructor ==
E->getConstructor()) {
15125 return getDerived().RebuildCXXInheritedCtorInitExpr(
15126 T,
E->getLocation(), Constructor,
15127 E->constructsVBase(),
E->inheritedFromVBase());
15134template<
typename Derived>
15136TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *
E) {
15137 if (
auto *Dtor =
E->getTemporary()->getDestructor())
15139 const_cast<CXXDestructorDecl *
>(Dtor));
15140 return getDerived().TransformExpr(
E->getSubExpr());
15148template<
typename Derived>
15150TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *
E) {
15151 return getDerived().TransformExpr(
E->getSubExpr());
15154template<
typename Derived>
15156TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
15157 CXXTemporaryObjectExpr *
E) {
15158 TypeSourceInfo *
T =
15159 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15163 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15164 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15168 bool ArgumentChanged =
false;
15170 Args.reserve(
E->getNumArgs());
15172 EnterExpressionEvaluationContext Context(
15174 E->isListInitialization());
15175 if (TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15179 if (
E->isListInitialization() && !
E->isStdInitListInitialization()) {
15181 if (Res.isInvalid())
15183 Args = {Res.get()};
15187 if (!getDerived().AlwaysRebuild() &&
15188 T ==
E->getTypeSourceInfo() &&
15189 Constructor ==
E->getConstructor() &&
15190 !ArgumentChanged) {
15196 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
15197 return getDerived().RebuildCXXTemporaryObjectExpr(
15198 T, LParenLoc, Args,
E->
getEndLoc(),
E->isListInitialization());
15201template<
typename Derived>
15203TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *
E) {
15206 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15207 struct TransformedInitCapture {
15209 SourceLocation EllipsisLoc;
15214 InitCaptures.resize(
E->explicit_capture_end() -
E->explicit_capture_begin());
15216 CEnd =
E->capture_end();
15218 if (!
E->isInitCapture(
C))
15221 TransformedInitCapture &
Result = InitCaptures[
C -
E->capture_begin()];
15222 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15224 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
15225 std::optional<unsigned> NumExpansions) {
15226 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15229 if (NewExprInitResult.isInvalid()) {
15230 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
15233 Expr *NewExprInit = NewExprInitResult.get();
15235 QualType NewInitCaptureType =
15236 getSema().buildLambdaInitCaptureInitialization(
15237 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15238 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15239 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
15242 Result.Expansions.push_back(
15243 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15247 if (OldVD->isParameterPack()) {
15248 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
15250 .castAs<PackExpansionTypeLoc>();
15256 bool Expand =
true;
15257 bool RetainExpansion =
false;
15258 std::optional<unsigned> OrigNumExpansions =
15259 ExpansionTL.getTypePtr()->getNumExpansions();
15260 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15261 if (getDerived().TryExpandParameterPacks(
15262 ExpansionTL.getEllipsisLoc(),
15263 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
15264 RetainExpansion, NumExpansions))
15266 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15267 "capture since it cannot be extended");
15269 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15270 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15271 SubstInitCapture(SourceLocation(), std::nullopt);
15274 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15275 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15278 SubstInitCapture(SourceLocation(), std::nullopt);
15282 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
15283 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
15294 DeclContext *DC = getSema().CurContext;
15312 while (DC->isRequiresExprBody())
15313 DC = DC->getParent();
15314 if ((getSema().isUnevaluatedContext() ||
15315 getSema().isConstantEvaluatedContext()) &&
15316 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15319 CXXRecordDecl *OldClass =
E->getLambdaClass();
15320 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
15321 E->getIntroducerRange(),
nullptr, DependencyKind,
15322 E->getCaptureDefault());
15323 getDerived().transformedLocalDecl(OldClass, {
Class});
15325 CXXMethodDecl *NewCallOperator =
15326 getSema().CreateLambdaCallOperator(
E->getIntroducerRange(),
Class);
15329 getSema().buildLambdaScope(LSI, NewCallOperator,
E->getIntroducerRange(),
15330 E->getCaptureDefault(),
E->getCaptureDefaultLoc(),
15331 E->hasExplicitParameters(),
E->isMutable());
15334 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
15341 CEnd =
E->capture_end();
15345 if (
C->isImplicit())
15349 if (
C->capturesThis()) {
15355 Sema::CXXThisScopeRAII ThisScope(
15357 dyn_cast_if_present<CXXRecordDecl>(
15358 getSema().getFunctionLevelDeclContext()),
15360 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15367 if (
C->capturesVLAType())
15371 if (
E->isInitCapture(
C)) {
15372 TransformedInitCapture &NewC = InitCaptures[
C -
E->capture_begin()];
15374 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15377 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15379 QualType InitQualType = Info.second;
15380 if (
Init.isInvalid() || InitQualType.isNull()) {
15384 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15385 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15386 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15387 getSema().CurContext);
15392 NewVDs.push_back(NewVD);
15393 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15398 if (NewC.EllipsisLoc.isInvalid())
15399 LSI->ContainsUnexpandedParameterPack |=
15400 Init.get()->containsUnexpandedParameterPack();
15406 getDerived().transformedLocalDecl(OldVD, NewVDs);
15410 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15418 SourceLocation EllipsisLoc;
15419 if (
C->isPackExpansion()) {
15421 bool ShouldExpand =
false;
15422 bool RetainExpansion =
false;
15423 std::optional<unsigned> NumExpansions;
15424 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
15427 ShouldExpand, RetainExpansion,
15433 if (ShouldExpand) {
15437 auto *Pack = cast<ValueDecl>(
C->getCapturedVar());
15438 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15439 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15440 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15441 getDerived().TransformDecl(
C->getLocation(), Pack));
15442 if (!CapturedVar) {
15448 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15456 EllipsisLoc =
C->getEllipsisLoc();
15460 auto *CapturedVar = cast_or_null<ValueDecl>(
15461 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15462 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15469 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15470 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15473 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15476 getSema().finishLambdaExplicitCaptures(LSI);
15480 auto TPL = getDerived().TransformTemplateParameterList(
15481 E->getTemplateParameterList());
15482 LSI->GLTemplateParameterList = TPL;
15484 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15486 LSI->ContainsUnexpandedParameterPack |=
15487 TPL->containsUnexpandedParameterPack();
15490 TypeLocBuilder NewCallOpTLBuilder;
15491 TypeLoc OldCallOpTypeLoc =
15492 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15493 QualType NewCallOpType =
15494 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15495 if (NewCallOpType.isNull())
15497 LSI->ContainsUnexpandedParameterPack |=
15498 NewCallOpType->containsUnexpandedParameterPack();
15499 TypeSourceInfo *NewCallOpTSI =
15500 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15504 auto FPTL = NewCallOpTSI->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>();
15505 assert(FPTL &&
"Not a FunctionProtoType?");
15507 getSema().CompleteLambdaCallOperator(
15508 NewCallOperator,
E->getCallOperator()->getLocation(),
15509 E->getCallOperator()->getInnerLocStart(),
15510 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
15511 E->getCallOperator()->getConstexprKind(),
15512 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15513 E->hasExplicitResultType());
15515 getDerived().transformAttrs(
E->getCallOperator(), NewCallOperator);
15516 getDerived().transformedLocalDecl(
E->getCallOperator(), {NewCallOperator});
15520 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
15522 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15523 if (getDerived().ReplacingOriginal()) {
15524 Numbering = OldClass->getLambdaNumbering();
15527 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15532 getSema().PushExpressionEvaluationContext(
15533 E->getCallOperator()->isConsteval() ?
15536 getSema().currentEvaluationContext().InImmediateEscalatingFunctionContext =
15537 getSema().getLangOpts().CPlusPlus20 &&
15538 E->getCallOperator()->isImmediateEscalating();
15540 Sema::CodeSynthesisContext
C;
15543 getSema().pushCodeSynthesisContext(
C);
15549 getSema().popCodeSynthesisContext();
15552 FuncScopeCleanup.disable();
15554 if (Body.isInvalid()) {
15555 SavedContext.pop();
15564 auto LSICopy = *LSI;
15565 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15567 SavedContext.pop();
15602 DependencyKind = getDerived().ComputeLambdaDependency(&LSICopy);
15603 Class->setLambdaDependencyKind(DependencyKind);
15606 Class->setTypeForDecl(
nullptr);
15607 getSema().Context.getTypeDeclType(
Class);
15609 return getDerived().RebuildLambdaExpr(
E->
getBeginLoc(),
15610 Body.get()->getEndLoc(), &LSICopy);
15613template<
typename Derived>
15616 return TransformStmt(S);
15619template<
typename Derived>
15624 CEnd =
E->capture_end();
15628 if (!
C->isImplicit())
15632 if (
C->capturesThis()) {
15633 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15640 if (
C->capturesVLAType())
15643 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15644 assert(!
E->isInitCapture(
C) &&
"implicit init-capture?");
15647 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15648 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15653 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15659template<
typename Derived>
15664 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15668 bool ArgumentChanged =
false;
15670 Args.reserve(
E->getNumArgs());
15674 E->isListInitialization());
15675 if (getDerived().TransformExprs(
E->arg_begin(),
E->getNumArgs(),
true, Args,
15680 if (!getDerived().AlwaysRebuild() &&
15681 T ==
E->getTypeSourceInfo() &&
15686 return getDerived().RebuildCXXUnresolvedConstructExpr(
15687 T,
E->getLParenLoc(), Args,
E->getRParenLoc(),
E->isListInitialization());
15690template<
typename Derived>
15692TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
15693 CXXDependentScopeMemberExpr *
E) {
15698 QualType ObjectType;
15699 if (!
E->isImplicitAccess()) {
15700 OldBase =
E->getBase();
15701 Base = getDerived().TransformExpr(OldBase);
15702 if (
Base.isInvalid())
15707 bool MayBePseudoDestructor =
false;
15709 E->getOperatorLoc(),
15710 E->isArrow()? tok::arrow : tok::period,
15712 MayBePseudoDestructor);
15713 if (
Base.isInvalid())
15716 ObjectType = ObjectTy.get();
15717 BaseType = ((Expr*)
Base.get())->getType();
15720 BaseType = getDerived().TransformType(
E->getBaseType());
15726 NamedDecl *FirstQualifierInScope
15727 = getDerived().TransformFirstQualifierInScope(
15728 E->getFirstQualifierFoundInScope(),
15731 NestedNameSpecifierLoc QualifierLoc;
15732 if (
E->getQualifier()) {
15734 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc(),
15736 FirstQualifierInScope);
15741 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
15747 DeclarationNameInfo NameInfo
15748 = getDerived().TransformDeclarationNameInfo(
E->getMemberNameInfo());
15749 if (!NameInfo.getName())
15752 if (!
E->hasExplicitTemplateArgs()) {
15755 if (!getDerived().AlwaysRebuild() &&
15756 Base.get() == OldBase &&
15757 BaseType ==
E->getBaseType() &&
15758 QualifierLoc ==
E->getQualifierLoc() &&
15759 NameInfo.getName() ==
E->getMember() &&
15760 FirstQualifierInScope ==
E->getFirstQualifierFoundInScope())
15763 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15766 E->getOperatorLoc(),
15769 FirstQualifierInScope,
15774 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15775 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
15776 E->getNumTemplateArgs(),
15780 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15783 E->getOperatorLoc(),
15786 FirstQualifierInScope,
15791template <
typename Derived>
15792ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
15793 UnresolvedMemberExpr *Old) {
15797 if (!Old->isImplicitAccess()) {
15798 Base = getDerived().TransformExpr(Old->getBase());
15799 if (
Base.isInvalid())
15802 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
15803 if (
Base.isInvalid())
15805 BaseType =
Base.get()->getType();
15807 BaseType = getDerived().TransformType(Old->getBaseType());
15810 NestedNameSpecifierLoc QualifierLoc;
15811 if (Old->getQualifierLoc()) {
15813 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
15818 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
15823 if (TransformOverloadExprDecls(Old,
false, R))
15827 if (Old->getNamingClass()) {
15828 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
15829 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
15833 R.setNamingClass(NamingClass);
15836 TemplateArgumentListInfo TransArgs;
15837 if (Old->hasExplicitTemplateArgs()) {
15838 TransArgs.setLAngleLoc(Old->getLAngleLoc());
15839 TransArgs.setRAngleLoc(Old->getRAngleLoc());
15840 if (getDerived().TransformTemplateArguments(
15841 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
15849 NamedDecl *FirstQualifierInScope =
nullptr;
15851 return getDerived().RebuildUnresolvedMemberExpr(
15852 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
15853 TemplateKWLoc, FirstQualifierInScope, R,
15854 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
15857template<
typename Derived>
15859TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *
E) {
15862 ExprResult SubExpr = getDerived().TransformExpr(
E->getOperand());
15863 if (SubExpr.isInvalid())
15866 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getOperand())
15869 return getDerived().RebuildCXXNoexceptExpr(
E->
getSourceRange(),SubExpr.get());
15872template<
typename Derived>
15874TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *
E) {
15875 ExprResult Pattern = getDerived().TransformExpr(
E->getPattern());
15876 if (Pattern.isInvalid())
15879 if (!getDerived().AlwaysRebuild() && Pattern.get() ==
E->getPattern())
15882 return getDerived().RebuildPackExpansion(Pattern.get(),
E->getEllipsisLoc(),
15883 E->getNumExpansions());
15886template<
typename Derived>
15888TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *
E) {
15898 TemplateArgument ArgStorage;
15901 if (
E->isPartiallySubstituted()) {
15902 PackArgs =
E->getPartialArguments();
15905 bool ShouldExpand =
false;
15906 bool RetainExpansion =
false;
15907 std::optional<unsigned> NumExpansions;
15908 if (getDerived().TryExpandParameterPacks(
E->getOperatorLoc(),
E->getPackLoc(),
15910 ShouldExpand, RetainExpansion,
15916 if (ShouldExpand) {
15917 auto *Pack =
E->getPack();
15918 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
15919 ArgStorage = getSema().Context.getPackExpansionType(
15921 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
15922 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
15924 auto *VD = cast<ValueDecl>(Pack);
15925 ExprResult DRE = getSema().BuildDeclRefExpr(
15926 VD, VD->getType().getNonLValueExprType(getSema().Context),
15929 if (DRE.isInvalid())
15931 ArgStorage =
new (getSema().Context)
15932 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
15933 E->getPackLoc(), std::nullopt);
15935 PackArgs = ArgStorage;
15940 if (!PackArgs.size()) {
15941 auto *Pack = cast_or_null<NamedDecl>(
15942 getDerived().TransformDecl(
E->getPackLoc(),
E->getPack()));
15945 return getDerived().RebuildSizeOfPackExpr(
15946 E->getOperatorLoc(), Pack,
E->getPackLoc(),
E->getRParenLoc(),
15951 std::optional<unsigned>
Result = 0;
15952 for (
const TemplateArgument &Arg : PackArgs) {
15953 if (!Arg.isPackExpansion()) {
15958 TemplateArgumentLoc ArgLoc;
15959 InventTemplateArgumentLoc(Arg, ArgLoc);
15962 SourceLocation Ellipsis;
15963 std::optional<unsigned> OrigNumExpansions;
15964 TemplateArgumentLoc Pattern =
15965 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
15966 OrigNumExpansions);
15969 TemplateArgumentLoc OutPattern;
15970 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15971 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
15976 std::optional<unsigned> NumExpansions =
15977 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
15978 if (!NumExpansions) {
15991 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
15993 E->getRParenLoc(), *
Result, {});
15995 TemplateArgumentListInfo TransformedPackArgs(
E->getPackLoc(),
15998 TemporaryBase Rebase(*
this,
E->getPackLoc(), getBaseEntity());
15999 typedef TemplateArgumentLocInventIterator<
16000 Derived,
const TemplateArgument*> PackLocIterator;
16001 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16002 PackLocIterator(*
this, PackArgs.end()),
16003 TransformedPackArgs,
true))
16010 bool PartialSubstitution =
false;
16011 for (
auto &
Loc : TransformedPackArgs.arguments()) {
16012 Args.push_back(
Loc.getArgument());
16013 if (
Loc.getArgument().isPackExpansion())
16014 PartialSubstitution =
true;
16017 if (PartialSubstitution)
16018 return getDerived().RebuildSizeOfPackExpr(
16019 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
16020 std::nullopt, Args);
16022 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
16023 E->getPackLoc(),
E->getRParenLoc(),
16027template <
typename Derived>
16029TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *
E) {
16036 EnterExpressionEvaluationContext ConstantContext(
16038 IndexExpr = getDerived().TransformExpr(
E->getIndexExpr());
16039 if (IndexExpr.isInvalid())
16044 bool FullySubstituted =
true;
16045 if (!
E->expandsToEmptyPack() &&
E->getExpressions().empty()) {
16046 Expr *Pattern =
E->getPackIdExpression();
16048 getSema().collectUnexpandedParameterPacks(
E->getPackIdExpression(),
16050 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16054 bool ShouldExpand =
true;
16055 bool RetainExpansion =
false;
16056 std::optional<unsigned> OrigNumExpansions;
16057 std::optional<unsigned> NumExpansions = OrigNumExpansions;
16058 if (getDerived().TryExpandParameterPacks(
16060 ShouldExpand, RetainExpansion, NumExpansions))
16062 if (!ShouldExpand) {
16063 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16064 ExprResult Pack = getDerived().TransformExpr(Pattern);
16065 if (Pack.isInvalid())
16067 return getDerived().RebuildPackIndexingExpr(
16068 E->getEllipsisLoc(),
E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16071 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16072 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
16073 ExprResult Out = getDerived().TransformExpr(Pattern);
16074 if (Out.isInvalid())
16076 if (Out.get()->containsUnexpandedParameterPack()) {
16077 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
16078 OrigNumExpansions);
16079 if (Out.isInvalid())
16081 FullySubstituted =
false;
16083 ExpandedExprs.push_back(Out.get());
16087 if (RetainExpansion) {
16088 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16090 ExprResult Out = getDerived().TransformExpr(Pattern);
16091 if (Out.isInvalid())
16094 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
16095 OrigNumExpansions);
16096 if (Out.isInvalid())
16098 FullySubstituted =
false;
16099 ExpandedExprs.push_back(Out.get());
16101 }
else if (!
E->expandsToEmptyPack()) {
16102 if (getDerived().TransformExprs(
E->getExpressions().data(),
16103 E->getExpressions().size(),
false,
16108 return getDerived().RebuildPackIndexingExpr(
16109 E->getEllipsisLoc(),
E->getRSquareLoc(),
E->getPackIdExpression(),
16110 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16113template<
typename Derived>
16115TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
16116 SubstNonTypeTemplateParmPackExpr *
E) {
16121template<
typename Derived>
16123TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
16124 SubstNonTypeTemplateParmExpr *
E) {
16129template<
typename Derived>
16131TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *
E) {
16136template <
typename Derived>
16137ExprResult TreeTransform<Derived>::TransformResolvedUnexpandedPackExpr(
16138 ResolvedUnexpandedPackExpr *
E) {
16139 bool ArgumentChanged =
false;
16141 if (TransformExprs(
E->getExprs().begin(),
E->getNumExprs(),
16142 false, NewExprs, &ArgumentChanged))
16145 if (!AlwaysRebuild() && !ArgumentChanged)
16154template<
typename Derived>
16156TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
16157 MaterializeTemporaryExpr *
E) {
16158 return getDerived().TransformExpr(
E->getSubExpr());
16161template<
typename Derived>
16163TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *
E) {
16164 UnresolvedLookupExpr *
Callee =
nullptr;
16165 if (Expr *OldCallee =
E->getCallee()) {
16166 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16167 if (CalleeResult.isInvalid())
16169 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
16172 Expr *Pattern =
E->getPattern();
16175 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16176 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16180 bool Expand =
true;
16181 bool RetainExpansion =
false;
16182 std::optional<unsigned> OrigNumExpansions =
E->getNumExpansions(),
16183 NumExpansions = OrigNumExpansions;
16184 if (getDerived().TryExpandParameterPacks(
E->getEllipsisLoc(),
16187 Expand, RetainExpansion,
16194 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16197 E->getLHS() ? getDerived().TransformExpr(
E->getLHS()) :
ExprResult();
16198 if (LHS.isInvalid())
16202 E->getRHS() ? getDerived().TransformExpr(
E->getRHS()) :
ExprResult();
16203 if (RHS.isInvalid())
16206 if (!getDerived().AlwaysRebuild() &&
16207 LHS.get() ==
E->getLHS() && RHS.get() ==
E->getRHS())
16210 return getDerived().RebuildCXXFoldExpr(
16212 E->getEllipsisLoc(), RHS.get(),
E->
getEndLoc(), NumExpansions);
16218 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
16219 SemaRef.
Diag(
E->getEllipsisLoc(),
16220 clang::diag::err_fold_expression_limit_exceeded)
16221 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16223 SemaRef.
Diag(
E->getEllipsisLoc(), diag::note_bracket_depth);
16232 bool LeftFold =
E->isLeftFold();
16236 if (!LeftFold && RetainExpansion) {
16237 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16239 ExprResult Out = getDerived().TransformExpr(Pattern);
16240 if (Out.isInvalid())
16243 Result = getDerived().RebuildCXXFoldExpr(
16250 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16251 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
16252 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16253 ExprResult Out = getDerived().TransformExpr(Pattern);
16254 if (Out.isInvalid())
16257 if (Out.get()->containsUnexpandedParameterPack()) {
16259 Result = getDerived().RebuildCXXFoldExpr(
16261 E->getOperator(),
E->getEllipsisLoc(),
16263 OrigNumExpansions);
16264 }
else if (
Result.isUsable()) {
16266 Expr *LHS = LeftFold ?
Result.get() : Out.get();
16267 Expr *RHS = LeftFold ? Out.get() :
Result.get();
16269 UnresolvedSet<16> Functions;
16270 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
16271 Result = getDerived().RebuildCXXOperatorCallExpr(
16273 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16274 Functions, LHS, RHS);
16276 Result = getDerived().RebuildBinaryOperator(
E->getEllipsisLoc(),
16277 E->getOperator(), LHS, RHS);
16288 if (LeftFold && RetainExpansion) {
16289 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16291 ExprResult Out = getDerived().TransformExpr(Pattern);
16292 if (Out.isInvalid())
16295 Result = getDerived().RebuildCXXFoldExpr(
16297 E->getEllipsisLoc(), Out.get(),
E->
getEndLoc(), OrigNumExpansions);
16302 if (ParenExpr *PE = dyn_cast_or_null<ParenExpr>(
Result.get()))
16303 PE->setIsProducedByFoldExpansion();
16308 return getDerived().RebuildEmptyCXXFoldExpr(
E->getEllipsisLoc(),
16313template <
typename Derived>
16315TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *
E) {
16318 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16322 return getDerived().RebuildParenListExpr(
E->
getBeginLoc(), TransformedInits,
16326template<
typename Derived>
16328TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
16329 CXXStdInitializerListExpr *
E) {
16330 return getDerived().TransformExpr(
E->getSubExpr());
16333template<
typename Derived>
16335TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *
E) {
16339template<
typename Derived>
16341TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *
E) {
16345template<
typename Derived>
16347TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *
E) {
16348 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
16349 if (SubExpr.isInvalid())
16352 if (!getDerived().AlwaysRebuild() &&
16353 SubExpr.get() ==
E->getSubExpr())
16356 return getDerived().RebuildObjCBoxedExpr(
E->
getSourceRange(), SubExpr.get());
16359template<
typename Derived>
16361TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *
E) {
16364 bool ArgChanged =
false;
16365 if (getDerived().TransformExprs(
E->getElements(),
E->getNumElements(),
16366 false, Elements, &ArgChanged))
16369 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16377template<
typename Derived>
16379TreeTransform<Derived>::TransformObjCDictionaryLiteral(
16380 ObjCDictionaryLiteral *
E) {
16383 bool ArgChanged =
false;
16384 for (
unsigned I = 0, N =
E->getNumElements(); I != N; ++I) {
16385 ObjCDictionaryElement OrigElement =
E->getKeyValueElement(I);
16387 if (OrigElement.isPackExpansion()) {
16390 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16391 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16392 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16396 bool Expand =
true;
16397 bool RetainExpansion =
false;
16398 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
16399 std::optional<unsigned> NumExpansions = OrigNumExpansions;
16400 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16401 OrigElement.Value->getEndLoc());
16402 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
16403 PatternRange, Unexpanded, Expand,
16404 RetainExpansion, NumExpansions))
16411 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16412 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16413 if (Key.isInvalid())
16416 if (Key.get() != OrigElement.Key)
16420 if (
Value.isInvalid())
16423 if (
Value.get() != OrigElement.Value)
16426 ObjCDictionaryElement Expansion = {
16427 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16429 Elements.push_back(Expansion);
16439 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16440 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
16441 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16442 if (Key.isInvalid())
16446 if (
Value.isInvalid())
16449 ObjCDictionaryElement Element = {
16450 Key.get(),
Value.get(), SourceLocation(), NumExpansions
16456 if (Key.get()->containsUnexpandedParameterPack() ||
16457 Value.get()->containsUnexpandedParameterPack())
16458 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16460 Elements.push_back(Element);
16470 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16471 if (Key.isInvalid())
16474 if (Key.get() != OrigElement.Key)
16479 = getDerived().TransformExpr(OrigElement.Value);
16480 if (
Value.isInvalid())
16483 if (
Value.get() != OrigElement.Value)
16486 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
16488 Elements.push_back(Element);
16491 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16494 return getDerived().RebuildObjCDictionaryLiteral(
E->
getSourceRange(),
16498template<
typename Derived>
16500TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *
E) {
16501 TypeSourceInfo *EncodedTypeInfo
16502 = getDerived().TransformType(
E->getEncodedTypeSourceInfo());
16503 if (!EncodedTypeInfo)
16506 if (!getDerived().AlwaysRebuild() &&
16507 EncodedTypeInfo ==
E->getEncodedTypeSourceInfo())
16510 return getDerived().RebuildObjCEncodeExpr(
E->getAtLoc(),
16512 E->getRParenLoc());
16515template<
typename Derived>
16517TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *
E) {
16522 return getDerived().TransformExpr(
E->getSubExpr());
16525template<
typename Derived>
16527TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *
E) {
16528 TypeSourceInfo *TSInfo
16529 = getDerived().TransformType(
E->getTypeInfoAsWritten());
16537 if (!getDerived().AlwaysRebuild() &&
16538 TSInfo ==
E->getTypeInfoAsWritten() &&
16539 Result.get() ==
E->getSubExpr())
16543 E->getLParenLoc(),
E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
16547template <
typename Derived>
16548ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
16549 ObjCAvailabilityCheckExpr *
E) {
16553template<
typename Derived>
16555TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *
E) {
16557 bool ArgChanged =
false;
16559 Args.reserve(
E->getNumArgs());
16560 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
false, Args,
16566 TypeSourceInfo *ReceiverTypeInfo
16567 = getDerived().TransformType(
E->getClassReceiverTypeInfo());
16568 if (!ReceiverTypeInfo)
16572 if (!getDerived().AlwaysRebuild() &&
16573 ReceiverTypeInfo ==
E->getClassReceiverTypeInfo() && !ArgChanged)
16578 E->getSelectorLocs(SelLocs);
16579 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16582 E->getMethodDecl(),
16589 if (!
E->getMethodDecl())
16594 E->getSelectorLocs(SelLocs);
16595 return getDerived().RebuildObjCMessageExpr(
E->getSuperLoc(),
16598 E->getReceiverType(),
16599 E->getMethodDecl(),
16607 "Only class and instance messages may be instantiated");
16609 = getDerived().TransformExpr(
E->getInstanceReceiver());
16610 if (Receiver.isInvalid())
16614 if (!getDerived().AlwaysRebuild() &&
16615 Receiver.get() ==
E->getInstanceReceiver() && !ArgChanged)
16620 E->getSelectorLocs(SelLocs);
16621 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16624 E->getMethodDecl(),
16630template<
typename Derived>
16632TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *
E) {
16636template<
typename Derived>
16638TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *
E) {
16642template<
typename Derived>
16644TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *
E) {
16647 if (
Base.isInvalid())
16653 if (!getDerived().AlwaysRebuild() &&
16654 Base.get() ==
E->getBase())
16657 return getDerived().RebuildObjCIvarRefExpr(
Base.get(),
E->getDecl(),
16659 E->isArrow(),
E->isFreeIvar());
16662template<
typename Derived>
16664TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *
E) {
16667 if (!
E->isObjectReceiver())
16672 if (
Base.isInvalid())
16678 if (!getDerived().AlwaysRebuild() &&
16679 Base.get() ==
E->getBase())
16682 if (
E->isExplicitProperty())
16683 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16684 E->getExplicitProperty(),
16687 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16689 E->getImplicitPropertyGetter(),
16690 E->getImplicitPropertySetter(),
16694template<
typename Derived>
16696TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *
E) {
16699 if (
Base.isInvalid())
16703 ExprResult Key = getDerived().TransformExpr(
E->getKeyExpr());
16704 if (Key.isInvalid())
16708 if (!getDerived().AlwaysRebuild() &&
16709 Key.get() ==
E->getKeyExpr() &&
Base.get() ==
E->getBaseExpr())
16712 return getDerived().RebuildObjCSubscriptRefExpr(
E->getRBracket(),
16713 Base.get(), Key.get(),
16714 E->getAtIndexMethodDecl(),
16715 E->setAtIndexMethodDecl());
16718template<
typename Derived>
16720TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *
E) {
16723 if (
Base.isInvalid())
16727 if (!getDerived().AlwaysRebuild() &&
16728 Base.get() ==
E->getBase())
16731 return getDerived().RebuildObjCIsaExpr(
Base.get(),
E->getIsaMemberLoc(),
16736template<
typename Derived>
16738TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *
E) {
16739 bool ArgumentChanged =
false;
16741 SubExprs.reserve(
E->getNumSubExprs());
16742 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16743 SubExprs, &ArgumentChanged))
16746 if (!getDerived().AlwaysRebuild() &&
16750 return getDerived().RebuildShuffleVectorExpr(
E->getBuiltinLoc(),
16752 E->getRParenLoc());
16755template<
typename Derived>
16757TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *
E) {
16758 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16759 if (SrcExpr.isInvalid())
16762 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
16766 if (!getDerived().AlwaysRebuild() &&
16767 Type ==
E->getTypeSourceInfo() &&
16768 SrcExpr.get() ==
E->getSrcExpr())
16771 return getDerived().RebuildConvertVectorExpr(
E->getBuiltinLoc(),
16772 SrcExpr.get(), Type,
16773 E->getRParenLoc());
16776template<
typename Derived>
16778TreeTransform<Derived>::TransformBlockExpr(BlockExpr *
E) {
16779 BlockDecl *oldBlock =
E->getBlockDecl();
16782 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
16785 blockScope->TheDecl->setBlockMissingReturnType(
16786 oldBlock->blockMissingReturnType());
16791 const FunctionProtoType *exprFunctionType =
E->getFunctionType();
16794 Sema::ExtParameterInfoBuilder extParamInfos;
16795 if (getDerived().TransformFunctionTypeParams(
16796 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
16797 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
16799 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16803 QualType exprResultType =
16804 getDerived().TransformType(exprFunctionType->getReturnType());
16806 auto epi = exprFunctionType->getExtProtoInfo();
16807 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
16810 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
16814 if (!params.empty())
16815 blockScope->TheDecl->setParams(params);
16817 if (!oldBlock->blockMissingReturnType()) {
16818 blockScope->HasImplicitReturnType =
false;
16819 blockScope->ReturnType = exprResultType;
16823 StmtResult body = getDerived().TransformStmt(
E->getBody());
16824 if (body.isInvalid()) {
16825 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16833 for (
const auto &I : oldBlock->captures()) {
16834 VarDecl *oldCapture = I.getVariable();
16837 if (oldCapture->isParameterPack())
16840 VarDecl *newCapture =
16841 cast<VarDecl>(getDerived().TransformDecl(
E->getCaretLocation(),
16843 assert(blockScope->CaptureMap.count(newCapture));
16849 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
16850 "this pointer isn't captured in the old block");
16858template<
typename Derived>
16860TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *
E) {
16861 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16862 if (SrcExpr.isInvalid())
16865 QualType
Type = getDerived().TransformType(
E->
getType());
16868 E->getRParenLoc());
16871template<
typename Derived>
16873TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *
E) {
16874 bool ArgumentChanged =
false;
16876 SubExprs.reserve(
E->getNumSubExprs());
16877 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16878 SubExprs, &ArgumentChanged))
16881 if (!getDerived().AlwaysRebuild() &&
16885 return getDerived().RebuildAtomicExpr(
E->getBuiltinLoc(), SubExprs,
16886 E->getOp(),
E->getRParenLoc());
16893template<
typename Derived>
16897 getDerived().getBaseEntity());
16900template<
typename Derived>
16904 getDerived().getBaseEntity());
16907template<
typename Derived>
16910 bool WrittenAsLValue,
16913 Sigil, getDerived().getBaseEntity());
16916template<
typename Derived>
16922 getDerived().getBaseEntity());
16925template<
typename Derived>
16933 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16937template<
typename Derived>
16949 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
16950 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16955template<
typename Derived>
16962template <
typename Derived>
16965 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16966 if (SizeExpr || !Size)
16968 IndexTypeQuals, BracketsRange,
16969 getDerived().getBaseEntity());
16977 for (
const auto &
T : Types)
16989 IndexTypeQuals, BracketsRange,
16990 getDerived().getBaseEntity());
16993template <
typename Derived>
16996 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16997 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
16998 IndexTypeQuals, BracketsRange);
17001template <
typename Derived>
17005 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17006 IndexTypeQuals, BracketsRange);
17009template <
typename Derived>
17012 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17013 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17015 IndexTypeQuals, BracketsRange);
17018template <
typename Derived>
17021 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17022 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17024 IndexTypeQuals, BracketsRange);
17027template <
typename Derived>
17034template <
typename Derived>
17036 unsigned NumElements,
17042template <
typename Derived>
17049template<
typename Derived>
17051 unsigned NumElements,
17054 NumElements,
true);
17061template<
typename Derived>
17069template <
typename Derived>
17071 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17076template <
typename Derived>
17084template <
typename Derived>
17089 getDerived().getBaseLocation(),
17090 getDerived().getBaseEntity(),
17094template<
typename Derived>
17099template<
typename Derived>
17102 assert(
D &&
"no decl found");
17106 if (
auto *UPD = dyn_cast<UsingPackDecl>(
D)) {
17110 if (UPD->expansions().empty()) {
17111 getSema().Diag(
Loc, diag::err_using_pack_expansion_empty)
17112 << UPD->isCXXClassMember() << UPD;
17121 for (
auto *
E : UPD->expansions()) {
17127 else if (
T.isNull())
17131 "mismatched resolved types in using pack expansion");
17133 return T.isNull() ? FallbackT :
T;
17134 }
else if (
auto *Using = dyn_cast<UsingDecl>(
D)) {
17135 assert(Using->hasTypename() &&
17136 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17139 assert(++Using->shadow_begin() == Using->shadow_end());
17148 assert(isa<UnresolvedUsingTypenameDecl>(
D) &&
17149 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17151 cast<UnresolvedUsingTypenameDecl>(
D));
17155template <
typename Derived>
17161template<
typename Derived>
17167template <
typename Derived>
17172template <
typename Derived>
17178 FullySubstituted, Expansions);
17181template<
typename Derived>
17188template<
typename Derived>
17196template<
typename Derived>
17202template<
typename Derived>
17210template <
typename Derived>
17221template <
typename Derived>
17227template<
typename Derived>
17236template<
typename Derived>
17244 bool AllowInjectedClassName) {
17248 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17251 AllowInjectedClassName);
17252 return Template.
get();
17255template<
typename Derived>
17262 bool AllowInjectedClassName) {
17265 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17266 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
17268 getSema().ActOnTemplateName(
17270 false, Template, AllowInjectedClassName);
17271 return Template.
get();
17274template <
typename Derived>
17279 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17285 Opc,
First, Second);
17300 if (Op == OO_Subscript) {
17301 if (!
First->getType()->isOverloadableType() &&
17303 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17305 }
else if (Op == OO_Arrow) {
17308 if (
First->getType()->isDependentType())
17312 }
else if (Second ==
nullptr || isPostIncDec) {
17313 if (!
First->getType()->isOverloadableType() ||
17314 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
17321 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17325 !
First->getType()->isOverloadableType() &&
17340 if (!Second || isPostIncDec) {
17350 First, Second, RequiresADL);
17357template<
typename Derived>
17372 ->template getAs<RecordType>())){
17375 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17376 CCLoc, TildeLoc, Destroyed);
17388 if (!ScopeType->getType()->getAs<
TagType>()) {
17389 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17390 diag::err_expected_class_or_namespace)
17391 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
17399 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
17400 OperatorLoc, isArrow,
17408template<
typename Derived>
17416 for (
unsigned I = 0; I < NumParams; ++I) {
17417 if (I != ContextParamPos) {
17423 Params.push_back(std::make_pair(StringRef(), QualType()));
17426 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
17427 S->getCapturedRegionKind(), Params);
17430 Sema::CompoundScopeRAII CompoundScope(getSema());
17431 Body = getDerived().TransformStmt(S->getCapturedStmt());
17434 if (Body.isInvalid()) {
17435 getSema().ActOnCapturedRegionError();
17439 return getSema().ActOnCapturedRegionEnd(Body.get());
17442template <
typename Derived>
17444TreeTransform<Derived>::TransformSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
17448 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17452template <
typename Derived>
17453ExprResult TreeTransform<Derived>::TransformHLSLOutArgExpr(HLSLOutArgExpr *
E) {
17456 return getDerived().TransformExpr(
E->getArgLValue());
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Target Target
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
DeclarationNameTable DeclarationNames
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
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.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex, SubstTemplateTypeParmTypeFlag Flag=SubstTemplateTypeParmTypeFlag::None) const
Retrieve a substitution-result type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType UnsignedLongTy
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 PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
CanQualType UnsignedInt128Ty
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
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 getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getRParenLoc() const
TypeLoc getValueLoc() const
SourceLocation getKWLoc() const
SourceLocation getLParenLoc() const
Attr - This represents one attribute.
attr::Kind getKind() const
Represents an attribute applied to a statement.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
void setIsVariadic(bool value)
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
Represents binding an expression to a temporary.
CXXCatchStmt - This represents a C++ catch block.
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
Represents a call to an inherited base class constructor from an inheriting constructor.
Abstract class common to all of the C++ "named"/"keyword" casts.
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
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.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
SourceLocation getBegin() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
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...
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.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
The name of a declaration.
@ CXXConversionFunctionName
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a dependent template name that cannot be resolved prior to template instantiation.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
SourceLocation getTemplateNameLoc() const
SourceLocation getLAngleLoc() const
void setTemplateKeywordLoc(SourceLocation Loc)
SourceLocation getTemplateKeywordLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
SourceLocation getRAngleLoc() const
SourceLocation getElaboratedKeywordLoc() const
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
Represents a template specialization type whose template cannot be resolved, e.g.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
TypeLoc getNamedTypeLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
RAII object that enters a new expression evaluation context.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
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.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
QualType getCallResultType() const
Determine the type of an expression that calls this function.
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present,...
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
QualType getReturnType() const
AssociationTy< false > Association
One of these records is kept for each identifier that is lexed.
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 ...
Represents an implicitly-generated value initialization of an object of a given type.
const TypeClass * getTypePtr() const
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'.
Represents the declaration of a label.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
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.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in 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*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This represents clauses with a list of expressions that are mappable.
ObjCIvarDecl - Represents an ObjC instance variable.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
bool isInstanceMethod() const
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents the declaration of an Objective-C type parameter.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Wrapper for void* pointer.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
Represents a pack expansion of types.
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
A (possibly-)qualified type.
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.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
static ResolvedUnexpandedPackExpr * Create(ASTContext &C, SourceLocation BeginLoc, QualType T, unsigned NumExprs)
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
OpenACCDirectiveKind getDirectiveKind() const
SourceLocation getEndLoc() const
void setLParenLoc(SourceLocation EndLoc)
void setConditionDetails(Expr *ConditionExpr)
void setCollapseDetails(bool IsForce, Expr *LoopCount)
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
void setDefaultDetails(OpenACCDefaultClauseKind DefKind)
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
void setWaitDetails(Expr *DevNum, SourceLocation QueuesLoc, llvm::SmallVector< Expr * > &&IntExprs)
void setEndLoc(SourceLocation EndLoc)
Expr * getLoopCount() const
void setIntExprDetails(ArrayRef< Expr * > IntExprs)
OpenACCDefaultClauseKind getDefaultClauseKind() const
void ActOnWhileStmt(SourceLocation WhileLoc)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
ExprResult checkAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
QualType BuildParenType(QualType T)
Build a paren type including T.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
static std::enable_if_t< std::is_base_of_v< Attr, AttrInfo >, SourceLocation > getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
@ 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.
void ActOnStartStmtExpr()
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
std::optional< FunctionEffectMode > ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName)
Try to parse the conditional expression attached to an effect attribute (e.g.
VarDecl * buildCoroutinePromise(SourceLocation Loc)
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.
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
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.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
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 BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
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)
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
ConvertVectorExpr - Handle __builtin_convertvector.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
DeclContext * getCurLexicalContext() const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
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...
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
@ TryCapture_ExplicitByVal
@ TryCapture_ExplicitByRef
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
bool CheckRebuiltStmtAttributes(ArrayRef< const Attr * > Attrs)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
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.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, const FunctionEffectWithCondition &EC, SourceLocation NewAttrLoc)
Warn and return true if adding a function effect to a set would create a conflict.
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.
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
ExprResult BuiltinShuffleVector(CallExpr *TheCall)
BuiltinShuffleVector - Handle __builtin_shufflevector.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
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...
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
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,...
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, std::optional< unsigned > Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
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
A structure for storing an already-substituted template template parameter pack.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
TypeSourceInfo * getTypeSourceInfo() const
SourceRange getSourceRange() const LLVM_READONLY
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getSourceExpression() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
SourceLocation getTemplateNameLoc() const
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
Wrapper for template type parameters.
The top declaration context.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
SourceLocation getTemplateKeywordLoc() const
Get the SourceLocation of the template keyword (if any).
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
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 TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
ElaboratedTypeKeyword getKeyword() const
The base class of the type hierarchy.
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isFunctionType() const
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
TypedefNameDecl * getTypedefNameDecl() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
A set of unresolved declarations.
void addDecl(NamedDecl *D)
A set of unresolved declarations.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
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...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
bool Inc(InterpState &S, CodePtr OpPC)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
ArrayTypeTrait
Names for the array type traits.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, ResolvedUnexpandedPackExpr * >, SourceLocation > UnexpandedParameterPack
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
ActionResult< Expr * > ExprResult
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
ActionResult< Stmt * > StmtResult
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
@ 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.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
const FunctionProtoType * T
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
MutableArrayRef< Expr * > MultiExprArg
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
This structure contains most locations needed for by an OMPVarListClause.
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.