13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &Self)
135 : Self(Self), ResetPackSubstIndex(Self.getSema(), std::nullopt) {
136 Old = Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
157 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
161 return static_cast<const Derived&
>(*this);
226 OldLocation = Self.getDerived().getBaseLocation();
227 OldEntity = Self.getDerived().getBaseEntity();
230 Self.getDerived().setBase(Location, Entity);
234 Self.getDerived().setBase(OldLocation, OldEntity);
264 return E->isDefaultArgument();
307 bool FailOnPackProducingTemplates,
308 bool &ShouldExpand,
bool &RetainExpansion,
310 ShouldExpand =
false;
338 struct ForgetSubstitutionRAII {
343 ForgetSubstitutionRAII(Derived &Self) : Self(Self) {
344 Old = Self.ForgetSubstitution();
347 ~ForgetSubstitutionRAII() { Self.RememberSubstitution(std::move(Old)); }
447 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
448#include "clang/Basic/AttrList.inc"
458 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
459 const X##Attr *A) { \
460 return getDerived().Transform##X##Attr(A); \
462#include "clang/Basic/AttrList.inc"
508 bool *ArgChanged =
nullptr);
517 llvm::DenseMap<Decl *, Decl *>::iterator Known
520 return Known->second;
548 assert(
New.size() == 1 &&
549 "must override transformedLocalDecl if performing pack expansion");
587 NamedDecl *FirstQualifierInScope =
nullptr);
632 NamedDecl *FirstQualifierInScope =
nullptr,
633 bool AllowInjectedClassName =
false);
645 bool Uneval =
false);
672 bool Uneval =
false) {
691 template<
typename InputIterator>
695 bool Uneval =
false);
720#define ABSTRACT_TYPELOC(CLASS, PARENT)
721#define TYPELOC(CLASS, PARENT) \
722 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
723#include "clang/AST/TypeLocNodes.def"
727 bool SuppressObjCLifetime);
731 bool SuppressObjCLifetime);
733 template<
typename Fn>
750 bool AllowInjectedClassName);
778 return getDerived().TransformFunctionTypeParams(
779 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
797 KWLoc, Params,
nullptr,
798 nullptr, PTypes, &TransParams, PInfos))
812 bool ExpectParameterPack);
839 bool IsAddressOfOperand,
847 bool IsAddressOfOperand);
855#define STMT(Node, Parent) \
856 LLVM_ATTRIBUTE_NOINLINE \
857 StmtResult Transform##Node(Node *S);
858#define VALUESTMT(Node, Parent) \
859 LLVM_ATTRIBUTE_NOINLINE \
860 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
861#define EXPR(Node, Parent) \
862 LLVM_ATTRIBUTE_NOINLINE \
863 ExprResult Transform##Node(Node *E);
864#define ABSTRACT_STMT(Stmt)
865#include "clang/AST/StmtNodes.inc"
867#define GEN_CLANG_CLAUSE_CLASS
868#define CLAUSE_CLASS(Enum, Str, Class) \
869 LLVM_ATTRIBUTE_NOINLINE \
870 OMPClause *Transform##Class(Class *S);
871#include "llvm/Frontend/OpenMP/OMP.inc"
949 const llvm::APInt *Size,
Expr *SizeExpr,
950 unsigned IndexTypeQuals,
SourceRange BracketsRange);
959 const llvm::APInt &Size,
Expr *SizeExpr,
960 unsigned IndexTypeQuals,
970 unsigned IndexTypeQuals,
980 unsigned IndexTypeQuals,
991 unsigned IndexTypeQuals,
1029 unsigned NumColumns);
1046 Expr *AddrSpaceExpr,
1122 bool FullySubstituted,
1136 TypeConstraintConcept,
1137 TypeConstraintArgs);
1174 bool AllowInjectedClassName) {
1194 bool DeducedTSTContext) {
1196 SS.
Adopt(QualifierLoc);
1209 *
Id, IdLoc, DeducedTSTContext);
1227 switch (
Result.getResultKind()) {
1238 llvm_unreachable(
"Tag lookup cannot find non-tags");
1250 switch (
Result.getResultKind()) {
1256 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1257 << SomeDecl << NTK << Kind;
1270 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1271 SemaRef.
Diag(Tag->getLocation(), diag::note_previous_use);
1327 bool AllowInjectedClassName);
1340 bool AllowInjectedClassName);
1346 bool AllowInjectedClassName);
1356 Decl *AssociatedDecl,
unsigned Index,
1359 ArgPack, AssociatedDecl, Index, Final);
1437 Then, ElseLoc, Else);
1491 Inc, RParenLoc, Body);
1536 bool IsVolatile,
unsigned NumOutputs,
1543 NumInputs, Names, Constraints, Exprs,
1544 AsmString, Clobbers, NumLabels, RParenLoc);
1553 StringRef AsmString,
1554 unsigned NumOutputs,
unsigned NumInputs,
1560 NumOutputs, NumInputs,
1561 Constraints, Clobbers, Exprs, EndLoc);
1590 CoawaitLoc, Operand, OpCoawaitLookup);
1594 Suspend.
get(),
true);
1695 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1707 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1721 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1747 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1834 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1847 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1860 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1911 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1939 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1940 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1941 UnresolvedReductions);
1955 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1956 ReductionId, UnresolvedReductions);
1971 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1972 ReductionId, UnresolvedReductions);
1985 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1986 StepModifierLoc, EndLoc);
1999 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2059 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2072 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2087 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2088 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2089 ColonLoc, VarList, Locs,
2090 false, UnresolvedMappers);
2107 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2108 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2156 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2169 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2204 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2219 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2220 ColonLoc, VarList, Locs, UnresolvedMappers);
2235 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2236 ColonLoc, VarList, Locs, UnresolvedMappers);
2287 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2334 StartLoc, LParenLoc, EndLoc,
Data);
2347 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2359 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2372 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2383 LParenLoc, VarLoc, EndLoc);
2395 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2534 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2582 ForLoc, Element, Collection, RParenLoc);
2600 StartLoc, IdLoc,
Id);
2638 if (RangeStmt->isSingleDecl()) {
2639 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2640 if (RangeVar->isInvalidDecl())
2643 Expr *RangeExpr = RangeVar->getInit();
2650 diag::err_objc_for_range_init_stmt)
2651 <<
Init->getSourceRange();
2654 ForLoc, LoopVar, RangeExpr, RParenLoc);
2661 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2675 QualifierLoc, NameInfo, Nested);
2737 SS.
Adopt(QualifierLoc);
2849 if (IsOMPArraySection)
2851 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2852 Stride, RBracketLoc);
2854 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2855 "Stride/second colon not allowed for OpenACC");
2858 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2870 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2882 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2892 Expr *ExecConfig =
nullptr) {
2894 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2901 nullptr, Callee, LParenLoc, Args, RParenLoc);
2919 if (!
Member->getDeclName()) {
2923 assert(
Member->getType()->isRecordType() &&
2924 "unnamed member not of record type?");
2937 if (!isArrow &&
Base->isPRValue()) {
2946 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2952 SS.
Adopt(QualifierLoc);
2955 if (
Base->containsErrors())
2969 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2970 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2971 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2974 ->getAsCXXRecordDecl()) {
2975 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2978 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2986 FirstQualifierInScope,
2987 R, ExplicitTemplateArgs,
2997 bool ForFoldExpression =
false) {
3128 unsigned NumUserSpecifiedExprs,
3133 InitLoc, LParenLoc, RParenLoc);
3175 Expr *ControllingExpr,
3180 ControllingExpr, Types, Exprs);
3195 ControllingType, Types, Exprs);
3228 case Stmt::CXXStaticCastExprClass:
3229 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3230 RAngleLoc, LParenLoc,
3231 SubExpr, RParenLoc);
3233 case Stmt::CXXDynamicCastExprClass:
3234 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3235 RAngleLoc, LParenLoc,
3236 SubExpr, RParenLoc);
3238 case Stmt::CXXReinterpretCastExprClass:
3239 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3240 RAngleLoc, LParenLoc,
3244 case Stmt::CXXConstCastExprClass:
3245 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3246 RAngleLoc, LParenLoc,
3247 SubExpr, RParenLoc);
3249 case Stmt::CXXAddrspaceCastExprClass:
3250 return getDerived().RebuildCXXAddrspaceCastExpr(
3251 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3254 llvm_unreachable(
"Invalid C++ named cast");
3332 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3344 bool ListInitialization) {
3348 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3350 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3351 RParenLoc, ListInitialization);
3353 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3355 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3359 ListInitialization);
3423 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3433 bool IsThrownVariableInScope) {
3443 Expr *RewrittenExpr) {
3445 RewrittenExpr,
getSema().CurContext);
3479 std::optional<Expr *> ArraySize,
3498 bool IsGlobalDelete,
3549 bool IsAddressOfOperand,
3552 SS.
Adopt(QualifierLoc);
3554 if (TemplateArgs || TemplateKWLoc.
isValid())
3556 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3559 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3581 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3582 bool ListInitialization,
bool StdInitListInitialization,
3589 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3592 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3599 HadMultipleCandidates,
3601 StdInitListInitialization,
3602 RequiresZeroInit, ConstructKind,
3610 bool ConstructsVBase,
3611 bool InheritedFromVBase) {
3624 bool ListInitialization) {
3626 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3637 bool ListInitialization) {
3639 RParenLoc, ListInitialization);
3656 SS.
Adopt(QualifierLoc);
3659 OperatorLoc, IsArrow,
3661 FirstQualifierInScope,
3663 TemplateArgs,
nullptr);
3679 SS.
Adopt(QualifierLoc);
3682 OperatorLoc, IsArrow,
3684 FirstQualifierInScope,
3685 R, TemplateArgs,
nullptr);
3706 RParenLoc, Length, PartialArgs);
3711 Expr *PackIdExpression,
Expr *IndexExpr,
3713 bool FullySubstituted =
false) {
3715 IndexExpr, RSquareLoc, ExpandedExprs,
3745 NamedConcept, TALI);
3763 LocalParameters, RParenLoc, Requirements,
3817 Expr **Elements,
unsigned NumElements) {
3827 RB,
Base, Key, getterMethod, setterMethod);
3859 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3875 SelectorLocs, RBracLoc, Args);
3887 return Method->isInstanceMethod()
3889 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3890 SelectorLocs, RBracLoc, Args)
3893 SelectorLocs, RBracLoc, Args);
3902 bool IsArrow,
bool IsFreeIvar) {
3911 if (IsFreeIvar &&
Result.isUsable())
3912 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3948 PropertyLoc,
Base));
3980 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3989 CK_BuiltinFnToFnPtr).
get();
4020 EllipsisLoc, NumExpansions);
4044 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4080 EllipsisLoc, RHS, RParenLoc,
4089 Init->containsUnexpandedParameterPack();
4090 else if (PVD->hasUninstantiatedDefaultArg())
4092 PVD->getUninstantiatedDefaultArg()
4093 ->containsUnexpandedParameterPack();
4247 Exprs.push_back(DevNumExpr);
4248 llvm::append_range(Exprs, QueueIdExprs);
4292 ObjectType, FirstQualifierInScope);
4298 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4299 DependentNameTypeLoc TL,
4300 bool DeducibleTSTContext,
4301 QualType ObjectType = QualType(),
4302 NamedDecl *UnqualLookup =
nullptr);
4311 const OpenACCClause *OldClause);
4314template <
typename Derived>
4319 switch (S->getStmtClass()) {
4324#define STMT(Node, Parent) \
4325 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4326#define VALUESTMT(Node, Parent) \
4327 case Stmt::Node##Class: \
4328 return getDerived().Transform##Node(cast<Node>(S), SDK);
4329#define ABSTRACT_STMT(Node)
4330#define EXPR(Node, Parent)
4331#include "clang/AST/StmtNodes.inc"
4334#define STMT(Node, Parent)
4335#define ABSTRACT_STMT(Stmt)
4336#define EXPR(Node, Parent) case Stmt::Node##Class:
4337#include "clang/AST/StmtNodes.inc"
4339 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4341 if (SDK == StmtDiscardKind::StmtExprResult)
4342 E = getSema().ActOnStmtExprResult(
E);
4343 return getSema().ActOnExprStmt(
E, SDK == StmtDiscardKind::Discarded);
4350template<
typename Derived>
4355 switch (S->getClauseKind()) {
4358#define GEN_CLANG_CLAUSE_CLASS
4359#define CLAUSE_CLASS(Enum, Str, Class) \
4361 return getDerived().Transform##Class(cast<Class>(S));
4362#include "llvm/Frontend/OpenMP/OMP.inc"
4369template<
typename Derived>
4376#define STMT(Node, Parent) case Stmt::Node##Class: break;
4377#define ABSTRACT_STMT(Stmt)
4378#define EXPR(Node, Parent) \
4379 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4380#include "clang/AST/StmtNodes.inc"
4386template<
typename Derived>
4394 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4395 Init = FE->getSubExpr();
4397 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4403 Init = MTE->getSubExpr();
4406 Init = Binder->getSubExpr();
4409 Init = ICE->getSubExprAsWritten();
4412 dyn_cast<CXXStdInitializerListExpr>(
Init))
4413 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4420 return getDerived().TransformExpr(
Init);
4425 return getDerived().RebuildParenListExpr(
Parens.getBegin(), {},
4430 if (isa<ImplicitValueInitExpr>(
Init))
4436 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4437 return getDerived().TransformExpr(
Init);
4442 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4449 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4450 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4451 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4452 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4454 bool ArgChanged =
false;
4456 true, NewArgs, &ArgChanged))
4461 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4466 if (
Parens.isInvalid()) {
4469 assert(NewArgs.empty() &&
4470 "no parens or braces but have direct init with arguments?");
4473 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4477template<
typename Derived>
4483 for (
unsigned I = 0; I != NumInputs; ++I) {
4485 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4493 Expr *Pattern = Expansion->getPattern();
4496 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4497 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4502 bool RetainExpansion =
false;
4503 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4505 if (getDerived().TryExpandParameterPacks(
4507 Unexpanded,
true, Expand,
4508 RetainExpansion, NumExpansions))
4516 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4520 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4521 Expansion->getEllipsisLoc(),
4523 if (Out.isInvalid())
4528 Outputs.push_back(Out.get());
4534 if (ArgChanged) *ArgChanged =
true;
4538 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4540 ExprResult Out = getDerived().TransformExpr(Pattern);
4541 if (Out.isInvalid())
4544 if (Out.get()->containsUnexpandedParameterPack()) {
4545 Out = getDerived().RebuildPackExpansion(
4546 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4547 if (Out.isInvalid())
4551 Outputs.push_back(Out.get());
4556 if (RetainExpansion) {
4557 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4559 ExprResult Out = getDerived().TransformExpr(Pattern);
4560 if (Out.isInvalid())
4563 Out = getDerived().RebuildPackExpansion(
4564 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4565 if (Out.isInvalid())
4568 Outputs.push_back(Out.get());
4575 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4576 : getDerived().TransformExpr(Inputs[I]);
4580 if (
Result.get() != Inputs[I] && ArgChanged)
4583 Outputs.push_back(
Result.get());
4589template <
typename Derived>
4600 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4601 getDerived().TransformDefinition(Var->
getLocation(), Var));
4606 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4615 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4622template <
typename Derived>
4630 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4642 llvm_unreachable(
"unexpected null nested name specifier");
4645 auto *NS = cast<NamespaceBaseDecl>(getDerived().TransformDecl(
4673 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
4674 QualifierLoc, ObjectType, FirstQualifierInScope);
4678 FirstQualifierInScope =
nullptr;
4680 SS.
Adopt(QualifierLoc);
4686 FirstQualifierInScope,
false))
4693 if (!getDerived().AlreadyTransformed(
T)) {
4694 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4695 FirstQualifierInScope);
4705 diag::warn_cxx98_compat_enum_nested_name_spec);
4712 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4723 !getDerived().AlwaysRebuild())
4736template<
typename Derived>
4744 switch (Name.getNameKind()) {
4755 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4756 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4757 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4773 NewTInfo = getDerived().TransformType(OldTInfo);
4781 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4797 llvm_unreachable(
"Unknown name kind.");
4800template <
typename Derived>
4804 QualType ObjectType,
bool AllowInjectedClassName) {
4806 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4807 ObjectType, AllowInjectedClassName);
4808 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, IO.
getOperator(),
4809 NameLoc, ObjectType,
4810 AllowInjectedClassName);
4813template <
typename Derived>
4817 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4819 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4822 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
4823 QualifierLoc, ObjectType, FirstQualifierInScope);
4829 TemplateName NewUnderlyingName = getDerived().TransformTemplateName(
4830 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4831 FirstQualifierInScope, AllowInjectedClassName);
4832 if (NewUnderlyingName.
isNull())
4834 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4836 if (!getDerived().AlwaysRebuild() &&
4838 NewUnderlyingName == UnderlyingName)
4841 SS.
Adopt(QualifierLoc);
4842 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4848 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
4849 QualifierLoc, ObjectType, FirstQualifierInScope);
4857 if (!getDerived().AlwaysRebuild() &&
4863 SS.
Adopt(QualifierLoc);
4864 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4865 NameLoc, ObjectType,
4866 AllowInjectedClassName);
4870 Name.getAsSubstTemplateTemplateParm()) {
4871 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4877 Builder.MakeTrivial(SemaRef.
Context, Qualifier, NameLoc);
4878 ReplacementQualifierLoc = Builder.getWithLocInContext(SemaRef.
Context);
4881 TemplateName NewName = getDerived().TransformTemplateName(
4882 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4883 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4886 Decl *AssociatedDecl =
4887 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4888 if (!getDerived().AlwaysRebuild() && NewName == S->getReplacement() &&
4889 AssociatedDecl == S->getAssociatedDecl())
4892 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4896 assert(!Name.getAsDeducedTemplateName() &&
4897 "DeducedTemplateName should not escape partial ordering");
4900 if (
auto *
Template = Name.getAsTemplateDecl()) {
4901 assert(!QualifierLoc &&
"Unexpected qualifier");
4903 getDerived().TransformDecl(NameLoc,
Template)));
4907 = Name.getAsSubstTemplateTemplateParmPack()) {
4908 assert(!QualifierLoc &&
4909 "Unexpected qualified SubstTemplateTemplateParmPack");
4910 return getDerived().RebuildTemplateName(
4911 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4912 SubstPack->getIndex(), SubstPack->getFinal());
4916 llvm_unreachable(
"overloaded function decl survived to here");
4919template <
typename Derived>
4924 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4930template<
typename Derived>
4934 Output = getSema().getTrivialTemplateArgumentLoc(
4935 Arg,
QualType(), getDerived().getBaseLocation());
4938template <
typename Derived>
4946 llvm_unreachable(
"Unexpected TemplateArgument");
4956 QualType NewT = getDerived().TransformType(
T);
4963 ValueDecl *NewD =
D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4964 getDerived().getBaseLocation(),
D))
4969 if (NewT ==
T &&
D == NewD)
4986 llvm_unreachable(
"unexpected template argument kind");
4996 DI = getDerived().TransformType(DI);
5007 TemplateArgument Out = getDerived().TransformNamedTemplateTemplateArgument(
5018 llvm_unreachable(
"Caller should expand pack expansions");
5033 ExprResult E = getDerived().TransformExpr(InputExpr);
5049template<
typename Derived,
typename InputIterator>
5057 typedef typename std::iterator_traits<InputIterator>::difference_type
5087 Self.InventTemplateArgumentLoc(*
Iter,
Result);
5095 return X.Iter == Y.Iter;
5100 return X.Iter != Y.Iter;
5104template<
typename Derived>
5105template<
typename InputIterator>
5120 if (TransformTemplateArguments(
5121 PackLocIterator(*
this, In.getArgument().pack_begin()),
5122 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5129 if (In.getArgument().isPackExpansion()) {
5141 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5143 ForgetSubst.emplace(getDerived());
5148 if (getDerived().TransformTemplateArgument(Prepared, Out, Uneval))
5151 if (Out.getArgument().containsUnexpandedParameterPack()) {
5152 Out = getDerived().RebuildPackExpansion(Out, Info.
Ellipsis,
5154 if (Out.getArgument().isNull())
5164 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5167 if (getDerived().TransformTemplateArgument(Prepared, Out, Uneval))
5170 Out = getDerived().RebuildPackExpansion(Out, Info.
Ellipsis,
5172 if (Out.getArgument().isNull())
5182 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
5193template <
typename Derived>
5204 Pattern = getSema().getTemplateArgumentPackExpansionPattern(
5207 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5208 if (IsLateExpansionAttempt) {
5215 if (!SawPackTypes) {
5220 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5227 return getDerived().TryExpandParameterPacks(
5228 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5234 if (ComputeInfo(In,
false, Info, Pattern))
5246 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5247 std::in_place, getSema(), std::nullopt);
5248 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
5251 Out = getDerived().RebuildPackExpansion(OutPattern, Info.
Ellipsis,
5253 if (Out.getArgument().isNull())
5290 ForgetSubstitutionRAII ForgetSubst(getDerived());
5291 if (ComputeInfo(Out,
true, Info, OutPattern))
5304template<
typename Derived>
5306 if (getDerived().AlreadyTransformed(
T))
5312 getDerived().getBaseLocation());
5322template<
typename Derived>
5326 getDerived().getBaseEntity());
5327 if (getDerived().AlreadyTransformed(DI->
getType()))
5342template<
typename Derived>
5345 switch (
T.getTypeLocClass()) {
5346#define ABSTRACT_TYPELOC(CLASS, PARENT)
5347#define TYPELOC(CLASS, PARENT) \
5348 case TypeLoc::CLASS: \
5349 return getDerived().Transform##CLASS##Type(TLB, \
5350 T.castAs<CLASS##TypeLoc>());
5351#include "clang/AST/TypeLocNodes.def"
5354 llvm_unreachable(
"unhandled type loc!");
5357template<
typename Derived>
5359 if (!isa<DependentNameType>(
T))
5360 return TransformType(
T);
5362 if (getDerived().AlreadyTransformed(
T))
5365 getDerived().getBaseLocation());
5366 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5370template<
typename Derived>
5373 if (!isa<DependentNameType>(DI->
getType()))
5374 return TransformType(DI);
5378 getDerived().getBaseEntity());
5379 if (getDerived().AlreadyTransformed(DI->
getType()))
5399 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5408template<
typename Derived>
5413 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5414 auto SuppressObjCLifetime =
5415 T.getType().getLocalQualifiers().hasObjCLifetime();
5417 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5418 SuppressObjCLifetime);
5419 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5420 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5421 TLB, STTP, SuppressObjCLifetime);
5423 Result = getDerived().TransformType(TLB, UnqualTL);
5442template <
typename Derived>
5452 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5459 if (
T.getPointerAuth().isPresent()) {
5460 SemaRef.
Diag(
Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5465 SemaRef.
Diag(
Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5496 else if (
T.getObjCLifetime()) {
5501 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5517 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5526template <
typename Derived>
5530 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5533 case TypeLoc::DependentTemplateSpecialization:
5534 return getDerived().TransformDependentTemplateSpecializationType(
5536 UnqualLookup,
true);
5537 case TypeLoc::DependentName: {
5538 return getDerived().TransformDependentNameType(
5540 ObjectType, UnqualLookup);
5545 return getDerived().TransformType(TLB, TL);
5549template <
class TyLoc>
static inline
5551 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5552 NewT.setNameLoc(
T.getNameLoc());
5556template<
typename Derived>
5557QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5559 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5560 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5561 if (
T.needsExtraLocalData())
5562 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5566template<
typename Derived>
5567QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5573template <
typename Derived>
5574QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5575 AdjustedTypeLoc TL) {
5577 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5580template<
typename Derived>
5581QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5582 DecayedTypeLoc TL) {
5583 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5584 if (OriginalType.isNull())
5587 QualType
Result = TL.getType();
5588 if (getDerived().AlwaysRebuild() ||
5589 OriginalType != TL.getOriginalLoc().getType())
5591 TLB.push<DecayedTypeLoc>(
Result);
5596template <
typename Derived>
5598TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5599 ArrayParameterTypeLoc TL) {
5600 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5601 if (OriginalType.isNull())
5604 QualType
Result = TL.getType();
5605 if (getDerived().AlwaysRebuild() ||
5606 OriginalType != TL.getElementLoc().getType())
5608 TLB.push<ArrayParameterTypeLoc>(
Result);
5613template<
typename Derived>
5614QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5615 PointerTypeLoc TL) {
5616 QualType PointeeType
5617 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5618 if (PointeeType.isNull())
5621 QualType
Result = TL.getType();
5622 if (PointeeType->getAs<ObjCObjectType>()) {
5629 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5630 NewT.setStarLoc(TL.getStarLoc());
5634 if (getDerived().AlwaysRebuild() ||
5635 PointeeType != TL.getPointeeLoc().getType()) {
5636 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5643 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5645 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5646 NewT.setSigilLoc(TL.getSigilLoc());
5650template<
typename Derived>
5652TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5653 BlockPointerTypeLoc TL) {
5654 QualType PointeeType
5655 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5656 if (PointeeType.isNull())
5659 QualType
Result = TL.getType();
5660 if (getDerived().AlwaysRebuild() ||
5661 PointeeType != TL.getPointeeLoc().getType()) {
5662 Result = getDerived().RebuildBlockPointerType(PointeeType,
5668 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5669 NewT.setSigilLoc(TL.getSigilLoc());
5677template<
typename Derived>
5685 if (PointeeType.
isNull())
5689 if (getDerived().AlwaysRebuild() ||
5690 PointeeType !=
T->getPointeeTypeAsWritten()) {
5691 Result = getDerived().RebuildReferenceType(PointeeType,
5692 T->isSpelledAsLValue(),
5705 if (isa<LValueReferenceType>(
Result))
5714template<
typename Derived>
5718 return TransformReferenceType(TLB, TL);
5721template<
typename Derived>
5723TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5724 RValueReferenceTypeLoc TL) {
5725 return TransformReferenceType(TLB, TL);
5728template<
typename Derived>
5730TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5731 MemberPointerTypeLoc TL) {
5732 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5733 if (PointeeType.isNull())
5736 const MemberPointerType *
T = TL.getTypePtr();
5738 NestedNameSpecifierLoc OldQualifierLoc = TL.getQualifierLoc();
5739 NestedNameSpecifierLoc NewQualifierLoc =
5740 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5741 if (!NewQualifierLoc)
5744 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5746 NewCls = cast_or_null<CXXRecordDecl>(
5747 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5752 QualType
Result = TL.getType();
5753 if (getDerived().AlwaysRebuild() || PointeeType !=
T->
getPointeeType() ||
5754 NewQualifierLoc.getNestedNameSpecifier() !=
5755 OldQualifierLoc.getNestedNameSpecifier() ||
5758 SS.Adopt(NewQualifierLoc);
5759 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5767 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5768 if (MPT && PointeeType != MPT->getPointeeType()) {
5769 assert(isa<AdjustedType>(MPT->getPointeeType()));
5770 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5773 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5774 NewTL.setSigilLoc(TL.getSigilLoc());
5775 NewTL.setQualifierLoc(NewQualifierLoc);
5780template<
typename Derived>
5782TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5783 ConstantArrayTypeLoc TL) {
5784 const ConstantArrayType *
T = TL.getTypePtr();
5785 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5786 if (ElementType.isNull())
5790 Expr *
OldSize = TL.getSizeExpr();
5792 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5793 Expr *NewSize =
nullptr;
5797 NewSize = getDerived().TransformExpr(
OldSize).template getAs<Expr>();
5801 QualType
Result = TL.getType();
5802 if (getDerived().AlwaysRebuild() ||
5803 ElementType !=
T->getElementType() ||
5804 (
T->getSizeExpr() && NewSize !=
OldSize)) {
5805 Result = getDerived().RebuildConstantArrayType(ElementType,
5806 T->getSizeModifier(),
5807 T->getSize(), NewSize,
5808 T->getIndexTypeCVRQualifiers(),
5809 TL.getBracketsRange());
5818 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5819 NewTL.setLBracketLoc(TL.getLBracketLoc());
5820 NewTL.setRBracketLoc(TL.getRBracketLoc());
5821 NewTL.setSizeExpr(NewSize);
5826template<
typename Derived>
5827QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5828 TypeLocBuilder &TLB,
5829 IncompleteArrayTypeLoc TL) {
5830 const IncompleteArrayType *
T = TL.getTypePtr();
5831 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5832 if (ElementType.isNull())
5835 QualType
Result = TL.getType();
5836 if (getDerived().AlwaysRebuild() ||
5837 ElementType !=
T->getElementType()) {
5838 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5839 T->getSizeModifier(),
5840 T->getIndexTypeCVRQualifiers(),
5841 TL.getBracketsRange());
5846 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5847 NewTL.setLBracketLoc(TL.getLBracketLoc());
5848 NewTL.setRBracketLoc(TL.getRBracketLoc());
5849 NewTL.setSizeExpr(
nullptr);
5854template<
typename Derived>
5856TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5857 VariableArrayTypeLoc TL) {
5858 const VariableArrayType *
T = TL.getTypePtr();
5859 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5860 if (ElementType.isNull())
5865 EnterExpressionEvaluationContext Context(
5867 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5869 if (SizeResult.isInvalid())
5873 if (SizeResult.isInvalid())
5876 Expr *
Size = SizeResult.get();
5878 QualType
Result = TL.getType();
5879 if (getDerived().AlwaysRebuild() ||
5880 ElementType !=
T->getElementType() ||
5881 Size !=
T->getSizeExpr()) {
5882 Result = getDerived().RebuildVariableArrayType(ElementType,
5883 T->getSizeModifier(),
5885 T->getIndexTypeCVRQualifiers(),
5886 TL.getBracketsRange());
5893 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5894 NewTL.setLBracketLoc(TL.getLBracketLoc());
5895 NewTL.setRBracketLoc(TL.getRBracketLoc());
5896 NewTL.setSizeExpr(Size);
5901template<
typename Derived>
5903TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5904 DependentSizedArrayTypeLoc TL) {
5905 const DependentSizedArrayType *
T = TL.getTypePtr();
5906 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5907 if (ElementType.isNull())
5915 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5918 Expr *origSize = TL.getSizeExpr();
5919 if (!origSize) origSize =
T->getSizeExpr();
5922 = getDerived().TransformExpr(origSize);
5924 if (sizeResult.isInvalid())
5927 Expr *size = sizeResult.get();
5929 QualType
Result = TL.getType();
5930 if (getDerived().AlwaysRebuild() ||
5931 ElementType !=
T->getElementType() ||
5933 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5934 T->getSizeModifier(),
5936 T->getIndexTypeCVRQualifiers(),
5937 TL.getBracketsRange());
5944 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5945 NewTL.setLBracketLoc(TL.getLBracketLoc());
5946 NewTL.setRBracketLoc(TL.getRBracketLoc());
5947 NewTL.setSizeExpr(size);
5952template <
typename Derived>
5953QualType TreeTransform<Derived>::TransformDependentVectorType(
5954 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5955 const DependentVectorType *
T = TL.getTypePtr();
5956 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5957 if (ElementType.isNull())
5965 if (
Size.isInvalid())
5968 QualType
Result = TL.getType();
5969 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5970 Size.get() !=
T->getSizeExpr()) {
5971 Result = getDerived().RebuildDependentVectorType(
5972 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5978 if (isa<DependentVectorType>(
Result)) {
5979 DependentVectorTypeLoc NewTL =
5980 TLB.push<DependentVectorTypeLoc>(
Result);
5981 NewTL.setNameLoc(TL.getNameLoc());
5983 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5984 NewTL.setNameLoc(TL.getNameLoc());
5990template<
typename Derived>
5991QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5992 TypeLocBuilder &TLB,
5993 DependentSizedExtVectorTypeLoc TL) {
5994 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5997 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5998 if (ElementType.isNull())
6007 if (
Size.isInvalid())
6010 QualType
Result = TL.getType();
6011 if (getDerived().AlwaysRebuild() ||
6012 ElementType !=
T->getElementType() ||
6013 Size.get() !=
T->getSizeExpr()) {
6014 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6016 T->getAttributeLoc());
6022 if (isa<DependentSizedExtVectorType>(
Result)) {
6023 DependentSizedExtVectorTypeLoc NewTL
6024 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
6025 NewTL.setNameLoc(TL.getNameLoc());
6027 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
6028 NewTL.setNameLoc(TL.getNameLoc());
6034template <
typename Derived>
6036TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
6037 ConstantMatrixTypeLoc TL) {
6038 const ConstantMatrixType *
T = TL.getTypePtr();
6039 QualType ElementType = getDerived().TransformType(
T->getElementType());
6040 if (ElementType.isNull())
6043 QualType
Result = TL.getType();
6044 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6045 Result = getDerived().RebuildConstantMatrixType(
6046 ElementType,
T->getNumRows(),
T->getNumColumns());
6051 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
6052 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6053 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6054 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6055 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6060template <
typename Derived>
6061QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
6062 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
6063 const DependentSizedMatrixType *
T = TL.getTypePtr();
6065 QualType ElementType = getDerived().TransformType(
T->getElementType());
6066 if (ElementType.isNull()) {
6074 Expr *origRows = TL.getAttrRowOperand();
6076 origRows =
T->getRowExpr();
6077 Expr *origColumns = TL.getAttrColumnOperand();
6079 origColumns =
T->getColumnExpr();
6081 ExprResult rowResult = getDerived().TransformExpr(origRows);
6083 if (rowResult.isInvalid())
6086 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6088 if (columnResult.isInvalid())
6091 Expr *rows = rowResult.get();
6092 Expr *columns = columnResult.get();
6094 QualType
Result = TL.getType();
6095 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6096 rows != origRows || columns != origColumns) {
6097 Result = getDerived().RebuildDependentSizedMatrixType(
6098 ElementType, rows, columns,
T->getAttributeLoc());
6106 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
6107 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6108 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6109 NewTL.setAttrRowOperand(rows);
6110 NewTL.setAttrColumnOperand(columns);
6114template <
typename Derived>
6115QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
6116 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
6117 const DependentAddressSpaceType *
T = TL.getTypePtr();
6119 QualType pointeeType =
6120 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6122 if (pointeeType.isNull())
6129 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6131 if (AddrSpace.isInvalid())
6134 QualType
Result = TL.getType();
6135 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
6136 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6137 Result = getDerived().RebuildDependentAddressSpaceType(
6138 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6144 if (isa<DependentAddressSpaceType>(
Result)) {
6145 DependentAddressSpaceTypeLoc NewTL =
6146 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
6148 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6149 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6150 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6153 TLB.TypeWasModifiedSafely(
Result);
6159template <
typename Derived>
6160QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
6162 const VectorType *
T = TL.getTypePtr();
6163 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6164 if (ElementType.isNull())
6167 QualType
Result = TL.getType();
6168 if (getDerived().AlwaysRebuild() ||
6169 ElementType !=
T->getElementType()) {
6170 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6171 T->getVectorKind());
6176 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
6177 NewTL.setNameLoc(TL.getNameLoc());
6182template<
typename Derived>
6183QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
6184 ExtVectorTypeLoc TL) {
6185 const VectorType *
T = TL.getTypePtr();
6186 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6187 if (ElementType.isNull())
6190 QualType
Result = TL.getType();
6191 if (getDerived().AlwaysRebuild() ||
6192 ElementType !=
T->getElementType()) {
6193 Result = getDerived().RebuildExtVectorType(ElementType,
6194 T->getNumElements(),
6200 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
6201 NewTL.setNameLoc(TL.getNameLoc());
6206template <
typename Derived>
6209 bool ExpectParameterPack) {
6213 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
6240 NewDI = getDerived().TransformType(OldDI);
6244 if (NewDI == OldDI && indexAdjustment == 0)
6258 transformedLocalDecl(OldParm, {newParm});
6262template <
typename Derived>
6270 unsigned *LastParamTransformed) {
6271 int indexAdjustment = 0;
6273 unsigned NumParams = Params.size();
6274 for (
unsigned i = 0; i != NumParams; ++i) {
6275 if (LastParamTransformed)
6276 *LastParamTransformed = i;
6278 assert(OldParm->getFunctionScopeIndex() == i);
6282 if (OldParm->isParameterPack()) {
6287 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6293 bool ShouldExpand =
false;
6294 bool RetainExpansion =
false;
6296 if (Unexpanded.size() > 0) {
6298 NumExpansions = OrigNumExpansions;
6299 if (getDerived().TryExpandParameterPacks(
6302 ShouldExpand, RetainExpansion, NumExpansions)) {
6310 "Could not find parameter packs or undeduced auto type!");
6317 getDerived().ExpandingFunctionParameterPack(OldParm);
6318 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6321 = getDerived().TransformFunctionTypeParam(OldParm,
6329 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6330 OutParamTypes.push_back(NewParm->
getType());
6332 PVars->push_back(NewParm);
6337 if (RetainExpansion) {
6338 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6340 = getDerived().TransformFunctionTypeParam(OldParm,
6348 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6349 OutParamTypes.push_back(NewParm->
getType());
6351 PVars->push_back(NewParm);
6367 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6372 "Parameter pack no longer a parameter pack after "
6375 NewParm = getDerived().TransformFunctionTypeParam(
6376 OldParm, indexAdjustment, std::nullopt,
6384 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6385 OutParamTypes.push_back(NewParm->
getType());
6387 PVars->push_back(NewParm);
6395 bool IsPackExpansion =
false;
6399 = dyn_cast<PackExpansionType>(OldType)) {
6401 QualType Pattern = Expansion->getPattern();
6403 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6406 bool ShouldExpand =
false;
6407 bool RetainExpansion =
false;
6408 if (getDerived().TryExpandParameterPacks(
6411 RetainExpansion, NumExpansions)) {
6418 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6420 QualType NewType = getDerived().TransformType(Pattern);
6425 NewType = getSema().getASTContext().getPackExpansionType(
6426 NewType, std::nullopt);
6433 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6434 OutParamTypes.push_back(NewType);
6436 PVars->push_back(
nullptr);
6445 if (RetainExpansion) {
6446 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6447 QualType NewType = getDerived().TransformType(Pattern);
6452 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6453 OutParamTypes.push_back(NewType);
6455 PVars->push_back(
nullptr);
6460 OldType = Expansion->getPattern();
6461 IsPackExpansion =
true;
6463 NewType = getDerived().TransformType(OldType);
6465 NewType = getDerived().TransformType(OldType);
6471 if (IsPackExpansion)
6472 NewType = getSema().Context.getPackExpansionType(NewType,
6476 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6477 OutParamTypes.push_back(NewType);
6479 PVars->push_back(
nullptr);
6484 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6486 assert(parm->getFunctionScopeIndex() == i);
6493template<
typename Derived>
6498 return getDerived().TransformFunctionProtoType(
6501 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6502 ExceptionStorage, Changed);
6506template<
typename Derived>
template<
typename Fn>
6509 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6526 if (getDerived().TransformFunctionTypeParams(
6530 ParamTypes, &ParamDecls, ExtParamInfos))
6542 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6544 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6550 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6554 if (getDerived().TransformFunctionTypeParams(
6558 ParamTypes, &ParamDecls, ExtParamInfos))
6564 bool EPIChanged =
false;
6569 if (
auto NewExtParamInfos =
6585 std::optional<FunctionEffectSet> NewFX;
6594 ExprResult NewExpr = getDerived().TransformExpr(CondExpr);
6597 std::optional<FunctionEffectMode> Mode =
6617 "FunctionEffectMode::None shouldn't be possible here");
6623 NewFX->insert(NewEC, Errs);
6624 assert(Errs.empty());
6632 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6634 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6645 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6651template<
typename Derived>
6674 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6697 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6702 bool Expand =
false;
6703 bool RetainExpansion =
false;
6704 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6707 if (getDerived().TryExpandParameterPacks(
6709 true, Expand, RetainExpansion,
6718 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6723 Exceptions.push_back(
U);
6729 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6732 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6736 Exceptions.push_back(
U);
6745 Exceptions.push_back(
U);
6755template<
typename Derived>
6765 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6766 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6777template <
typename Derived>
6778QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6779 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6781 const UnresolvedUsingType *
T = TL.getTypePtr();
6782 bool Changed =
false;
6784 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6785 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6786 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6789 Changed |= QualifierLoc != OldQualifierLoc;
6792 auto *
D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6797 QualType
Result = TL.getType();
6798 if (getDerived().AlwaysRebuild() || Changed) {
6799 Result = getDerived().RebuildUnresolvedUsingType(
6800 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6806 if (isa<UsingType>(
Result))
6807 TLB.push<UsingTypeLoc>(
Result).set(TL.getElaboratedKeywordLoc(),
6808 QualifierLoc, TL.getNameLoc());
6810 TLB.push<UnresolvedUsingTypeLoc>(
Result).set(TL.getElaboratedKeywordLoc(),
6811 QualifierLoc, TL.getNameLoc());
6815template <
typename Derived>
6816QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6818 const UsingType *
T = TL.getTypePtr();
6821 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6822 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6823 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6826 Changed |= QualifierLoc != OldQualifierLoc;
6829 auto *
D = cast_or_null<UsingShadowDecl>(
6830 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6835 QualType UnderlyingType = getDerived().TransformType(
T->
desugar());
6836 if (UnderlyingType.isNull())
6840 QualType
Result = TL.getType();
6841 if (getDerived().AlwaysRebuild() || Changed) {
6842 Result = getDerived().RebuildUsingType(
6843 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
D,
6848 TLB.push<UsingTypeLoc>(
Result).set(TL.getElaboratedKeywordLoc(), QualifierLoc,
6853template<
typename Derived>
6854QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6855 TypedefTypeLoc TL) {
6856 const TypedefType *
T = TL.getTypePtr();
6859 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6860 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6861 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6864 Changed |= QualifierLoc != OldQualifierLoc;
6867 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6868 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6875 QualType
Result = TL.getType();
6876 if (getDerived().AlwaysRebuild() || Changed) {
6877 Result = getDerived().RebuildTypedefType(
6878 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6883 TLB.push<TypedefTypeLoc>(
Result).set(TL.getElaboratedKeywordLoc(),
6884 QualifierLoc, TL.getNameLoc());
6888template<
typename Derived>
6889QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6890 TypeOfExprTypeLoc TL) {
6896 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6904 QualType
Result = TL.getType();
6906 if (getDerived().AlwaysRebuild() ||
E.get() != TL.getUnderlyingExpr()) {
6908 getDerived().RebuildTypeOfExprType(
E.get(), TL.getTypeofLoc(), Kind);
6913 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6914 NewTL.setTypeofLoc(TL.getTypeofLoc());
6916 NewTL.setRParenLoc(TL.getRParenLoc());
6921template<
typename Derived>
6922QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6924 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6925 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6929 QualType
Result = TL.getType();
6931 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6932 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6937 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6938 NewTL.setTypeofLoc(TL.getTypeofLoc());
6939 NewTL.setLParenLoc(TL.getLParenLoc());
6940 NewTL.setRParenLoc(TL.getRParenLoc());
6941 NewTL.setUnmodifiedTInfo(New_Under_TI);
6946template<
typename Derived>
6947QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6948 DecltypeTypeLoc TL) {
6949 const DecltypeType *
T = TL.getTypePtr();
6956 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6960 E = getSema().ActOnDecltypeExpression(
E.get());
6964 QualType
Result = TL.getType();
6965 if (getDerived().AlwaysRebuild() ||
6966 E.get() !=
T->getUnderlyingExpr()) {
6967 Result = getDerived().RebuildDecltypeType(
E.get(), TL.getDecltypeLoc());
6973 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6974 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6975 NewTL.setRParenLoc(TL.getRParenLoc());
6979template <
typename Derived>
6981TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6982 PackIndexingTypeLoc TL) {
6986 EnterExpressionEvaluationContext ConstantContext(
6989 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6990 if (IndexExpr.isInvalid())
6993 QualType Pattern = TL.getPattern();
6995 const PackIndexingType *PIT = TL.
getTypePtr();
6999 bool NotYetExpanded = Types.empty();
7000 bool FullySubstituted =
true;
7002 if (Types.empty() && !PIT->expandsToEmptyPack())
7005 for (QualType
T : Types) {
7007 QualType Transformed = getDerived().TransformType(
T);
7008 if (Transformed.isNull())
7010 SubtitutedTypes.push_back(Transformed);
7015 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7016 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7019 bool ShouldExpand =
true;
7020 bool RetainExpansion =
false;
7021 UnsignedOrNone NumExpansions = std::nullopt;
7022 if (getDerived().TryExpandParameterPacks(
7023 TL.getEllipsisLoc(), SourceRange(), Unexpanded,
7025 RetainExpansion, NumExpansions))
7027 if (!ShouldExpand) {
7028 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
7031 TypeSourceInfo *TI =
7033 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7036 if (NotYetExpanded) {
7037 FullySubstituted =
false;
7038 QualType Out = getDerived().RebuildPackIndexingType(
7039 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
7044 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
7045 Loc.setEllipsisLoc(TL.getEllipsisLoc());
7048 SubtitutedTypes.push_back(Pack);
7051 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7052 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), I);
7053 QualType Out = getDerived().TransformType(
T);
7056 SubtitutedTypes.push_back(Out);
7057 FullySubstituted &= !Out->containsUnexpandedParameterPack();
7061 if (RetainExpansion) {
7062 FullySubstituted =
false;
7063 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7064 QualType Out = getDerived().TransformType(
T);
7067 SubtitutedTypes.push_back(Out);
7074 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
7075 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7077 QualType Out = getDerived().RebuildPackIndexingType(
7078 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
7079 FullySubstituted, SubtitutedTypes);
7083 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
7084 Loc.setEllipsisLoc(TL.getEllipsisLoc());
7088template<
typename Derived>
7089QualType TreeTransform<Derived>::TransformUnaryTransformType(
7090 TypeLocBuilder &TLB,
7091 UnaryTransformTypeLoc TL) {
7092 QualType
Result = TL.getType();
7093 if (
Result->isDependentType()) {
7094 const UnaryTransformType *
T = TL.getTypePtr();
7096 TypeSourceInfo *NewBaseTSI =
7097 getDerived().TransformType(TL.getUnderlyingTInfo());
7100 QualType NewBase = NewBaseTSI->getType();
7102 Result = getDerived().RebuildUnaryTransformType(NewBase,
7109 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
7110 NewTL.setKWLoc(TL.getKWLoc());
7111 NewTL.setParensRange(TL.getParensRange());
7112 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
7116template<
typename Derived>
7117QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
7118 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
7119 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7121 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7123 QualifierLoc, SourceLocation(),
T->getTemplateName(),
7124 TL.getTemplateNameLoc());
7128 QualType OldDeduced =
T->getDeducedType();
7129 QualType NewDeduced;
7130 if (!OldDeduced.isNull()) {
7131 NewDeduced = getDerived().TransformType(OldDeduced);
7132 if (NewDeduced.isNull())
7136 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
7137 T->getKeyword(), TemplateName, NewDeduced);
7141 auto NewTL = TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
7142 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7143 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7144 NewTL.setQualifierLoc(QualifierLoc);
7148template <
typename Derived>
7155 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7160 auto *TD = cast_or_null<TagDecl>(
7161 getDerived().TransformDecl(TL.
getNameLoc(),
T->getOriginalDecl()));
7166 if (getDerived().AlwaysRebuild() || QualifierLoc != TL.
getQualifierLoc() ||
7167 TD !=
T->getOriginalDecl()) {
7169 Result = getDerived().RebuildCanonicalTagType(TD);
7171 Result = getDerived().RebuildTagType(
7185template <
typename Derived>
7191template <
typename Derived>
7192QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7194 return getDerived().TransformTagType(TLB, TL);
7197template<
typename Derived>
7198QualType TreeTransform<Derived>::TransformInjectedClassNameType(
7199 TypeLocBuilder &TLB,
7200 InjectedClassNameTypeLoc TL) {
7201 return getDerived().TransformTagType(TLB, TL);
7204template<
typename Derived>
7208 return getDerived().TransformTemplateTypeParmType(
7213template <
typename Derived>
7219template<
typename Derived>
7220QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7221 TypeLocBuilder &TLB,
7222 SubstTemplateTypeParmTypeLoc TL) {
7223 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
7226 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
7231 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7232 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
7233 if (Replacement.isNull())
7237 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex(),
7241 SubstTemplateTypeParmTypeLoc NewTL
7242 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7243 NewTL.setNameLoc(TL.getNameLoc());
7247template <
typename Derived>
7248QualType TreeTransform<Derived>::TransformSubstBuiltinTemplatePackType(
7249 TypeLocBuilder &TLB, SubstBuiltinTemplatePackTypeLoc TL) {
7253template<
typename Derived>
7257 return getDerived().TransformSubstTemplateTypeParmPackType(
7261template <
typename Derived>
7267template<
typename Derived>
7268QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7270 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7271 if (ValueType.isNull())
7274 QualType
Result = TL.getType();
7275 if (getDerived().AlwaysRebuild() ||
7276 ValueType != TL.getValueLoc().getType()) {
7277 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7282 AtomicTypeLoc NewTL = TLB.push<AtomicTypeLoc>(
Result);
7283 NewTL.setKWLoc(TL.getKWLoc());
7284 NewTL.setLParenLoc(TL.getLParenLoc());
7285 NewTL.setRParenLoc(TL.getRParenLoc());
7290template <
typename Derived>
7291QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
7293 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7294 if (ValueType.isNull())
7297 QualType
Result = TL.getType();
7298 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7299 const PipeType *PT =
Result->castAs<PipeType>();
7300 bool isReadPipe = PT->isReadOnly();
7301 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7306 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
7307 NewTL.setKWLoc(TL.getKWLoc());
7312template <
typename Derived>
7313QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
7315 const BitIntType *EIT = TL.getTypePtr();
7316 QualType
Result = TL.getType();
7318 if (getDerived().AlwaysRebuild()) {
7319 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7320 EIT->getNumBits(), TL.getNameLoc());
7325 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7326 NewTL.setNameLoc(TL.getNameLoc());
7330template <
typename Derived>
7331QualType TreeTransform<Derived>::TransformDependentBitIntType(
7332 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
7333 const DependentBitIntType *EIT = TL.getTypePtr();
7337 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7340 if (BitsExpr.isInvalid())
7343 QualType
Result = TL.getType();
7345 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7346 Result = getDerived().RebuildDependentBitIntType(
7347 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7353 if (isa<DependentBitIntType>(
Result)) {
7354 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
7355 NewTL.setNameLoc(TL.getNameLoc());
7357 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7358 NewTL.setNameLoc(TL.getNameLoc());
7363template <
typename Derived>
7364QualType TreeTransform<Derived>::TransformPredefinedSugarType(
7365 TypeLocBuilder &TLB, PredefinedSugarTypeLoc TL) {
7366 llvm_unreachable(
"This type does not need to be transformed.");
7374 template<
typename ArgLocContainer>
7376 ArgLocContainer *Container;
7401 : Container(&Container), Index(Index) { }
7415 return Container->getArgLoc(Index);
7419 return pointer(Container->getArgLoc(Index));
7424 return X.Container == Y.Container &&
X.Index == Y.Index;
7433template<
typename Derived>
7434QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7436 const AutoType *
T = TL.getTypePtr();
7437 QualType OldDeduced =
T->getDeducedType();
7438 QualType NewDeduced;
7439 if (!OldDeduced.isNull()) {
7440 NewDeduced = getDerived().TransformType(OldDeduced);
7441 if (NewDeduced.isNull())
7445 ConceptDecl *NewCD =
nullptr;
7446 TemplateArgumentListInfo NewTemplateArgs;
7447 NestedNameSpecifierLoc NewNestedNameSpec;
7448 if (
T->isConstrained()) {
7449 assert(TL.getConceptReference());
7450 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7451 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7453 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7454 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7455 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7456 if (getDerived().TransformTemplateArguments(
7457 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7461 if (TL.getNestedNameSpecifierLoc()) {
7463 = getDerived().TransformNestedNameSpecifierLoc(
7464 TL.getNestedNameSpecifierLoc());
7465 if (!NewNestedNameSpec)
7470 QualType
Result = TL.getType();
7471 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7475 NewArgList.reserve(NewTemplateArgs.size());
7476 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7477 NewArgList.push_back(ArgLoc.getArgument());
7478 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7484 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7485 NewTL.setNameLoc(TL.getNameLoc());
7486 NewTL.setRParenLoc(TL.getRParenLoc());
7487 NewTL.setConceptReference(
nullptr);
7489 if (
T->isConstrained()) {
7490 DeclarationNameInfo DNI = DeclarationNameInfo(
7491 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7492 TL.getConceptNameLoc(),
7493 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7495 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7496 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7498 NewTL.setConceptReference(CR);
7504template <
typename Derived>
7505QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
7506 TypeLocBuilder &TLB, TemplateSpecializationTypeLoc TL) {
7507 const TemplateSpecializationType *
T = TL.getTypePtr();
7509 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7511 QualifierLoc, TL.getTemplateKeywordLoc(),
T->getTemplateName(),
7512 TL.getTemplateNameLoc());
7516 TemplateArgumentListInfo NewTemplateArgs;
7517 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7518 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7519 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7521 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7522 ArgIterator(TL, TL.getNumArgs()),
7530 QualType
Result = getDerived().RebuildTemplateSpecializationType(
7531 TL.getTypePtr()->getKeyword(),
Template, TL.getTemplateNameLoc(),
7539 if (isa<DependentTemplateSpecializationType>(
Result)) {
7540 DependentTemplateSpecializationTypeLoc NewTL
7541 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7542 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7543 NewTL.setQualifierLoc(QualifierLoc);
7544 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7545 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7546 NewTL.setLAngleLoc(TL.getLAngleLoc());
7547 NewTL.setRAngleLoc(TL.getRAngleLoc());
7548 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7549 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7552 TLB.push<TemplateSpecializationTypeLoc>(
Result).set(
7553 TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getTemplateKeywordLoc(),
7554 TL.getTemplateNameLoc(), NewTemplateArgs);
7560template <
typename Derived>
7561QualType TreeTransform<Derived>::TransformAttributedType(TypeLocBuilder &TLB,
7562 AttributedTypeLoc TL) {
7564 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7565 if (modifiedType.isNull())
7569 const Attr *oldAttr = TL.getAttr();
7570 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7571 if (oldAttr && !newAttr)
7574 QualType result = TL.getType();
7577 if (getDerived().AlwaysRebuild() ||
7578 modifiedType != oldType->getModifiedType()) {
7591 QualType equivalentType = modifiedType;
7592 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7593 TypeLocBuilder AuxiliaryTLB;
7594 AuxiliaryTLB.reserve(TL.getFullDataSize());
7596 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7597 if (equivalentType.isNull())
7603 if (
auto nullability = oldType->getImmediateNullability()) {
7604 if (!modifiedType->canHaveNullability()) {
7605 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7606 : TL.getModifiedLoc().getBeginLoc()),
7607 diag::err_nullability_nonpointer)
7619 AttributedTypeLoc newTL = TLB.push<AttributedTypeLoc>(result);
7620 newTL.setAttr(newAttr);
7624template <
typename Derived>
7625QualType TreeTransform<Derived>::TransformCountAttributedType(
7626 TypeLocBuilder &TLB, CountAttributedTypeLoc TL) {
7627 const CountAttributedType *OldTy = TL.
getTypePtr();
7628 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7629 if (InnerTy.isNull())
7632 Expr *OldCount = TL.getCountExpr();
7633 Expr *NewCount =
nullptr;
7635 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7636 if (CountResult.isInvalid())
7638 NewCount = CountResult.get();
7641 QualType
Result = TL.getType();
7642 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7643 OldCount != NewCount) {
7646 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7649 TLB.push<CountAttributedTypeLoc>(
Result);
7653template <
typename Derived>
7654QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7655 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7657 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7660template <
typename Derived>
7661QualType TreeTransform<Derived>::TransformHLSLAttributedResourceType(
7662 TypeLocBuilder &TLB, HLSLAttributedResourceTypeLoc TL) {
7664 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7666 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7667 if (WrappedTy.isNull())
7670 QualType ContainedTy = QualType();
7671 QualType OldContainedTy = oldType->getContainedType();
7672 if (!OldContainedTy.isNull()) {
7673 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7674 if (!oldContainedTSI)
7675 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7676 OldContainedTy, SourceLocation());
7677 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7680 ContainedTy = ContainedTSI->getType();
7683 QualType
Result = TL.getType();
7684 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7685 ContainedTy != oldType->getContainedType()) {
7687 WrappedTy, ContainedTy, oldType->getAttrs());
7690 TLB.push<HLSLAttributedResourceTypeLoc>(
Result);
7694template <
typename Derived>
7695QualType TreeTransform<Derived>::TransformHLSLInlineSpirvType(
7696 TypeLocBuilder &TLB, HLSLInlineSpirvTypeLoc TL) {
7698 return TL.getType();
7701template<
typename Derived>
7703TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7705 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7709 QualType
Result = TL.getType();
7710 if (getDerived().AlwaysRebuild() ||
7711 Inner != TL.getInnerLoc().getType()) {
7712 Result = getDerived().RebuildParenType(Inner);
7717 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7718 NewTL.setLParenLoc(TL.getLParenLoc());
7719 NewTL.setRParenLoc(TL.getRParenLoc());
7723template <
typename Derived>
7725TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7726 MacroQualifiedTypeLoc TL) {
7727 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7731 QualType
Result = TL.getType();
7732 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7734 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7739 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7740 NewTL.setExpansionLoc(TL.getExpansionLoc());
7744template<
typename Derived>
7745QualType TreeTransform<Derived>::TransformDependentNameType(
7746 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7747 return TransformDependentNameType(TLB, TL,
false);
7750template <
typename Derived>
7751QualType TreeTransform<Derived>::TransformDependentNameType(
7752 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext,
7753 QualType ObjectType, NamedDecl *UnqualLookup) {
7754 const DependentNameType *
T = TL.getTypePtr();
7756 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7758 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7759 QualifierLoc, ObjectType, UnqualLookup);
7763 assert((ObjectType.isNull() && !UnqualLookup) &&
7764 "must be transformed by TransformNestedNameSpecifierLoc");
7768 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7769 TL.getElaboratedKeywordLoc(),
7777 if (isa<TagType>(
Result)) {
7778 auto NewTL = TLB.push<TagTypeLoc>(
Result);
7779 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7780 NewTL.setQualifierLoc(QualifierLoc);
7781 NewTL.setNameLoc(TL.getNameLoc());
7782 }
else if (isa<DeducedTemplateSpecializationType>(
Result)) {
7783 auto NewTL = TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
7784 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7785 NewTL.setTemplateNameLoc(TL.getNameLoc());
7786 NewTL.setQualifierLoc(QualifierLoc);
7787 }
else if (isa<TypedefType>(
Result)) {
7788 TLB.push<TypedefTypeLoc>(
Result).set(TL.getElaboratedKeywordLoc(),
7789 QualifierLoc, TL.getNameLoc());
7790 }
else if (isa<UnresolvedUsingType>(
Result)) {
7791 auto NewTL = TLB.push<UnresolvedUsingTypeLoc>(
Result);
7792 NewTL.set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7794 auto NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7795 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7796 NewTL.setQualifierLoc(QualifierLoc);
7797 NewTL.setNameLoc(TL.getNameLoc());
7802template <
typename Derived>
7805 return getDerived().TransformDependentTemplateSpecializationType(
7806 TLB, TL,
QualType(),
nullptr,
false);
7809template <
typename Derived>
7817 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7818 QualifierLoc, ObjectType, UnqualLookup);
7823 UnqualLookup =
nullptr;
7826 SS.Adopt(QualifierLoc);
7828 TemplateArgumentListInfo NewTemplateArgs(TL.
getLAngleLoc(),
7830 auto ArgsRange = llvm::make_range<TemplateArgumentLocContainerIterator<
7831 DependentTemplateSpecializationTypeLoc>>({TL, 0}, {TL, TL.
getNumArgs()});
7833 if (getDerived().TransformTemplateArguments(ArgsRange.begin(),
7834 ArgsRange.end(), NewTemplateArgs))
7836 bool TemplateArgumentsChanged = !llvm::equal(
7837 ArgsRange, NewTemplateArgs.arguments(),
7838 [](
const TemplateArgumentLoc &A,
const TemplateArgumentLoc &B) {
7839 return A.getArgument().structurallyEquals(B.getArgument());
7842 const DependentTemplateStorage &DTN =
T->getDependentTemplateName();
7845 if (getDerived().AlwaysRebuild() || SS.getScopeRep() != DTN.getQualifier() ||
7846 TemplateArgumentsChanged || !ObjectType.
isNull()) {
7849 ObjectType, AllowInjectedClassName);
7852 Result = getDerived().RebuildDependentTemplateSpecializationType(
7860 QualifierLoc = SS.getWithLocInContext(SemaRef.
Context);
7861 if (isa<TemplateSpecializationType>(
Result)) {
7862 TLB.
push<TemplateSpecializationTypeLoc>(
Result).set(
7866 auto SpecTL = TLB.
push<DependentTemplateSpecializationTypeLoc>(
Result);
7868 SpecTL.setQualifierLoc(QualifierLoc);
7873 for (
unsigned I = 0,
E = NewTemplateArgs.size(); I !=
E; ++I)
7874 SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo());
7879template<
typename Derived>
7880QualType TreeTransform<Derived>::TransformPackExpansionType(TypeLocBuilder &TLB,
7881 PackExpansionTypeLoc TL) {
7883 = getDerived().TransformType(TLB, TL.getPatternLoc());
7884 if (Pattern.isNull())
7887 QualType
Result = TL.getType();
7888 if (getDerived().AlwaysRebuild() ||
7889 Pattern != TL.getPatternLoc().getType()) {
7890 Result = getDerived().RebuildPackExpansionType(Pattern,
7891 TL.getPatternLoc().getSourceRange(),
7892 TL.getEllipsisLoc(),
7893 TL.getTypePtr()->getNumExpansions());
7898 PackExpansionTypeLoc NewT = TLB.push<PackExpansionTypeLoc>(
Result);
7899 NewT.setEllipsisLoc(TL.getEllipsisLoc());
7903template<
typename Derived>
7905TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7906 ObjCInterfaceTypeLoc TL) {
7908 TLB.pushFullCopy(TL);
7909 return TL.getType();
7912template<
typename Derived>
7914TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7915 ObjCTypeParamTypeLoc TL) {
7916 const ObjCTypeParamType *
T = TL.getTypePtr();
7917 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7918 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7922 QualType
Result = TL.getType();
7923 if (getDerived().AlwaysRebuild() ||
7924 OTP !=
T->getDecl()) {
7925 Result = getDerived().RebuildObjCTypeParamType(
7926 OTP, TL.getProtocolLAngleLoc(),
7927 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7928 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7933 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7934 if (TL.getNumProtocols()) {
7935 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7936 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7937 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7938 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7943template<
typename Derived>
7945TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7946 ObjCObjectTypeLoc TL) {
7948 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7949 if (BaseType.isNull())
7952 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7956 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7957 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7958 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7959 QualType TypeArg = TypeArgInfo->getType();
7960 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7964 const auto *PackExpansion = PackExpansionLoc.getType()
7965 ->castAs<PackExpansionType>();
7969 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7973 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7974 bool Expand =
false;
7975 bool RetainExpansion =
false;
7976 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7977 if (getDerived().TryExpandParameterPacks(
7978 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7979 Unexpanded,
true, Expand,
7980 RetainExpansion, NumExpansions))
7987 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
7989 TypeLocBuilder TypeArgBuilder;
7990 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7991 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7993 if (NewPatternType.isNull())
7997 NewPatternType, NumExpansions);
7998 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7999 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8000 NewTypeArgInfos.push_back(
8001 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8007 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8008 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), ArgIdx);
8010 TypeLocBuilder TypeArgBuilder;
8011 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
8013 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8015 if (NewTypeArg.isNull())
8018 NewTypeArgInfos.push_back(
8019 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8025 TypeLocBuilder TypeArgBuilder;
8026 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
8027 QualType NewTypeArg =
8028 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8029 if (NewTypeArg.isNull())
8033 if (NewTypeArg == TypeArg) {
8034 NewTypeArgInfos.push_back(TypeArgInfo);
8038 NewTypeArgInfos.push_back(
8039 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8043 QualType
Result = TL.getType();
8044 if (getDerived().AlwaysRebuild() || AnyChanged) {
8046 Result = getDerived().RebuildObjCObjectType(
8047 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8048 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8049 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8050 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8056 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
8057 NewT.setHasBaseTypeAsWritten(
true);
8058 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8059 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8060 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8061 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8062 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8063 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8064 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8065 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8069template<
typename Derived>
8071TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
8072 ObjCObjectPointerTypeLoc TL) {
8073 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8074 if (PointeeType.isNull())
8077 QualType
Result = TL.getType();
8078 if (getDerived().AlwaysRebuild() ||
8079 PointeeType != TL.getPointeeLoc().getType()) {
8080 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8086 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
8087 NewT.setStarLoc(TL.getStarLoc());
8094template<
typename Derived>
8096TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
8100template<
typename Derived>
8103 return getDerived().TransformCompoundStmt(S,
false);
8106template<
typename Derived>
8112 if (S->hasStoredFPFeatures())
8113 getSema().resetFPOptions(
8114 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
8117 bool SubStmtInvalid =
false;
8118 bool SubStmtChanged =
false;
8120 for (
auto *B : S->body()) {
8122 B, IsStmtExpr && B ==
ExprResult ? StmtDiscardKind::StmtExprResult
8123 : StmtDiscardKind::Discarded);
8125 if (
Result.isInvalid()) {
8128 if (isa<DeclStmt>(B))
8132 SubStmtInvalid =
true;
8136 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8137 Statements.push_back(
Result.getAs<Stmt>());
8143 if (!getDerived().AlwaysRebuild() &&
8147 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
8153template<
typename Derived>
8155TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
8162 LHS = getDerived().TransformExpr(S->getLHS());
8164 if (LHS.isInvalid())
8168 RHS = getDerived().TransformExpr(S->getRHS());
8170 if (RHS.isInvalid())
8177 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8179 S->getEllipsisLoc(),
8182 if (Case.isInvalid())
8187 getDerived().TransformStmt(S->getSubStmt());
8188 if (SubStmt.isInvalid())
8192 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8195template <
typename Derived>
8196StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
8199 getDerived().TransformStmt(S->getSubStmt());
8200 if (SubStmt.isInvalid())
8204 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8208template<
typename Derived>
8210TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
8211 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8212 if (SubStmt.isInvalid())
8215 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8223 if (LD == S->getDecl())
8224 S->getDecl()->setStmt(
nullptr);
8227 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8228 cast<LabelDecl>(LD), SourceLocation(),
8232template <
typename Derived>
8241 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8242#include "clang/Basic/AttrList.inc"
8247template <
typename Derived>
8258 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8259#include "clang/Basic/AttrList.inc"
8261 return TransformAttr(R);
8264template <
typename Derived>
8267 StmtDiscardKind SDK) {
8268 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8272 bool AttrsChanged =
false;
8276 for (
const auto *I : S->getAttrs()) {
8278 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
8279 AttrsChanged |= (I != R);
8284 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
8292 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8296template<
typename Derived>
8298TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
8301 if (
Init.isInvalid())
8304 Sema::ConditionResult Cond;
8305 if (!S->isConsteval()) {
8307 Cond = getDerived().TransformCondition(
8308 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8311 if (Cond.isInvalid())
8316 std::optional<bool> ConstexprConditionValue;
8317 if (S->isConstexpr())
8318 ConstexprConditionValue = Cond.getKnownValue();
8322 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8323 EnterExpressionEvaluationContext Ctx(
8326 S->isNonNegatedConsteval());
8328 Then = getDerived().TransformStmt(S->getThen());
8329 if (Then.isInvalid())
8335 Then =
new (getSema().Context)
8336 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8341 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8342 EnterExpressionEvaluationContext Ctx(
8345 S->isNegatedConsteval());
8347 Else = getDerived().TransformStmt(S->getElse());
8348 if (Else.isInvalid())
8350 }
else if (S->getElse() && ConstexprConditionValue &&
8351 *ConstexprConditionValue) {
8355 Else =
new (getSema().Context)
8356 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8359 if (!getDerived().AlwaysRebuild() &&
8360 Init.get() == S->getInit() &&
8361 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8362 Then.get() == S->getThen() &&
8363 Else.get() == S->getElse())
8366 return getDerived().RebuildIfStmt(
8367 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8368 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8371template<
typename Derived>
8373TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8376 if (
Init.isInvalid())
8380 Sema::ConditionResult Cond = getDerived().TransformCondition(
8381 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8383 if (Cond.isInvalid())
8388 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8389 Init.get(), Cond, S->getRParenLoc());
8394 StmtResult Body = getDerived().TransformStmt(S->getBody());
8395 if (Body.isInvalid())
8399 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8403template<
typename Derived>
8405TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8407 Sema::ConditionResult Cond = getDerived().TransformCondition(
8408 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8410 if (Cond.isInvalid())
8415 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8419 StmtResult Body = getDerived().TransformStmt(S->getBody());
8420 if (Body.isInvalid())
8423 if (!getDerived().AlwaysRebuild() &&
8424 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8425 Body.get() == S->getBody())
8428 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8429 Cond, S->getRParenLoc(), Body.get());
8432template<
typename Derived>
8434TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8437 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8441 StmtResult Body = getDerived().TransformStmt(S->getBody());
8442 if (Body.isInvalid())
8446 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8447 if (Cond.isInvalid())
8450 if (!getDerived().AlwaysRebuild() &&
8451 Cond.get() == S->getCond() &&
8452 Body.get() == S->getBody())
8455 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8456 S->getWhileLoc(), Cond.get(),
8460template<
typename Derived>
8462TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8463 if (getSema().getLangOpts().OpenMP)
8464 getSema().OpenMP().startOpenMPLoop();
8468 if (
Init.isInvalid())
8473 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8474 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8478 Sema::ConditionResult Cond = getDerived().TransformCondition(
8479 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8481 if (Cond.isInvalid())
8486 if (
Inc.isInvalid())
8489 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8490 if (S->getInc() && !FullInc.get())
8495 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8497 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8498 Cond.get().second, S->getInc(),
Inc.get());
8501 StmtResult Body = getDerived().TransformStmt(S->getBody());
8502 if (Body.isInvalid())
8507 if (!getDerived().AlwaysRebuild() &&
8508 Init.get() == S->getInit() &&
8509 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8510 Inc.get() == S->getInc() &&
8511 Body.get() == S->getBody())
8514 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8515 Init.get(), Cond, FullInc,
8516 S->getRParenLoc(), Body.get());
8519template<
typename Derived>
8521TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8522 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8528 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8529 cast<LabelDecl>(LD));
8532template<
typename Derived>
8534TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8540 if (!getDerived().AlwaysRebuild() &&
8541 Target.get() == S->getTarget())
8544 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8548template<
typename Derived>
8550TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8551 if (!S->hasLabelTarget())
8554 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8560 ContinueStmt(S->getKwLoc(), S->getLabelLoc(), cast<LabelDecl>(LD));
8563template<
typename Derived>
8565TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8566 if (!S->hasLabelTarget())
8569 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8575 BreakStmt(S->getKwLoc(), S->getLabelLoc(), cast<LabelDecl>(LD));
8578template<
typename Derived>
8580TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8588 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8591template<
typename Derived>
8593TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8594 bool DeclChanged =
false;
8596 LambdaScopeInfo *LSI = getSema().getCurLambda();
8597 for (
auto *
D : S->decls()) {
8602 if (Transformed !=
D)
8606 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8607 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8608 LSI->ContainsUnexpandedParameterPack |=
8609 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8611 LSI->ContainsUnexpandedParameterPack |=
8614 .getTypeDeclType(TD)
8615 ->containsUnexpandedParameterPack();
8618 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8619 LSI->ContainsUnexpandedParameterPack |=
8620 VD->getType()->containsUnexpandedParameterPack();
8623 Decls.push_back(Transformed);
8626 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8629 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8632template<
typename Derived>
8634TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8642 bool ExprsChanged =
false;
8644 auto RebuildString = [&](Expr *
E) {
8649 ExprsChanged =
true;
8656 for (
unsigned I = 0,
E = S->getNumOutputs(); I !=
E; ++I) {
8657 Names.push_back(S->getOutputIdentifier(I));
8663 Constraints.push_back(
Result.get());
8666 Expr *OutputExpr = S->getOutputExpr(I);
8667 Result = getDerived().TransformExpr(OutputExpr);
8671 ExprsChanged |=
Result.get() != OutputExpr;
8673 Exprs.push_back(
Result.get());
8677 for (
unsigned I = 0,
E = S->getNumInputs(); I !=
E; ++I) {
8678 Names.push_back(S->getInputIdentifier(I));
8684 Constraints.push_back(
Result.get());
8687 Expr *InputExpr = S->getInputExpr(I);
8688 Result = getDerived().TransformExpr(InputExpr);
8692 ExprsChanged |=
Result.get() != InputExpr;
8694 Exprs.push_back(
Result.get());
8698 for (
unsigned I = 0,
E = S->getNumLabels(); I !=
E; ++I) {
8699 Names.push_back(S->getLabelIdentifier(I));
8704 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8705 Exprs.push_back(
Result.get());
8709 for (
unsigned I = 0,
E = S->getNumClobbers(); I !=
E; ++I) {
8713 Clobbers.push_back(
Result.get());
8716 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8717 if (AsmString.isInvalid())
8720 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8723 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8724 S->isVolatile(), S->getNumOutputs(),
8725 S->getNumInputs(), Names.data(),
8726 Constraints, Exprs, AsmString.get(),
8727 Clobbers, S->getNumLabels(),
8731template<
typename Derived>
8733TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8736 bool HadError =
false, HadChange =
false;
8740 TransformedExprs.reserve(SrcExprs.size());
8741 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8743 if (!
Result.isUsable()) {
8746 HadChange |= (
Result.get() != SrcExprs[i]);
8747 TransformedExprs.push_back(
Result.get());
8752 if (!HadChange && !getDerived().AlwaysRebuild())
8755 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8756 AsmToks, S->getAsmString(),
8757 S->getNumOutputs(), S->getNumInputs(),
8758 S->getAllConstraints(), S->getClobbers(),
8759 TransformedExprs, S->getEndLoc());
8763template<
typename Derived>
8765TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8767 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8768 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8769 ScopeInfo->NeedsCoroutineSuspends &&
8770 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8771 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8772 "expected clean scope info");
8776 ScopeInfo->setNeedsCoroutineSuspends(
false);
8789 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8790 ScopeInfo->CoroutinePromise = Promise;
8795 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8796 if (InitSuspend.isInvalid())
8799 getDerived().TransformStmt(S->getFinalSuspendStmt());
8800 if (FinalSuspend.isInvalid() ||
8803 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8804 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8806 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8807 if (BodyRes.isInvalid())
8810 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8811 if (Builder.isInvalid())
8814 Expr *ReturnObject = S->getReturnValueInit();
8815 assert(ReturnObject &&
"the return object is expected to be valid");
8816 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8818 if (Res.isInvalid())
8820 Builder.ReturnValue = Res.get();
8825 if (S->hasDependentPromiseType()) {
8828 if (!Promise->getType()->isDependentType()) {
8829 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8830 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8831 "these nodes should not have been built yet");
8832 if (!Builder.buildDependentStatements())
8836 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8837 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8838 if (Res.isInvalid())
8840 Builder.OnFallthrough = Res.get();
8843 if (
auto *OnException = S->getExceptionHandler()) {
8844 StmtResult Res = getDerived().TransformStmt(OnException);
8845 if (Res.isInvalid())
8847 Builder.OnException = Res.get();
8850 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8851 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8852 if (Res.isInvalid())
8854 Builder.ReturnStmtOnAllocFailure = Res.get();
8858 assert(S->getAllocate() && S->getDeallocate() &&
8859 "allocation and deallocation calls must already be built");
8860 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8861 if (AllocRes.isInvalid())
8863 Builder.Allocate = AllocRes.get();
8865 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8866 if (DeallocRes.isInvalid())
8868 Builder.Deallocate = DeallocRes.get();
8870 if (
auto *ResultDecl = S->getResultDecl()) {
8871 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8872 if (Res.isInvalid())
8874 Builder.ResultDecl = Res.get();
8877 if (
auto *ReturnStmt = S->getReturnStmt()) {
8878 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8879 if (Res.isInvalid())
8881 Builder.ReturnStmt = Res.get();
8885 return getDerived().RebuildCoroutineBodyStmt(Builder);
8888template<
typename Derived>
8890TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8898 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8902template <
typename Derived>
8903ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *
E) {
8915 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8916 getSema().getCurScope(),
E->getKeywordLoc());
8920 return getDerived().RebuildCoawaitExpr(
8922 cast<UnresolvedLookupExpr>(Lookup.get()),
E->isImplicit());
8925template <
typename Derived>
8927TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *
E) {
8928 ExprResult OperandResult = getDerived().TransformInitializer(
E->getOperand(),
8930 if (OperandResult.isInvalid())
8933 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8934 E->getOperatorCoawaitLookup());
8936 if (LookupResult.isInvalid())
8941 return getDerived().RebuildDependentCoawaitExpr(
8942 E->getKeywordLoc(), OperandResult.get(),
8943 cast<UnresolvedLookupExpr>(LookupResult.get()));
8946template<
typename Derived>
8948TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *
E) {
8956 return getDerived().RebuildCoyieldExpr(
E->getKeywordLoc(),
Result.get());
8961template<
typename Derived>
8963TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8965 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8966 if (TryBody.isInvalid())
8970 bool AnyCatchChanged =
false;
8972 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8973 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8974 if (Catch.isInvalid())
8976 if (Catch.get() != S->getCatchStmt(I))
8977 AnyCatchChanged =
true;
8978 CatchStmts.push_back(Catch.get());
8983 if (S->getFinallyStmt()) {
8984 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8985 if (Finally.isInvalid())
8990 if (!getDerived().AlwaysRebuild() &&
8991 TryBody.get() == S->getTryBody() &&
8993 Finally.get() == S->getFinallyStmt())
8997 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8998 CatchStmts, Finally.get());
9001template<
typename Derived>
9003TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
9005 VarDecl *Var =
nullptr;
9006 if (VarDecl *FromVar = S->getCatchParamDecl()) {
9007 TypeSourceInfo *TSInfo =
nullptr;
9008 if (FromVar->getTypeSourceInfo()) {
9009 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9016 T = TSInfo->getType();
9018 T = getDerived().TransformType(FromVar->getType());
9023 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9028 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9029 if (Body.isInvalid())
9032 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9037template<
typename Derived>
9039TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
9041 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9042 if (Body.isInvalid())
9046 if (!getDerived().AlwaysRebuild() &&
9047 Body.get() == S->getFinallyBody())
9051 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9055template<
typename Derived>
9057TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
9059 if (S->getThrowExpr()) {
9060 Operand = getDerived().TransformExpr(S->getThrowExpr());
9065 if (!getDerived().AlwaysRebuild() &&
9066 Operand.get() == S->getThrowExpr())
9069 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9072template<
typename Derived>
9074TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
9075 ObjCAtSynchronizedStmt *S) {
9081 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9087 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9088 if (Body.isInvalid())
9092 if (!getDerived().AlwaysRebuild() &&
9093 Object.get() == S->getSynchExpr() &&
9094 Body.get() == S->getSynchBody())
9098 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9099 Object.get(), Body.get());
9102template<
typename Derived>
9104TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
9105 ObjCAutoreleasePoolStmt *S) {
9107 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9108 if (Body.isInvalid())
9112 if (!getDerived().AlwaysRebuild() &&
9113 Body.get() == S->getSubStmt())
9117 return getDerived().RebuildObjCAutoreleasePoolStmt(
9118 S->getAtLoc(), Body.get());
9121template<
typename Derived>
9123TreeTransform<Derived>::TransformObjCForCollectionStmt(
9124 ObjCForCollectionStmt *S) {
9126 StmtResult Element = getDerived().TransformStmt(
9127 S->getElement(), StmtDiscardKind::NotDiscarded);
9128 if (Element.isInvalid())
9132 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9133 if (Collection.isInvalid())
9137 StmtResult Body = getDerived().TransformStmt(S->getBody());
9138 if (Body.isInvalid())
9142 if (!getDerived().AlwaysRebuild() &&
9143 Element.get() == S->getElement() &&
9144 Collection.get() == S->getCollection() &&
9145 Body.get() == S->getBody())
9149 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9156template <
typename Derived>
9157StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
9159 VarDecl *Var =
nullptr;
9160 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9162 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9166 Var = getDerived().RebuildExceptionDecl(
9167 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9168 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9169 if (!Var || Var->isInvalidDecl())
9174 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9175 if (Handler.isInvalid())
9178 if (!getDerived().AlwaysRebuild() && !Var &&
9179 Handler.get() == S->getHandlerBlock())
9182 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9185template <
typename Derived>
9186StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
9188 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9189 if (TryBlock.isInvalid())
9193 bool HandlerChanged =
false;
9195 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9196 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9197 if (Handler.isInvalid())
9200 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9201 Handlers.push_back(Handler.getAs<Stmt>());
9204 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9206 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9210 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9214template<
typename Derived>
9216TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
9217 EnterExpressionEvaluationContext ForRangeInitContext(
9225 auto &LastRecord = getSema().currentEvaluationContext();
9226 LastRecord.InLifetimeExtendingContext =
true;
9227 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9230 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9231 if (
Init.isInvalid())
9240 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9241 auto ForRangeLifetimeExtendTemps =
9242 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9247 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9248 if (End.isInvalid())
9251 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9252 if (Cond.isInvalid())
9256 if (Cond.isInvalid())
9262 if (
Inc.isInvalid())
9267 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9268 if (LoopVar.isInvalid())
9272 if (getDerived().AlwaysRebuild() ||
9273 Init.get() != S->getInit() ||
9274 Range.get() != S->getRangeStmt() ||
9275 Begin.get() != S->getBeginStmt() ||
9276 End.get() != S->getEndStmt() ||
9277 Cond.get() != S->getCond() ||
9278 Inc.get() != S->getInc() ||
9279 LoopVar.get() != S->getLoopVarStmt()) {
9280 NewStmt = getDerived().RebuildCXXForRangeStmt(
9281 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9283 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9284 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9287 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
9294 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
9297 StmtResult Body = getDerived().TransformStmt(S->getBody());
9298 if (Body.isInvalid())
9305 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9306 NewStmt = getDerived().RebuildCXXForRangeStmt(
9307 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9309 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9310 if (NewStmt.isInvalid())
9314 if (NewStmt.get() == S)
9317 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9320template<
typename Derived>
9322TreeTransform<Derived>::TransformMSDependentExistsStmt(
9323 MSDependentExistsStmt *S) {
9325 NestedNameSpecifierLoc QualifierLoc;
9326 if (S->getQualifierLoc()) {
9328 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9334 DeclarationNameInfo NameInfo = S->getNameInfo();
9335 if (NameInfo.getName()) {
9336 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9337 if (!NameInfo.getName())
9342 if (!getDerived().AlwaysRebuild() &&
9343 QualifierLoc == S->getQualifierLoc() &&
9344 NameInfo.getName() == S->getNameInfo().getName())
9349 SS.Adopt(QualifierLoc);
9351 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9353 if (S->isIfExists())
9356 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9359 if (S->isIfNotExists())
9362 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9373 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9374 if (SubStmt.isInvalid())
9382 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9389template<
typename Derived>
9391TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *
E) {
9392 NestedNameSpecifierLoc QualifierLoc;
9393 if (
E->getQualifierLoc()) {
9395 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
9400 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
9401 getDerived().TransformDecl(
E->getMemberLoc(),
E->getPropertyDecl()));
9406 if (
Base.isInvalid())
9410 MSPropertyRefExpr(
Base.get(), PD,
E->isArrow(),
9412 QualifierLoc,
E->getMemberLoc());
9415template <
typename Derived>
9416ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
9417 MSPropertySubscriptExpr *
E) {
9418 auto BaseRes = getDerived().TransformExpr(
E->getBase());
9419 if (BaseRes.isInvalid())
9421 auto IdxRes = getDerived().TransformExpr(
E->getIdx());
9422 if (IdxRes.isInvalid())
9425 if (!getDerived().AlwaysRebuild() &&
9426 BaseRes.get() ==
E->getBase() &&
9427 IdxRes.get() ==
E->getIdx())
9430 return getDerived().RebuildArraySubscriptExpr(
9431 BaseRes.get(), SourceLocation(), IdxRes.get(),
E->getRBracketLoc());
9434template <
typename Derived>
9435StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
9436 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9437 if (TryBlock.isInvalid())
9440 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9441 if (Handler.isInvalid())
9444 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9445 Handler.get() == S->getHandler())
9448 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9449 TryBlock.get(), Handler.get());
9452template <
typename Derived>
9453StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9455 if (
Block.isInvalid())
9458 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9461template <
typename Derived>
9462StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9463 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9464 if (FilterExpr.isInvalid())
9468 if (
Block.isInvalid())
9471 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9475template <
typename Derived>
9477 if (isa<SEHFinallyStmt>(Handler))
9478 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9480 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9483template<
typename Derived>
9493template <
typename Derived>
9495TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9499 return getDerived().TransformStmt(L->getLoopStmt());
9502template <
typename Derived>
9509 TClauses.reserve(Clauses.size());
9513 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9514 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9515 getDerived().getSema().OpenMP().EndOpenMPClause();
9517 TClauses.push_back(Clause);
9519 TClauses.push_back(
nullptr);
9523 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9524 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9525 D->getDirectiveKind(),
9531 if (
D->getDirectiveKind() == OMPD_atomic ||
9532 D->getDirectiveKind() == OMPD_critical ||
9533 D->getDirectiveKind() == OMPD_section ||
9534 D->getDirectiveKind() == OMPD_master)
9535 CS =
D->getAssociatedStmt();
9537 CS =
D->getRawStmt();
9538 Body = getDerived().TransformStmt(CS);
9540 getSema().getLangOpts().OpenMPIRBuilder)
9541 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9544 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9549 if (TClauses.size() != Clauses.size()) {
9555 if (
D->getDirectiveKind() == OMPD_critical) {
9556 DirName = cast<OMPCriticalDirective>(
D)->getDirectiveName();
9557 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9560 if (
D->getDirectiveKind() == OMPD_cancellation_point) {
9561 CancelRegion = cast<OMPCancellationPointDirective>(
D)->getCancelRegion();
9562 }
else if (
D->getDirectiveKind() == OMPD_cancel) {
9563 CancelRegion = cast<OMPCancelDirective>(
D)->getCancelRegion();
9566 return getDerived().RebuildOMPExecutableDirective(
9567 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9576template <
typename Derived>
9583 TClauses.reserve(Clauses.size());
9586 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9587 OMPClause *Clause = getDerived().TransformOMPClause(
C);
9588 getDerived().getSema().OpenMP().EndOpenMPClause();
9590 TClauses.push_back(Clause);
9592 TClauses.push_back(
nullptr);
9596 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9597 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9598 D->getDirectiveKind(),
9603 assert(
D->getDirectiveKind() == OMPD_assume &&
9604 "Unexpected informational directive");
9605 Stmt *CS =
D->getAssociatedStmt();
9606 Body = getDerived().TransformStmt(CS);
9609 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9613 if (TClauses.size() != Clauses.size())
9618 return getDerived().RebuildOMPInformationalDirective(
9619 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9623template <
typename Derived>
9629 << getOpenMPDirectiveName(
D->getDirectiveKind(), OMPVersion);
9633template <
typename Derived>
9635TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *
D) {
9636 DeclarationNameInfo DirName;
9637 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9639 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9640 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9644template <
typename Derived>
9646TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *
D) {
9647 DeclarationNameInfo DirName;
9648 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9650 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9651 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9655template <
typename Derived>
9657TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *
D) {
9658 DeclarationNameInfo DirName;
9659 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9661 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9662 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9666template <
typename Derived>
9668TreeTransform<Derived>::TransformOMPStripeDirective(OMPStripeDirective *
D) {
9669 DeclarationNameInfo DirName;
9670 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9672 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9673 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9677template <
typename Derived>
9679TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *
D) {
9680 DeclarationNameInfo DirName;
9681 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9683 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9684 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9688template <
typename Derived>
9690TreeTransform<Derived>::TransformOMPReverseDirective(OMPReverseDirective *
D) {
9691 DeclarationNameInfo DirName;
9692 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9694 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9695 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9699template <
typename Derived>
9700StmtResult TreeTransform<Derived>::TransformOMPInterchangeDirective(
9701 OMPInterchangeDirective *
D) {
9702 DeclarationNameInfo DirName;
9703 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9705 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9706 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9710template <
typename Derived>
9712TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *
D) {
9713 DeclarationNameInfo DirName;
9714 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9716 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9717 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9721template <
typename Derived>
9723TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *
D) {
9724 DeclarationNameInfo DirName;
9725 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9727 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9728 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9732template <
typename Derived>
9734TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *
D) {
9735 DeclarationNameInfo DirName;
9736 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9738 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9739 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9743template <
typename Derived>
9745TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *
D) {
9746 DeclarationNameInfo DirName;
9747 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9749 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9750 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9754template <
typename Derived>
9756TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *
D) {
9757 DeclarationNameInfo DirName;
9758 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9760 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9761 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9765template <
typename Derived>
9767TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *
D) {
9768 DeclarationNameInfo DirName;
9769 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9771 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9772 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9776template <
typename Derived>
9778TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *
D) {
9779 DeclarationNameInfo DirName;
9780 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9782 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9783 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9787template <
typename Derived>
9789TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *
D) {
9790 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9791 OMPD_critical,
D->getDirectiveName(),
nullptr,
D->
getBeginLoc());
9792 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9793 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9797template <
typename Derived>
9798StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9799 OMPParallelForDirective *
D) {
9800 DeclarationNameInfo DirName;
9801 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9802 OMPD_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9803 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9804 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9808template <
typename Derived>
9809StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9810 OMPParallelForSimdDirective *
D) {
9811 DeclarationNameInfo DirName;
9812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9813 OMPD_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9814 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9815 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9819template <
typename Derived>
9820StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9821 OMPParallelMasterDirective *
D) {
9822 DeclarationNameInfo DirName;
9823 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9824 OMPD_parallel_master, DirName,
nullptr,
D->
getBeginLoc());
9825 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9826 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9830template <
typename Derived>
9831StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9832 OMPParallelMaskedDirective *
D) {
9833 DeclarationNameInfo DirName;
9834 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9835 OMPD_parallel_masked, DirName,
nullptr,
D->
getBeginLoc());
9836 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9837 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9841template <
typename Derived>
9842StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9843 OMPParallelSectionsDirective *
D) {
9844 DeclarationNameInfo DirName;
9845 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9846 OMPD_parallel_sections, DirName,
nullptr,
D->
getBeginLoc());
9847 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9848 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9852template <
typename Derived>
9854TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *
D) {
9855 DeclarationNameInfo DirName;
9856 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9858 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9859 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9863template <
typename Derived>
9864StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9865 OMPTaskyieldDirective *
D) {
9866 DeclarationNameInfo DirName;
9867 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9869 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9870 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9874template <
typename Derived>
9876TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *
D) {
9877 DeclarationNameInfo DirName;
9878 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9880 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9881 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9885template <
typename Derived>
9887TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *
D) {
9888 DeclarationNameInfo DirName;
9889 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9891 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9892 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9896template <
typename Derived>
9898TreeTransform<Derived>::TransformOMPAssumeDirective(OMPAssumeDirective *
D) {
9899 DeclarationNameInfo DirName;
9900 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9902 StmtResult Res = getDerived().TransformOMPInformationalDirective(
D);
9903 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9907template <
typename Derived>
9909TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *
D) {
9910 DeclarationNameInfo DirName;
9911 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9913 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9914 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9918template <
typename Derived>
9919StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9920 OMPTaskgroupDirective *
D) {
9921 DeclarationNameInfo DirName;
9922 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9924 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9925 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9929template <
typename Derived>
9931TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *
D) {
9932 DeclarationNameInfo DirName;
9933 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9935 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9936 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9940template <
typename Derived>
9942TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *
D) {
9943 DeclarationNameInfo DirName;
9944 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9946 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9947 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9951template <
typename Derived>
9953TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *
D) {
9954 DeclarationNameInfo DirName;
9955 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9957 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9958 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9962template <
typename Derived>
9964TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *
D) {
9965 DeclarationNameInfo DirName;
9966 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9968 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9969 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9973template <
typename Derived>
9975TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *
D) {
9976 DeclarationNameInfo DirName;
9977 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9979 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9980 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9984template <
typename Derived>
9986TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *
D) {
9987 DeclarationNameInfo DirName;
9988 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9990 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9991 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9995template <
typename Derived>
9996StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9997 OMPTargetDataDirective *
D) {
9998 DeclarationNameInfo DirName;
9999 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10000 OMPD_target_data, DirName,
nullptr,
D->
getBeginLoc());
10001 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10002 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10006template <
typename Derived>
10007StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
10008 OMPTargetEnterDataDirective *
D) {
10009 DeclarationNameInfo DirName;
10010 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10011 OMPD_target_enter_data, DirName,
nullptr,
D->
getBeginLoc());
10012 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10013 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10017template <
typename Derived>
10018StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
10019 OMPTargetExitDataDirective *
D) {
10020 DeclarationNameInfo DirName;
10021 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10022 OMPD_target_exit_data, DirName,
nullptr,
D->
getBeginLoc());
10023 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10024 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10028template <
typename Derived>
10029StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
10030 OMPTargetParallelDirective *
D) {
10031 DeclarationNameInfo DirName;
10032 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10033 OMPD_target_parallel, DirName,
nullptr,
D->
getBeginLoc());
10034 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10035 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10039template <
typename Derived>
10040StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
10041 OMPTargetParallelForDirective *
D) {
10042 DeclarationNameInfo DirName;
10043 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10044 OMPD_target_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10045 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10046 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10050template <
typename Derived>
10051StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
10052 OMPTargetUpdateDirective *
D) {
10053 DeclarationNameInfo DirName;
10054 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10055 OMPD_target_update, DirName,
nullptr,
D->
getBeginLoc());
10056 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10057 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10061template <
typename Derived>
10063TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *
D) {
10064 DeclarationNameInfo DirName;
10065 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10067 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10068 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10072template <
typename Derived>
10073StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
10074 OMPCancellationPointDirective *
D) {
10075 DeclarationNameInfo DirName;
10076 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10077 OMPD_cancellation_point, DirName,
nullptr,
D->
getBeginLoc());
10078 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10079 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10083template <
typename Derived>
10085TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *
D) {
10086 DeclarationNameInfo DirName;
10087 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10089 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10090 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10094template <
typename Derived>
10096TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *
D) {
10097 DeclarationNameInfo DirName;
10098 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10100 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10101 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10105template <
typename Derived>
10106StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
10107 OMPTaskLoopSimdDirective *
D) {
10108 DeclarationNameInfo DirName;
10109 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10110 OMPD_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10111 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10112 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10116template <
typename Derived>
10117StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
10118 OMPMasterTaskLoopDirective *
D) {
10119 DeclarationNameInfo DirName;
10120 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10121 OMPD_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10122 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10123 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10127template <
typename Derived>
10128StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
10129 OMPMaskedTaskLoopDirective *
D) {
10130 DeclarationNameInfo DirName;
10131 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10132 OMPD_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10133 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10134 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10138template <
typename Derived>
10139StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
10140 OMPMasterTaskLoopSimdDirective *
D) {
10141 DeclarationNameInfo DirName;
10142 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10143 OMPD_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10144 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10145 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10149template <
typename Derived>
10150StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
10151 OMPMaskedTaskLoopSimdDirective *
D) {
10152 DeclarationNameInfo DirName;
10153 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10154 OMPD_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10155 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10156 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10160template <
typename Derived>
10161StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
10162 OMPParallelMasterTaskLoopDirective *
D) {
10163 DeclarationNameInfo DirName;
10164 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10165 OMPD_parallel_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10166 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10167 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10171template <
typename Derived>
10172StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
10173 OMPParallelMaskedTaskLoopDirective *
D) {
10174 DeclarationNameInfo DirName;
10175 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10176 OMPD_parallel_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10177 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10178 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10182template <
typename Derived>
10184TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
10185 OMPParallelMasterTaskLoopSimdDirective *
D) {
10186 DeclarationNameInfo DirName;
10187 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10188 OMPD_parallel_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10189 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10190 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10194template <
typename Derived>
10196TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
10197 OMPParallelMaskedTaskLoopSimdDirective *
D) {
10198 DeclarationNameInfo DirName;
10199 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10200 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10201 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10202 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10206template <
typename Derived>
10207StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
10208 OMPDistributeDirective *
D) {
10209 DeclarationNameInfo DirName;
10210 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10212 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10213 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10217template <
typename Derived>
10218StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
10219 OMPDistributeParallelForDirective *
D) {
10220 DeclarationNameInfo DirName;
10221 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10222 OMPD_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10223 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10224 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10228template <
typename Derived>
10230TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
10231 OMPDistributeParallelForSimdDirective *
D) {
10232 DeclarationNameInfo DirName;
10233 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10234 OMPD_distribute_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10235 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10236 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10240template <
typename Derived>
10241StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
10242 OMPDistributeSimdDirective *
D) {
10243 DeclarationNameInfo DirName;
10244 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10245 OMPD_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10246 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10247 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10251template <
typename Derived>
10252StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
10253 OMPTargetParallelForSimdDirective *
D) {
10254 DeclarationNameInfo DirName;
10255 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10256 OMPD_target_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10257 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10258 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10262template <
typename Derived>
10263StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
10264 OMPTargetSimdDirective *
D) {
10265 DeclarationNameInfo DirName;
10266 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10267 OMPD_target_simd, DirName,
nullptr,
D->
getBeginLoc());
10268 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10269 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10273template <
typename Derived>
10274StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
10275 OMPTeamsDistributeDirective *
D) {
10276 DeclarationNameInfo DirName;
10277 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10278 OMPD_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10279 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10280 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10284template <
typename Derived>
10285StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
10286 OMPTeamsDistributeSimdDirective *
D) {
10287 DeclarationNameInfo DirName;
10288 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10289 OMPD_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10290 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10291 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10295template <
typename Derived>
10296StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
10297 OMPTeamsDistributeParallelForSimdDirective *
D) {
10298 DeclarationNameInfo DirName;
10299 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10300 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10302 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10303 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10307template <
typename Derived>
10308StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
10309 OMPTeamsDistributeParallelForDirective *
D) {
10310 DeclarationNameInfo DirName;
10311 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10312 OMPD_teams_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10313 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10314 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10318template <
typename Derived>
10319StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
10320 OMPTargetTeamsDirective *
D) {
10321 DeclarationNameInfo DirName;
10322 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10323 OMPD_target_teams, DirName,
nullptr,
D->
getBeginLoc());
10324 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10325 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10329template <
typename Derived>
10330StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
10331 OMPTargetTeamsDistributeDirective *
D) {
10332 DeclarationNameInfo DirName;
10333 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10334 OMPD_target_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10335 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10336 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10340template <
typename Derived>
10342TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
10343 OMPTargetTeamsDistributeParallelForDirective *
D) {
10344 DeclarationNameInfo DirName;
10345 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10346 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10348 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10349 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10353template <
typename Derived>
10355 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
10356 OMPTargetTeamsDistributeParallelForSimdDirective *
D) {
10357 DeclarationNameInfo DirName;
10358 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10359 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10361 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10362 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10366template <
typename Derived>
10368TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
10369 OMPTargetTeamsDistributeSimdDirective *
D) {
10370 DeclarationNameInfo DirName;
10371 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10372 OMPD_target_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10373 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10374 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10378template <
typename Derived>
10380TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *
D) {
10381 DeclarationNameInfo DirName;
10382 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10384 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10385 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10389template <
typename Derived>
10391TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *
D) {
10392 DeclarationNameInfo DirName;
10393 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10395 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10396 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10400template <
typename Derived>
10402TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *
D) {
10403 DeclarationNameInfo DirName;
10404 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10406 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10407 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10411template <
typename Derived>
10412StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
10413 OMPGenericLoopDirective *
D) {
10414 DeclarationNameInfo DirName;
10415 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10417 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10418 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10422template <
typename Derived>
10423StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
10424 OMPTeamsGenericLoopDirective *
D) {
10425 DeclarationNameInfo DirName;
10426 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10428 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10429 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10433template <
typename Derived>
10434StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
10435 OMPTargetTeamsGenericLoopDirective *
D) {
10436 DeclarationNameInfo DirName;
10437 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10438 OMPD_target_teams_loop, DirName,
nullptr,
D->
getBeginLoc());
10439 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10440 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10444template <
typename Derived>
10445StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
10446 OMPParallelGenericLoopDirective *
D) {
10447 DeclarationNameInfo DirName;
10448 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10449 OMPD_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10450 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10451 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10455template <
typename Derived>
10457TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
10458 OMPTargetParallelGenericLoopDirective *
D) {
10459 DeclarationNameInfo DirName;
10460 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10461 OMPD_target_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10462 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10463 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10470template <
typename Derived>
10471OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
10472 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10473 if (Cond.isInvalid())
10475 return getDerived().RebuildOMPIfClause(
10476 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10477 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10480template <
typename Derived>
10481OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
10482 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10483 if (Cond.isInvalid())
10485 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10486 C->getLParenLoc(),
C->getEndLoc());
10489template <
typename Derived>
10491TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
10492 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10493 if (NumThreads.isInvalid())
10495 return getDerived().RebuildOMPNumThreadsClause(
10496 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10497 C->getModifierLoc(),
C->getEndLoc());
10500template <
typename Derived>
10502TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
10503 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10506 return getDerived().RebuildOMPSafelenClause(
10507 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10510template <
typename Derived>
10512TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
10513 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10516 return getDerived().RebuildOMPAllocatorClause(
10517 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10520template <
typename Derived>
10522TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
10523 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10526 return getDerived().RebuildOMPSimdlenClause(
10527 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10530template <
typename Derived>
10531OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
10533 TransformedSizes.reserve(
C->getNumSizes());
10535 for (Expr *
E :
C->getSizesRefs()) {
10537 TransformedSizes.push_back(
nullptr);
10546 TransformedSizes.push_back(
T.get());
10549 if (!Changed && !getDerived().AlwaysRebuild())
10551 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10552 C->getLParenLoc(),
C->getEndLoc());
10555template <
typename Derived>
10557TreeTransform<Derived>::TransformOMPPermutationClause(OMPPermutationClause *
C) {
10559 TransformedArgs.reserve(
C->getNumLoops());
10561 for (Expr *
E :
C->getArgsRefs()) {
10563 TransformedArgs.push_back(
nullptr);
10572 TransformedArgs.push_back(
T.get());
10575 if (!Changed && !getDerived().AlwaysRebuild())
10577 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10578 C->getLParenLoc(),
C->getEndLoc());
10581template <
typename Derived>
10582OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10583 if (!getDerived().AlwaysRebuild())
10585 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10588template <
typename Derived>
10590TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10591 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10594 Expr *Factor =
T.get();
10595 bool Changed = Factor !=
C->getFactor();
10597 if (!Changed && !getDerived().AlwaysRebuild())
10599 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10603template <
typename Derived>
10605TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10606 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10609 return getDerived().RebuildOMPCollapseClause(
10610 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10613template <
typename Derived>
10615TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10616 return getDerived().RebuildOMPDefaultClause(
10617 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10618 C->getLParenLoc(),
C->getEndLoc());
10621template <
typename Derived>
10623TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10624 return getDerived().RebuildOMPProcBindClause(
10625 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10626 C->getLParenLoc(),
C->getEndLoc());
10629template <
typename Derived>
10631TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10632 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10635 return getDerived().RebuildOMPScheduleClause(
10636 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10637 C->getScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10638 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10639 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10642template <
typename Derived>
10644TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10646 if (
auto *
Num =
C->getNumForLoops()) {
10647 E = getDerived().TransformExpr(
Num);
10651 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10652 C->getLParenLoc(),
E.get());
10655template <
typename Derived>
10657TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10659 if (Expr *Evt =
C->getEventHandler()) {
10660 E = getDerived().TransformExpr(Evt);
10664 return getDerived().RebuildOMPDetachClause(
E.get(),
C->getBeginLoc(),
10665 C->getLParenLoc(),
C->getEndLoc());
10668template <
typename Derived>
10670TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10675template <
typename Derived>
10677TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10682template <
typename Derived>
10684TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10689template <
typename Derived>
10690OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10695template <
typename Derived>
10696OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10701template <
typename Derived>
10703TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10708template <
typename Derived>
10710TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10715template <
typename Derived>
10717TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10722template <
typename Derived>
10723OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10728template <
typename Derived>
10730TreeTransform<Derived>::TransformOMPAbsentClause(OMPAbsentClause *
C) {
10734template <
typename Derived>
10735OMPClause *TreeTransform<Derived>::TransformOMPHoldsClause(OMPHoldsClause *
C) {
10736 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10739 return getDerived().RebuildOMPHoldsClause(
E.get(),
C->getBeginLoc(),
10740 C->getLParenLoc(),
C->getEndLoc());
10743template <
typename Derived>
10745TreeTransform<Derived>::TransformOMPContainsClause(OMPContainsClause *
C) {
10749template <
typename Derived>
10751TreeTransform<Derived>::TransformOMPNoOpenMPClause(OMPNoOpenMPClause *
C) {
10754template <
typename Derived>
10755OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPRoutinesClause(
10756 OMPNoOpenMPRoutinesClause *
C) {
10759template <
typename Derived>
10760OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPConstructsClause(
10761 OMPNoOpenMPConstructsClause *
C) {
10764template <
typename Derived>
10765OMPClause *TreeTransform<Derived>::TransformOMPNoParallelismClause(
10766 OMPNoParallelismClause *
C) {
10770template <
typename Derived>
10772TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10777template <
typename Derived>
10779TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10784template <
typename Derived>
10786TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10791template <
typename Derived>
10793TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10798template <
typename Derived>
10800TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10805template <
typename Derived>
10806OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10811template <
typename Derived>
10813TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10818template <
typename Derived>
10819OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10824template <
typename Derived>
10826TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10831template <
typename Derived>
10832OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10833 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10834 if (IVR.isInvalid())
10837 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10838 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10839 for (Expr *
E : llvm::drop_begin(
C->varlist())) {
10840 ExprResult ER = getDerived().TransformExpr(cast<Expr>(
E));
10841 if (ER.isInvalid())
10843 InteropInfo.PreferTypes.push_back(ER.get());
10845 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10846 C->getBeginLoc(),
C->getLParenLoc(),
10847 C->getVarLoc(),
C->getEndLoc());
10850template <
typename Derived>
10851OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10852 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10853 if (ER.isInvalid())
10855 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10856 C->getLParenLoc(),
C->getVarLoc(),
10860template <
typename Derived>
10862TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10864 if (Expr *IV =
C->getInteropVar()) {
10865 ER = getDerived().TransformExpr(IV);
10866 if (ER.isInvalid())
10869 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10870 C->getLParenLoc(),
C->getVarLoc(),
10874template <
typename Derived>
10876TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10877 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10878 if (Cond.isInvalid())
10880 return getDerived().RebuildOMPNovariantsClause(
10881 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10884template <
typename Derived>
10886TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10887 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10888 if (Cond.isInvalid())
10890 return getDerived().RebuildOMPNocontextClause(
10891 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10894template <
typename Derived>
10896TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10897 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10898 if (ThreadID.isInvalid())
10900 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10901 C->getLParenLoc(),
C->getEndLoc());
10904template <
typename Derived>
10905OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10906 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10909 return getDerived().RebuildOMPAlignClause(
E.get(),
C->getBeginLoc(),
10910 C->getLParenLoc(),
C->getEndLoc());
10913template <
typename Derived>
10914OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10915 OMPUnifiedAddressClause *
C) {
10916 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10919template <
typename Derived>
10920OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10921 OMPUnifiedSharedMemoryClause *
C) {
10923 "unified_shared_memory clause cannot appear in dependent context");
10926template <
typename Derived>
10927OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10928 OMPReverseOffloadClause *
C) {
10929 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10932template <
typename Derived>
10933OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10934 OMPDynamicAllocatorsClause *
C) {
10936 "dynamic_allocators clause cannot appear in dependent context");
10939template <
typename Derived>
10940OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10941 OMPAtomicDefaultMemOrderClause *
C) {
10943 "atomic_default_mem_order clause cannot appear in dependent context");
10946template <
typename Derived>
10948TreeTransform<Derived>::TransformOMPSelfMapsClause(OMPSelfMapsClause *
C) {
10949 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10952template <
typename Derived>
10953OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10954 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10955 C->getBeginLoc(),
C->getLParenLoc(),
10959template <
typename Derived>
10961TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10962 return getDerived().RebuildOMPSeverityClause(
10963 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10964 C->getLParenLoc(),
C->getEndLoc());
10967template <
typename Derived>
10969TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10970 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10973 return getDerived().RebuildOMPMessageClause(
10974 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10977template <
typename Derived>
10979TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10981 Vars.reserve(
C->varlist_size());
10982 for (
auto *VE :
C->varlist()) {
10983 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10984 if (EVar.isInvalid())
10986 Vars.push_back(EVar.get());
10988 return getDerived().RebuildOMPPrivateClause(
10989 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10992template <
typename Derived>
10993OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10994 OMPFirstprivateClause *
C) {
10996 Vars.reserve(
C->varlist_size());
10997 for (
auto *VE :
C->varlist()) {
10998 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10999 if (EVar.isInvalid())
11001 Vars.push_back(EVar.get());
11003 return getDerived().RebuildOMPFirstprivateClause(
11004 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11007template <
typename Derived>
11009TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
11011 Vars.reserve(
C->varlist_size());
11012 for (
auto *VE :
C->varlist()) {
11013 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11014 if (EVar.isInvalid())
11016 Vars.push_back(EVar.get());
11018 return getDerived().RebuildOMPLastprivateClause(
11019 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11020 C->getLParenLoc(),
C->getEndLoc());
11023template <
typename Derived>
11025TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
11027 Vars.reserve(
C->varlist_size());
11028 for (
auto *VE :
C->varlist()) {
11029 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11030 if (EVar.isInvalid())
11032 Vars.push_back(EVar.get());
11034 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11035 C->getLParenLoc(),
C->getEndLoc());
11038template <
typename Derived>
11040TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
11042 Vars.reserve(
C->varlist_size());
11043 for (
auto *VE :
C->varlist()) {
11044 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11045 if (EVar.isInvalid())
11047 Vars.push_back(EVar.get());
11049 CXXScopeSpec ReductionIdScopeSpec;
11050 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
11052 DeclarationNameInfo NameInfo =
C->getNameInfo();
11053 if (NameInfo.getName()) {
11054 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11055 if (!NameInfo.getName())
11061 for (
auto *
E :
C->reduction_ops()) {
11064 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11065 UnresolvedSet<8> Decls;
11066 for (
auto *
D : ULE->decls()) {
11068 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
11069 Decls.addDecl(InstD, InstD->getAccess());
11073 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11074 true, Decls.begin(), Decls.end(),
11077 UnresolvedReductions.push_back(
nullptr);
11079 return getDerived().RebuildOMPReductionClause(
11080 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11081 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11082 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11085template <
typename Derived>
11086OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
11087 OMPTaskReductionClause *
C) {
11089 Vars.reserve(
C->varlist_size());
11090 for (
auto *VE :
C->varlist()) {
11091 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11092 if (EVar.isInvalid())
11094 Vars.push_back(EVar.get());
11096 CXXScopeSpec ReductionIdScopeSpec;
11097 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
11099 DeclarationNameInfo NameInfo =
C->getNameInfo();
11100 if (NameInfo.getName()) {
11101 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11102 if (!NameInfo.getName())
11108 for (
auto *
E :
C->reduction_ops()) {
11111 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11112 UnresolvedSet<8> Decls;
11113 for (
auto *
D : ULE->decls()) {
11115 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
11116 Decls.addDecl(InstD, InstD->getAccess());
11120 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11121 true, Decls.begin(), Decls.end(),
11124 UnresolvedReductions.push_back(
nullptr);
11126 return getDerived().RebuildOMPTaskReductionClause(
11127 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11128 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11131template <
typename Derived>
11133TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
11135 Vars.reserve(
C->varlist_size());
11136 for (
auto *VE :
C->varlist()) {
11137 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11138 if (EVar.isInvalid())
11140 Vars.push_back(EVar.get());
11142 CXXScopeSpec ReductionIdScopeSpec;
11143 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
11145 DeclarationNameInfo NameInfo =
C->getNameInfo();
11146 if (NameInfo.getName()) {
11147 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11148 if (!NameInfo.getName())
11154 for (
auto *
E :
C->reduction_ops()) {
11157 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11158 UnresolvedSet<8> Decls;
11159 for (
auto *
D : ULE->decls()) {
11161 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
11162 Decls.addDecl(InstD, InstD->getAccess());
11166 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11167 true, Decls.begin(), Decls.end(),
11170 UnresolvedReductions.push_back(
nullptr);
11172 return getDerived().RebuildOMPInReductionClause(
11173 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11174 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11177template <
typename Derived>
11179TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
11181 Vars.reserve(
C->varlist_size());
11182 for (
auto *VE :
C->varlist()) {
11183 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11184 if (EVar.isInvalid())
11186 Vars.push_back(EVar.get());
11188 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11189 if (Step.isInvalid())
11191 return getDerived().RebuildOMPLinearClause(
11192 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11193 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11197template <
typename Derived>
11199TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
11201 Vars.reserve(
C->varlist_size());
11202 for (
auto *VE :
C->varlist()) {
11203 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11204 if (EVar.isInvalid())
11206 Vars.push_back(EVar.get());
11208 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11209 if (Alignment.isInvalid())
11211 return getDerived().RebuildOMPAlignedClause(
11212 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11213 C->getColonLoc(),
C->getEndLoc());
11216template <
typename Derived>
11218TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
11220 Vars.reserve(
C->varlist_size());
11221 for (
auto *VE :
C->varlist()) {
11222 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11223 if (EVar.isInvalid())
11225 Vars.push_back(EVar.get());
11227 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11228 C->getLParenLoc(),
C->getEndLoc());
11231template <
typename Derived>
11233TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
11235 Vars.reserve(
C->varlist_size());
11236 for (
auto *VE :
C->varlist()) {
11237 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11238 if (EVar.isInvalid())
11240 Vars.push_back(EVar.get());
11242 return getDerived().RebuildOMPCopyprivateClause(
11243 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11246template <
typename Derived>
11247OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
11249 Vars.reserve(
C->varlist_size());
11250 for (
auto *VE :
C->varlist()) {
11251 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11252 if (EVar.isInvalid())
11254 Vars.push_back(EVar.get());
11256 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11257 C->getLParenLoc(),
C->getEndLoc());
11260template <
typename Derived>
11262TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
11263 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11266 return getDerived().RebuildOMPDepobjClause(
E.get(),
C->getBeginLoc(),
11267 C->getLParenLoc(),
C->getEndLoc());
11270template <
typename Derived>
11272TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
11274 Expr *DepModifier =
C->getModifier();
11276 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11277 if (DepModRes.isInvalid())
11279 DepModifier = DepModRes.
get();
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().RebuildOMPDependClause(
11289 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11290 C->getOmpAllMemoryLoc()},
11291 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11294template <
typename Derived>
11296TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
11297 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11300 return getDerived().RebuildOMPDeviceClause(
11301 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11302 C->getModifierLoc(),
C->getEndLoc());
11305template <
typename Derived,
class T>
11312 Vars.reserve(
C->varlist_size());
11313 for (
auto *VE :
C->varlist()) {
11317 Vars.push_back(EVar.
get());
11321 if (
C->getMapperQualifierLoc()) {
11322 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11323 C->getMapperQualifierLoc());
11327 MapperIdScopeSpec.
Adopt(QualifierLoc);
11328 MapperIdInfo =
C->getMapperIdInfo();
11329 if (MapperIdInfo.
getName()) {
11330 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11336 for (
auto *
E :
C->mapperlists()) {
11339 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11341 for (
auto *
D : ULE->decls()) {
11349 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
11352 UnresolvedMappers.push_back(
nullptr);
11358template <
typename Derived>
11359OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11360 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11362 Expr *IteratorModifier =
C->getIteratorModifier();
11363 if (IteratorModifier) {
11364 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11365 if (MapModRes.isInvalid())
11367 IteratorModifier = MapModRes.
get();
11369 CXXScopeSpec MapperIdScopeSpec;
11370 DeclarationNameInfo MapperIdInfo;
11372 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
11373 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11375 return getDerived().RebuildOMPMapClause(
11376 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11377 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11378 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11381template <
typename Derived>
11383TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
11384 Expr *Allocator =
C->getAllocator();
11386 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11387 if (AllocatorRes.isInvalid())
11389 Allocator = AllocatorRes.get();
11391 Expr *Alignment =
C->getAlignment();
11393 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11394 if (AlignmentRes.isInvalid())
11396 Alignment = AlignmentRes.
get();
11399 Vars.reserve(
C->varlist_size());
11400 for (
auto *VE :
C->varlist()) {
11401 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11402 if (EVar.isInvalid())
11404 Vars.push_back(EVar.get());
11406 return getDerived().RebuildOMPAllocateClause(
11407 Allocator, Alignment,
C->getFirstAllocateModifier(),
11408 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11409 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11410 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11413template <
typename Derived>
11415TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
11417 Vars.reserve(
C->varlist_size());
11418 for (
auto *VE :
C->varlist()) {
11419 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11420 if (EVar.isInvalid())
11422 Vars.push_back(EVar.get());
11424 return getDerived().RebuildOMPNumTeamsClause(
11425 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11428template <
typename Derived>
11430TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
11432 Vars.reserve(
C->varlist_size());
11433 for (
auto *VE :
C->varlist()) {
11434 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11435 if (EVar.isInvalid())
11437 Vars.push_back(EVar.get());
11439 return getDerived().RebuildOMPThreadLimitClause(
11440 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11443template <
typename Derived>
11445TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
11446 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11449 return getDerived().RebuildOMPPriorityClause(
11450 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11453template <
typename Derived>
11455TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
11456 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11459 return getDerived().RebuildOMPGrainsizeClause(
11460 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11461 C->getModifierLoc(),
C->getEndLoc());
11464template <
typename Derived>
11466TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
11467 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11470 return getDerived().RebuildOMPNumTasksClause(
11471 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11472 C->getModifierLoc(),
C->getEndLoc());
11475template <
typename Derived>
11476OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
11477 ExprResult E = getDerived().TransformExpr(
C->getHint());
11480 return getDerived().RebuildOMPHintClause(
E.get(),
C->getBeginLoc(),
11481 C->getLParenLoc(),
C->getEndLoc());
11484template <
typename Derived>
11485OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
11486 OMPDistScheduleClause *
C) {
11487 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11490 return getDerived().RebuildOMPDistScheduleClause(
11491 C->getDistScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11492 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11495template <
typename Derived>
11497TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
11500 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
11501 C->getDefaultmapKind(),
11504 C->getDefaultmapModifierLoc(),
11505 C->getDefaultmapKindLoc(),
11509template <
typename Derived>
11510OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
11511 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11513 CXXScopeSpec MapperIdScopeSpec;
11514 DeclarationNameInfo MapperIdInfo;
11516 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
11517 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11519 return getDerived().RebuildOMPToClause(
11520 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11521 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11524template <
typename Derived>
11525OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
11526 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11528 CXXScopeSpec MapperIdScopeSpec;
11529 DeclarationNameInfo MapperIdInfo;
11531 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
11532 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11534 return getDerived().RebuildOMPFromClause(
11535 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11536 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11539template <
typename Derived>
11540OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
11541 OMPUseDevicePtrClause *
C) {
11543 Vars.reserve(
C->varlist_size());
11544 for (
auto *VE :
C->varlist()) {
11545 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11546 if (EVar.isInvalid())
11548 Vars.push_back(EVar.get());
11550 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11551 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11554template <
typename Derived>
11555OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
11556 OMPUseDeviceAddrClause *
C) {
11558 Vars.reserve(
C->varlist_size());
11559 for (
auto *VE :
C->varlist()) {
11560 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11561 if (EVar.isInvalid())
11563 Vars.push_back(EVar.get());
11565 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11566 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11569template <
typename Derived>
11571TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
11573 Vars.reserve(
C->varlist_size());
11574 for (
auto *VE :
C->varlist()) {
11575 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11576 if (EVar.isInvalid())
11578 Vars.push_back(EVar.get());
11580 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11581 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11584template <
typename Derived>
11585OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
11586 OMPHasDeviceAddrClause *
C) {
11588 Vars.reserve(
C->varlist_size());
11589 for (
auto *VE :
C->varlist()) {
11590 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11591 if (EVar.isInvalid())
11593 Vars.push_back(EVar.get());
11595 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11596 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11599template <
typename Derived>
11601TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
11603 Vars.reserve(
C->varlist_size());
11604 for (
auto *VE :
C->varlist()) {
11605 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11606 if (EVar.isInvalid())
11608 Vars.push_back(EVar.get());
11610 return getDerived().RebuildOMPNontemporalClause(
11611 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11614template <
typename Derived>
11616TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
11618 Vars.reserve(
C->varlist_size());
11619 for (
auto *VE :
C->varlist()) {
11620 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11621 if (EVar.isInvalid())
11623 Vars.push_back(EVar.get());
11625 return getDerived().RebuildOMPInclusiveClause(
11626 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11629template <
typename Derived>
11631TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
11633 Vars.reserve(
C->varlist_size());
11634 for (
auto *VE :
C->varlist()) {
11635 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11636 if (EVar.isInvalid())
11638 Vars.push_back(EVar.get());
11640 return getDerived().RebuildOMPExclusiveClause(
11641 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11644template <
typename Derived>
11645OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11646 OMPUsesAllocatorsClause *
C) {
11648 Data.reserve(
C->getNumberOfAllocators());
11649 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
11650 OMPUsesAllocatorsClause::Data
D =
C->getAllocatorData(I);
11651 ExprResult Allocator = getDerived().TransformExpr(
D.Allocator);
11652 if (Allocator.isInvalid())
11655 if (Expr *AT =
D.AllocatorTraits) {
11656 AllocatorTraits = getDerived().TransformExpr(AT);
11657 if (AllocatorTraits.isInvalid())
11660 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11661 NewD.Allocator = Allocator.get();
11662 NewD.AllocatorTraits = AllocatorTraits.get();
11663 NewD.LParenLoc =
D.LParenLoc;
11664 NewD.RParenLoc =
D.RParenLoc;
11666 return getDerived().RebuildOMPUsesAllocatorsClause(
11667 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11670template <
typename Derived>
11672TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11674 Locators.reserve(
C->varlist_size());
11676 if (Expr *Modifier =
C->getModifier()) {
11677 ModifierRes = getDerived().TransformExpr(Modifier);
11678 if (ModifierRes.isInvalid())
11681 for (Expr *
E :
C->varlist()) {
11682 ExprResult Locator = getDerived().TransformExpr(
E);
11683 if (Locator.isInvalid())
11685 Locators.push_back(Locator.get());
11687 return getDerived().RebuildOMPAffinityClause(
11688 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11689 ModifierRes.get(), Locators);
11692template <
typename Derived>
11693OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11694 return getDerived().RebuildOMPOrderClause(
11695 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11696 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11699template <
typename Derived>
11700OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11701 return getDerived().RebuildOMPBindClause(
11702 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11703 C->getLParenLoc(),
C->getEndLoc());
11706template <
typename Derived>
11707OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11708 OMPXDynCGroupMemClause *
C) {
11710 if (
Size.isInvalid())
11712 return getDerived().RebuildOMPXDynCGroupMemClause(
11713 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11716template <
typename Derived>
11718TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11720 Vars.reserve(
C->varlist_size());
11721 for (
auto *VE :
C->varlist()) {
11722 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11723 if (EVar.isInvalid())
11725 Vars.push_back(EVar.get());
11727 return getDerived().RebuildOMPDoacrossClause(
11728 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11729 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11732template <
typename Derived>
11734TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11736 for (
auto *A :
C->getAttrs())
11737 NewAttrs.push_back(getDerived().TransformAttr(A));
11738 return getDerived().RebuildOMPXAttributeClause(
11739 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11742template <
typename Derived>
11743OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11744 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11751template <
typename Derived>
11752class OpenACCClauseTransform final
11753 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11754 TreeTransform<Derived> &Self;
11756 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11757 OpenACCClause *NewClause =
nullptr;
11760 ExprResult Res = Self.TransformExpr(VarRef);
11762 if (!Res.isUsable())
11765 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11766 ParsedClause.getClauseKind(),
11774 for (Expr *CurVar : VarList) {
11777 if (VarRef.isUsable())
11778 InstantiatedVarList.push_back(VarRef.get());
11781 return InstantiatedVarList;
11785 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11787 SemaOpenACC::OpenACCParsedClause &PC)
11788 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11790 OpenACCClause *CreatedClause()
const {
return NewClause; }
11792#define VISIT_CLAUSE(CLAUSE_NAME) \
11793 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11794#include "clang/Basic/OpenACCClauses.def"
11797template <
typename Derived>
11798void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11799 const OpenACCDefaultClause &
C) {
11808template <
typename Derived>
11809void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11810 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11811 assert(Cond &&
"If constructed with invalid Condition");
11812 Sema::ConditionResult Res =
Self.TransformCondition(
11815 if (Res.isInvalid() || !Res.get().second)
11826template <
typename Derived>
11827void OpenACCClauseTransform<Derived>::VisitSelfClause(
11828 const OpenACCSelfClause &
C) {
11833 for (Expr *CurVar :
C.getVarList()) {
11836 if (!Res.isUsable())
11843 if (Res.isUsable())
11844 InstantiatedVarList.push_back(Res.get());
11856 if (
C.hasConditionExpr()) {
11857 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11858 Sema::ConditionResult Res =
11859 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11862 if (Res.isInvalid() || !Res.get().second)
11875template <
typename Derived>
11876void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11877 const OpenACCNumGangsClause &
C) {
11880 for (Expr *CurIntExpr :
C.getIntExprs()) {
11883 if (!Res.isUsable())
11888 C.getBeginLoc(), Res.get());
11889 if (!Res.isUsable())
11892 InstantiatedIntExprs.push_back(Res.get());
11902template <
typename Derived>
11903void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11904 const OpenACCPrivateClause &
C) {
11908 for (
const auto [RefExpr, InitRecipe] :
11909 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11912 if (VarRef.isUsable()) {
11913 InstantiatedVarList.push_back(VarRef.get());
11918 InitRecipes.push_back(InitRecipe);
11920 InitRecipes.push_back(
11936template <
typename Derived>
11937void OpenACCClauseTransform<Derived>::VisitHostClause(
11938 const OpenACCHostClause &
C) {
11948template <
typename Derived>
11949void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11950 const OpenACCDeviceClause &
C) {
11960template <
typename Derived>
11961void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11962 const OpenACCFirstPrivateClause &
C) {
11966 for (
const auto [RefExpr, InitRecipe] :
11967 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11970 if (VarRef.isUsable()) {
11971 InstantiatedVarList.push_back(VarRef.get());
11975 if (InitRecipe.RecipeDecl)
11976 InitRecipes.push_back(InitRecipe);
11978 InitRecipes.push_back(
Self.getSema().OpenACC().CreateInitRecipe(
11991template <
typename Derived>
11992void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11993 const OpenACCNoCreateClause &
C) {
12003template <
typename Derived>
12004void OpenACCClauseTransform<Derived>::VisitPresentClause(
12005 const OpenACCPresentClause &
C) {
12015template <
typename Derived>
12016void OpenACCClauseTransform<Derived>::VisitCopyClause(
12017 const OpenACCCopyClause &
C) {
12019 C.getModifierList());
12028template <
typename Derived>
12029void OpenACCClauseTransform<Derived>::VisitLinkClause(
12030 const OpenACCLinkClause &
C) {
12031 llvm_unreachable(
"link clause not valid unless a decl transform");
12034template <
typename Derived>
12035void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12036 const OpenACCDeviceResidentClause &
C) {
12037 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12039template <
typename Derived>
12040void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12041 const OpenACCNoHostClause &
C) {
12042 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12044template <
typename Derived>
12045void OpenACCClauseTransform<Derived>::VisitBindClause(
12046 const OpenACCBindClause &
C) {
12047 llvm_unreachable(
"bind clause not valid unless a decl transform");
12050template <
typename Derived>
12051void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12052 const OpenACCCopyInClause &
C) {
12054 C.getModifierList());
12063template <
typename Derived>
12064void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12065 const OpenACCCopyOutClause &
C) {
12067 C.getModifierList());
12076template <
typename Derived>
12077void OpenACCClauseTransform<Derived>::VisitCreateClause(
12078 const OpenACCCreateClause &
C) {
12080 C.getModifierList());
12088template <
typename Derived>
12089void OpenACCClauseTransform<Derived>::VisitAttachClause(
12090 const OpenACCAttachClause &
C) {
12094 llvm::erase_if(VarList, [&](Expr *
E) {
12095 return Self.getSema().OpenACC().CheckVarIsPointerType(
12106template <
typename Derived>
12107void OpenACCClauseTransform<Derived>::VisitDetachClause(
12108 const OpenACCDetachClause &
C) {
12112 llvm::erase_if(VarList, [&](Expr *
E) {
12113 return Self.getSema().OpenACC().CheckVarIsPointerType(
12124template <
typename Derived>
12125void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12126 const OpenACCDeleteClause &
C) {
12135template <
typename Derived>
12136void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12137 const OpenACCUseDeviceClause &
C) {
12146template <
typename Derived>
12147void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12148 const OpenACCDevicePtrClause &
C) {
12152 llvm::erase_if(VarList, [&](Expr *
E) {
12153 return Self.getSema().OpenACC().CheckVarIsPointerType(
12164template <
typename Derived>
12165void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12166 const OpenACCNumWorkersClause &
C) {
12167 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12168 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12171 if (!Res.isUsable())
12176 C.getBeginLoc(), Res.get());
12177 if (!Res.isUsable())
12187template <
typename Derived>
12188void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12189 const OpenACCDeviceNumClause &
C) {
12190 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12191 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12194 if (!Res.isUsable())
12199 C.getBeginLoc(), Res.get());
12200 if (!Res.isUsable())
12210template <
typename Derived>
12211void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12212 const OpenACCDefaultAsyncClause &
C) {
12213 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12214 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12217 if (!Res.isUsable())
12222 C.getBeginLoc(), Res.get());
12223 if (!Res.isUsable())
12233template <
typename Derived>
12234void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12235 const OpenACCVectorLengthClause &
C) {
12236 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12237 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12240 if (!Res.isUsable())
12245 C.getBeginLoc(), Res.get());
12246 if (!Res.isUsable())
12256template <
typename Derived>
12257void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12258 const OpenACCAsyncClause &
C) {
12259 if (
C.hasIntExpr()) {
12260 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12261 if (!Res.isUsable())
12266 C.getBeginLoc(), Res.get());
12267 if (!Res.isUsable())
12280template <
typename Derived>
12281void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12282 const OpenACCWorkerClause &
C) {
12283 if (
C.hasIntExpr()) {
12287 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12288 if (!Res.isUsable())
12293 C.getBeginLoc(), Res.get());
12294 if (!Res.isUsable())
12307template <
typename Derived>
12308void OpenACCClauseTransform<Derived>::VisitVectorClause(
12309 const OpenACCVectorClause &
C) {
12310 if (
C.hasIntExpr()) {
12314 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12315 if (!Res.isUsable())
12320 C.getBeginLoc(), Res.get());
12321 if (!Res.isUsable())
12334template <
typename Derived>
12335void OpenACCClauseTransform<Derived>::VisitWaitClause(
12336 const OpenACCWaitClause &
C) {
12337 if (
C.hasExprs()) {
12338 Expr *DevNumExpr =
nullptr;
12342 if (
C.getDevNumExpr()) {
12344 if (!Res.isUsable())
12348 C.getBeginLoc(), Res.get());
12349 if (!Res.isUsable())
12352 DevNumExpr = Res.get();
12356 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12358 if (!Res.isUsable())
12362 C.getBeginLoc(), Res.get());
12363 if (!Res.isUsable())
12366 InstantiatedQueueIdExprs.push_back(Res.get());
12370 std::move(InstantiatedQueueIdExprs));
12380template <
typename Derived>
12381void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12382 const OpenACCDeviceTypeClause &
C) {
12385 Self.getSema().getASTContext(),
C.getClauseKind(),
12387 C.getArchitectures(), ParsedClause.
getEndLoc());
12390template <
typename Derived>
12391void OpenACCClauseTransform<Derived>::VisitAutoClause(
12392 const OpenACCAutoClause &
C) {
12399template <
typename Derived>
12400void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12401 const OpenACCIndependentClause &
C) {
12407template <
typename Derived>
12408void OpenACCClauseTransform<Derived>::VisitSeqClause(
12409 const OpenACCSeqClause &
C) {
12414template <
typename Derived>
12415void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12416 const OpenACCFinalizeClause &
C) {
12422template <
typename Derived>
12423void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12424 const OpenACCIfPresentClause &
C) {
12430template <
typename Derived>
12431void OpenACCClauseTransform<Derived>::VisitReductionClause(
12432 const OpenACCReductionClause &
C) {
12437 for (
const auto [Var, OrigRecipes] :
12438 llvm::zip(TransformedVars,
C.getRecipes())) {
12441 if (Res.isUsable()) {
12442 ValidVars.push_back(Res.get());
12446 static_assert(
sizeof(OpenACCReductionRecipe) ==
sizeof(
int*));
12447 VarDecl *InitRecipe =
nullptr;
12448 if (OrigRecipes.RecipeDecl)
12449 InitRecipe = OrigRecipes.RecipeDecl;
12451 InitRecipe =
Self.getSema()
12454 C.getReductionOp(), Res.get())
12457 Recipes.push_back({InitRecipe});
12461 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12464 C.getReductionOp(), ValidVars, Recipes, ParsedClause.
getEndLoc());
12467template <
typename Derived>
12468void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12469 const OpenACCCollapseClause &
C) {
12470 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12471 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12475 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12477 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12480 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12489template <
typename Derived>
12490void OpenACCClauseTransform<Derived>::VisitTileClause(
12491 const OpenACCTileClause &
C) {
12495 for (Expr *
E :
C.getSizeExprs()) {
12498 if (!NewSizeExpr.isUsable())
12501 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12503 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12505 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12507 if (!NewSizeExpr.isUsable())
12509 TransformedExprs.push_back(NewSizeExpr.get());
12518template <
typename Derived>
12519void OpenACCClauseTransform<Derived>::VisitGangClause(
12520 const OpenACCGangClause &
C) {
12524 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12525 ExprResult ER =
Self.TransformExpr(
const_cast<Expr *
>(
C.getExpr(I).second));
12526 if (!ER.isUsable())
12529 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12531 C.getExpr(I).first, ER.get());
12532 if (!ER.isUsable())
12534 TransformedGangKinds.push_back(
C.getExpr(I).first);
12535 TransformedIntExprs.push_back(ER.get());
12538 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12541 TransformedGangKinds, TransformedIntExprs, ParsedClause.
getEndLoc());
12544template <
typename Derived>
12545OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12549 SemaOpenACC::OpenACCParsedClause ParsedClause(
12550 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12551 ParsedClause.
setEndLoc(OldClause->getEndLoc());
12553 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12556 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12558 Transform.Visit(OldClause);
12560 return Transform.CreatedClause();
12563template <
typename Derived>
12565TreeTransform<Derived>::TransformOpenACCClauseList(
12568 for (
const auto *Clause : OldClauses) {
12569 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12570 TransformedClauses, DirKind, Clause))
12571 TransformedClauses.push_back(TransformedClause);
12573 return TransformedClauses;
12576template <
typename Derived>
12577StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
12578 OpenACCComputeConstruct *
C) {
12579 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12582 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12585 if (getSema().OpenACC().ActOnStartStmtDirective(
12586 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12590 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12591 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12592 C->clauses(), TransformedClauses);
12593 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12594 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12595 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12597 return getDerived().RebuildOpenACCComputeConstruct(
12598 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12599 C->getEndLoc(), TransformedClauses, StrBlock);
12602template <
typename Derived>
12604TreeTransform<Derived>::TransformOpenACCLoopConstruct(OpenACCLoopConstruct *
C) {
12606 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12609 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12612 if (getSema().OpenACC().ActOnStartStmtDirective(
12613 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12617 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12618 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12619 C->clauses(), TransformedClauses);
12621 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12622 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12624 return getDerived().RebuildOpenACCLoopConstruct(
12625 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12626 TransformedClauses,
Loop);
12629template <
typename Derived>
12630StmtResult TreeTransform<Derived>::TransformOpenACCCombinedConstruct(
12631 OpenACCCombinedConstruct *
C) {
12632 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12635 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12638 if (getSema().OpenACC().ActOnStartStmtDirective(
12639 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12643 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12644 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12645 C->clauses(), TransformedClauses);
12647 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12648 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12650 return getDerived().RebuildOpenACCCombinedConstruct(
12651 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12652 C->getEndLoc(), TransformedClauses,
Loop);
12655template <
typename Derived>
12657TreeTransform<Derived>::TransformOpenACCDataConstruct(OpenACCDataConstruct *
C) {
12658 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12661 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12663 if (getSema().OpenACC().ActOnStartStmtDirective(
12664 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12667 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12668 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12669 C->clauses(), TransformedClauses);
12670 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12671 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12672 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12674 return getDerived().RebuildOpenACCDataConstruct(
12675 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12676 TransformedClauses, StrBlock);
12679template <
typename Derived>
12680StmtResult TreeTransform<Derived>::TransformOpenACCEnterDataConstruct(
12681 OpenACCEnterDataConstruct *
C) {
12682 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12685 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12687 if (getSema().OpenACC().ActOnStartStmtDirective(
12688 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12691 return getDerived().RebuildOpenACCEnterDataConstruct(
12692 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12693 TransformedClauses);
12696template <
typename Derived>
12697StmtResult TreeTransform<Derived>::TransformOpenACCExitDataConstruct(
12698 OpenACCExitDataConstruct *
C) {
12699 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12702 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12704 if (getSema().OpenACC().ActOnStartStmtDirective(
12705 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12708 return getDerived().RebuildOpenACCExitDataConstruct(
12709 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12710 TransformedClauses);
12713template <
typename Derived>
12714StmtResult TreeTransform<Derived>::TransformOpenACCHostDataConstruct(
12715 OpenACCHostDataConstruct *
C) {
12716 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12719 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12721 if (getSema().OpenACC().ActOnStartStmtDirective(
12722 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12725 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12726 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12727 C->clauses(), TransformedClauses);
12728 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12729 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12730 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12732 return getDerived().RebuildOpenACCHostDataConstruct(
12733 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12734 TransformedClauses, StrBlock);
12737template <
typename Derived>
12739TreeTransform<Derived>::TransformOpenACCInitConstruct(OpenACCInitConstruct *
C) {
12740 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12743 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12745 if (getSema().OpenACC().ActOnStartStmtDirective(
12746 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12749 return getDerived().RebuildOpenACCInitConstruct(
12750 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12751 TransformedClauses);
12754template <
typename Derived>
12755StmtResult TreeTransform<Derived>::TransformOpenACCShutdownConstruct(
12756 OpenACCShutdownConstruct *
C) {
12757 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12760 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12762 if (getSema().OpenACC().ActOnStartStmtDirective(
12763 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12766 return getDerived().RebuildOpenACCShutdownConstruct(
12767 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12768 TransformedClauses);
12770template <
typename Derived>
12772TreeTransform<Derived>::TransformOpenACCSetConstruct(OpenACCSetConstruct *
C) {
12773 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12776 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12778 if (getSema().OpenACC().ActOnStartStmtDirective(
12779 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12782 return getDerived().RebuildOpenACCSetConstruct(
12783 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12784 TransformedClauses);
12787template <
typename Derived>
12788StmtResult TreeTransform<Derived>::TransformOpenACCUpdateConstruct(
12789 OpenACCUpdateConstruct *
C) {
12790 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12793 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12795 if (getSema().OpenACC().ActOnStartStmtDirective(
12796 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12799 return getDerived().RebuildOpenACCUpdateConstruct(
12800 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12801 TransformedClauses);
12804template <
typename Derived>
12806TreeTransform<Derived>::TransformOpenACCWaitConstruct(OpenACCWaitConstruct *
C) {
12807 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12810 if (
C->hasDevNumExpr()) {
12811 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12813 if (DevNumExpr.isUsable())
12814 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12816 C->getBeginLoc(), DevNumExpr.get());
12821 for (Expr *QE :
C->getQueueIdExprs()) {
12822 assert(QE &&
"Null queue id expr?");
12823 ExprResult NewEQ = getDerived().TransformExpr(QE);
12825 if (!NewEQ.isUsable())
12829 C->getBeginLoc(), NewEQ.get());
12830 if (NewEQ.isUsable())
12831 QueueIdExprs.push_back(NewEQ.get());
12835 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12838 if (getSema().OpenACC().ActOnStartStmtDirective(
12839 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12842 return getDerived().RebuildOpenACCWaitConstruct(
12843 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12844 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12845 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12847template <
typename Derived>
12848StmtResult TreeTransform<Derived>::TransformOpenACCCacheConstruct(
12849 OpenACCCacheConstruct *
C) {
12850 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12853 for (Expr *Var :
C->getVarList()) {
12854 assert(Var &&
"Null var listexpr?");
12856 ExprResult NewVar = getDerived().TransformExpr(Var);
12858 if (!NewVar.isUsable())
12861 NewVar = getSema().OpenACC().ActOnVar(
12863 if (!NewVar.isUsable())
12866 TransformedVarList.push_back(NewVar.get());
12869 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12870 C->getBeginLoc(), {}))
12873 return getDerived().RebuildOpenACCCacheConstruct(
12874 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12875 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12879template <
typename Derived>
12880StmtResult TreeTransform<Derived>::TransformOpenACCAtomicConstruct(
12881 OpenACCAtomicConstruct *
C) {
12882 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12885 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12888 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12889 C->getBeginLoc(), {}))
12893 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12894 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12896 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12897 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12898 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12901 return getDerived().RebuildOpenACCAtomicConstruct(
12902 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12903 C->getEndLoc(), TransformedClauses, AssocStmt);
12906template <
typename Derived>
12907ExprResult TreeTransform<Derived>::TransformOpenACCAsteriskSizeExpr(
12908 OpenACCAsteriskSizeExpr *
E) {
12909 if (getDerived().AlwaysRebuild())
12910 return getDerived().RebuildOpenACCAsteriskSizeExpr(
E->getLocation());
12918template<
typename Derived>
12920TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *
E) {
12921 return TransformExpr(
E->getSubExpr());
12924template <
typename Derived>
12925ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
12926 SYCLUniqueStableNameExpr *
E) {
12930 TypeSourceInfo *NewT = getDerived().TransformType(
E->getTypeSourceInfo());
12935 if (!getDerived().AlwaysRebuild() &&
E->getTypeSourceInfo() == NewT)
12938 return getDerived().RebuildSYCLUniqueStableNameExpr(
12939 E->getLocation(),
E->getLParenLocation(),
E->getRParenLocation(), NewT);
12942template<
typename Derived>
12944TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *
E) {
12948 return getDerived().RebuildPredefinedExpr(
E->getLocation(),
12949 E->getIdentKind());
12952template<
typename Derived>
12954TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *
E) {
12955 NestedNameSpecifierLoc QualifierLoc;
12956 if (
E->getQualifierLoc()) {
12958 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
12964 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getLocation(),
12966 if (!ND || ND->isInvalidDecl())
12969 NamedDecl *
Found = ND;
12970 if (
E->getFoundDecl() !=
E->getDecl()) {
12971 Found = cast_or_null<NamedDecl>(
12972 getDerived().TransformDecl(
E->getLocation(),
E->getFoundDecl()));
12977 DeclarationNameInfo NameInfo =
E->getNameInfo();
12978 if (NameInfo.getName()) {
12979 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12980 if (!NameInfo.getName())
12984 if (!getDerived().AlwaysRebuild() &&
12985 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12986 QualifierLoc ==
E->getQualifierLoc() && ND ==
E->getDecl() &&
12987 Found ==
E->getFoundDecl() &&
12988 NameInfo.getName() ==
E->getDecl()->getDeclName() &&
12989 !
E->hasExplicitTemplateArgs()) {
12998 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
12999 if (
E->hasExplicitTemplateArgs()) {
13000 TemplateArgs = &TransArgs;
13001 TransArgs.setLAngleLoc(
E->getLAngleLoc());
13002 TransArgs.setRAngleLoc(
E->getRAngleLoc());
13003 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
13004 E->getNumTemplateArgs(),
13009 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13010 Found, TemplateArgs);
13013template<
typename Derived>
13015TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *
E) {
13019template <
typename Derived>
13020ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
13021 FixedPointLiteral *
E) {
13025template<
typename Derived>
13027TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *
E) {
13031template<
typename Derived>
13033TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *
E) {
13037template<
typename Derived>
13039TreeTransform<Derived>::TransformStringLiteral(StringLiteral *
E) {
13043template<
typename Derived>
13045TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *
E) {
13049template<
typename Derived>
13051TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *
E) {
13052 return getDerived().TransformCallExpr(
E);
13055template<
typename Derived>
13057TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *
E) {
13059 TypeSourceInfo *ControllingType =
nullptr;
13060 if (
E->isExprPredicate())
13061 ControllingExpr = getDerived().TransformExpr(
E->getControllingExpr());
13063 ControllingType = getDerived().TransformType(
E->getControllingType());
13065 if (ControllingExpr.isInvalid() && !ControllingType)
13071 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
13073 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
13076 AssocTypes.push_back(AssocType);
13078 AssocTypes.push_back(
nullptr);
13082 getDerived().TransformExpr(Assoc.getAssociationExpr());
13083 if (AssocExpr.isInvalid())
13085 AssocExprs.push_back(AssocExpr.get());
13088 if (!ControllingType)
13089 return getDerived().RebuildGenericSelectionExpr(
E->getGenericLoc(),
13090 E->getDefaultLoc(),
13092 ControllingExpr.get(),
13095 return getDerived().RebuildGenericSelectionExpr(
13096 E->getGenericLoc(),
E->getDefaultLoc(),
E->getRParenLoc(),
13097 ControllingType, AssocTypes, AssocExprs);
13100template<
typename Derived>
13102TreeTransform<Derived>::TransformParenExpr(ParenExpr *
E) {
13103 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
13104 if (SubExpr.isInvalid())
13107 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getSubExpr())
13110 return getDerived().RebuildParenExpr(SubExpr.get(),
E->getLParen(),
13117template<
typename Derived>
13121 return getDerived().TransformDependentScopeDeclRefExpr(
13122 DRE,
true,
nullptr);
13124 return getDerived().TransformUnresolvedLookupExpr(
13127 return getDerived().TransformExpr(
E);
13130template<
typename Derived>
13134 if (
E->getOpcode() == UO_AddrOf)
13135 SubExpr = TransformAddressOfOperand(
E->getSubExpr());
13137 SubExpr = TransformExpr(
E->getSubExpr());
13141 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getSubExpr())
13144 return getDerived().RebuildUnaryOperator(
E->getOperatorLoc(),
13149template<
typename Derived>
13151TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *
E) {
13153 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
13163 bool ExprChanged =
false;
13164 typedef Sema::OffsetOfComponent Component;
13166 for (
unsigned I = 0, N =
E->getNumComponents(); I != N; ++I) {
13167 const OffsetOfNode &ON =
E->getComponent(I);
13169 Comp.isBrackets =
true;
13170 Comp.LocStart = ON.getSourceRange().getBegin();
13171 Comp.LocEnd = ON.getSourceRange().getEnd();
13172 switch (ON.getKind()) {
13174 Expr *FromIndex =
E->getIndexExpr(ON.getArrayExprIndex());
13175 ExprResult Index = getDerived().TransformExpr(FromIndex);
13176 if (Index.isInvalid())
13179 ExprChanged = ExprChanged || Index.get() != FromIndex;
13180 Comp.isBrackets =
true;
13181 Comp.U.E = Index.get();
13187 Comp.isBrackets =
false;
13188 Comp.U.IdentInfo = ON.getFieldName();
13189 if (!
Comp.U.IdentInfo)
13199 Components.push_back(Comp);
13203 if (!getDerived().AlwaysRebuild() &&
13204 Type ==
E->getTypeSourceInfo() &&
13209 return getDerived().RebuildOffsetOfExpr(
E->getOperatorLoc(), Type,
13210 Components,
E->getRParenLoc());
13213template<
typename Derived>
13215TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *
E) {
13216 assert((!
E->getSourceExpr() || getDerived().AlreadyTransformed(
E->
getType())) &&
13217 "opaque value expression requires transformation");
13221template <
typename Derived>
13222ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *
E) {
13225 for (Expr *
C :
E->subExpressions()) {
13227 if (NewC.isInvalid())
13229 Children.push_back(NewC.get());
13233 if (!getDerived().AlwaysRebuild() && !Changed)
13239template<
typename Derived>
13241TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *
E) {
13249 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13250 if (result.isInvalid())
return ExprError();
13255 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13261template<
typename Derived>
13263TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
13264 UnaryExprOrTypeTraitExpr *
E) {
13265 if (
E->isArgumentType()) {
13266 TypeSourceInfo *OldT =
E->getArgumentTypeInfo();
13268 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
13272 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13275 return getDerived().RebuildUnaryExprOrTypeTrait(NewT,
E->getOperatorLoc(),
13289 TypeSourceInfo *RecoveryTSI =
nullptr;
13291 auto *PE = dyn_cast<ParenExpr>(
E->getArgumentExpr());
13293 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13294 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13295 PE, DRE,
false, &RecoveryTSI);
13297 SubExpr = getDerived().TransformExpr(
E->getArgumentExpr());
13300 return getDerived().RebuildUnaryExprOrTypeTrait(
13302 }
else if (SubExpr.isInvalid())
13305 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getArgumentExpr())
13308 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13309 E->getOperatorLoc(),
13314template<
typename Derived>
13316TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *
E) {
13317 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13318 if (LHS.isInvalid())
13321 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13322 if (RHS.isInvalid())
13326 if (!getDerived().AlwaysRebuild() &&
13327 LHS.get() ==
E->getLHS() &&
13328 RHS.get() ==
E->getRHS())
13331 return getDerived().RebuildArraySubscriptExpr(
13333 E->getLHS()->
getBeginLoc(), RHS.get(),
E->getRBracketLoc());
13336template <
typename Derived>
13338TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *
E) {
13340 if (
Base.isInvalid())
13343 ExprResult RowIdx = getDerived().TransformExpr(
E->getRowIdx());
13344 if (RowIdx.isInvalid())
13347 ExprResult ColumnIdx = getDerived().TransformExpr(
E->getColumnIdx());
13348 if (ColumnIdx.isInvalid())
13351 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
13352 RowIdx.get() ==
E->getRowIdx() && ColumnIdx.get() ==
E->getColumnIdx())
13355 return getDerived().RebuildMatrixSubscriptExpr(
13356 Base.get(), RowIdx.get(), ColumnIdx.get(),
E->getRBracketLoc());
13359template <
typename Derived>
13361TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *
E) {
13363 if (
Base.isInvalid())
13367 if (
E->getLowerBound()) {
13368 LowerBound = getDerived().TransformExpr(
E->getLowerBound());
13369 if (LowerBound.isInvalid())
13374 if (
E->getLength()) {
13375 Length = getDerived().TransformExpr(
E->getLength());
13376 if (Length.isInvalid())
13381 if (
E->isOMPArraySection()) {
13382 if (Expr *Str =
E->getStride()) {
13383 Stride = getDerived().TransformExpr(Str);
13384 if (Stride.isInvalid())
13389 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
13390 LowerBound.get() ==
E->getLowerBound() &&
13391 Length.get() ==
E->getLength() &&
13392 (
E->isOpenACCArraySection() || Stride.get() ==
E->getStride()))
13395 return getDerived().RebuildArraySectionExpr(
13397 LowerBound.get(),
E->getColonLocFirst(),
13398 E->isOMPArraySection() ?
E->getColonLocSecond() : SourceLocation{},
13399 Length.get(), Stride.get(),
E->getRBracketLoc());
13402template <
typename Derived>
13404TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *
E) {
13406 if (
Base.isInvalid())
13410 bool ErrorFound =
false;
13411 for (Expr *
Dim :
E->getDimensions()) {
13413 if (DimRes.isInvalid()) {
13417 Dims.push_back(DimRes.get());
13422 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(),
E->getLParenLoc(),
13423 E->getRParenLoc(), Dims,
13424 E->getBracketsRanges());
13427template <
typename Derived>
13429TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *
E) {
13430 unsigned NumIterators =
E->numOfIterators();
13433 bool ErrorFound =
false;
13434 bool NeedToRebuild = getDerived().AlwaysRebuild();
13435 for (
unsigned I = 0; I < NumIterators; ++I) {
13436 auto *
D = cast<VarDecl>(
E->getIteratorDecl(I));
13437 Data[I].DeclIdent =
D->getIdentifier();
13441 "Implicit type must be int.");
13443 TypeSourceInfo *TSI = getDerived().TransformType(
D->getTypeSourceInfo());
13444 QualType
DeclTy = getDerived().TransformType(
D->getType());
13447 OMPIteratorExpr::IteratorRange
Range =
E->getIteratorRange(I);
13451 ErrorFound = ErrorFound ||
13452 !(!
D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
13453 !
Data[I].Type.get().isNull())) ||
13458 Data[I].Range.End = End.get();
13459 Data[I].Range.Step = Step.get();
13460 Data[I].AssignLoc =
E->getAssignLoc(I);
13461 Data[I].ColonLoc =
E->getColonLoc(I);
13462 Data[I].SecColonLoc =
E->getSecondColonLoc(I);
13465 (
D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
13466 D->getType().getTypePtrOrNull()) ||
13472 if (!NeedToRebuild)
13475 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13476 E->getIteratorKwLoc(),
E->getLParenLoc(),
E->getRParenLoc(),
Data);
13477 if (!Res.isUsable())
13479 auto *IE = cast<OMPIteratorExpr>(Res.get());
13480 for (
unsigned I = 0; I < NumIterators; ++I)
13481 getDerived().transformedLocalDecl(
E->getIteratorDecl(I),
13482 IE->getIteratorDecl(I));
13486template<
typename Derived>
13488TreeTransform<Derived>::TransformCallExpr(CallExpr *
E) {
13495 bool ArgChanged =
false;
13497 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13501 if (!getDerived().AlwaysRebuild() &&
13502 Callee.get() ==
E->getCallee() &&
13507 SourceLocation FakeLParenLoc
13510 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13511 if (
E->hasStoredFPFeatures()) {
13512 FPOptionsOverride NewOverrides =
E->getFPFeatures();
13513 getSema().CurFPFeatures =
13514 NewOverrides.applyOverrides(getSema().getLangOpts());
13515 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13518 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13520 E->getRParenLoc());
13523template<
typename Derived>
13525TreeTransform<Derived>::TransformMemberExpr(MemberExpr *
E) {
13527 if (
Base.isInvalid())
13530 NestedNameSpecifierLoc QualifierLoc;
13531 if (
E->hasQualifier()) {
13533 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
13538 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
13541 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getMemberLoc(),
13542 E->getMemberDecl()));
13546 NamedDecl *FoundDecl =
E->getFoundDecl();
13547 if (FoundDecl ==
E->getMemberDecl()) {
13550 FoundDecl = cast_or_null<NamedDecl>(
13551 getDerived().TransformDecl(
E->getMemberLoc(), FoundDecl));
13556 if (!getDerived().AlwaysRebuild() &&
13557 Base.get() ==
E->getBase() &&
13558 QualifierLoc ==
E->getQualifierLoc() &&
13559 Member ==
E->getMemberDecl() &&
13560 FoundDecl ==
E->getFoundDecl() &&
13561 !
E->hasExplicitTemplateArgs()) {
13565 if (!(isa<CXXThisExpr>(
E->getBase()) &&
13566 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13567 cast<ValueDecl>(
Member)))) {
13575 TemplateArgumentListInfo TransArgs;
13576 if (
E->hasExplicitTemplateArgs()) {
13577 TransArgs.setLAngleLoc(
E->getLAngleLoc());
13578 TransArgs.setRAngleLoc(
E->getRAngleLoc());
13579 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
13580 E->getNumTemplateArgs(),
13586 SourceLocation FakeOperatorLoc =
13593 NamedDecl *FirstQualifierInScope =
nullptr;
13594 DeclarationNameInfo MemberNameInfo =
E->getMemberNameInfo();
13595 if (MemberNameInfo.getName()) {
13596 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13597 if (!MemberNameInfo.getName())
13601 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13608 (
E->hasExplicitTemplateArgs()
13609 ? &TransArgs :
nullptr),
13610 FirstQualifierInScope);
13613template<
typename Derived>
13615TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *
E) {
13616 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13617 if (LHS.isInvalid())
13621 getDerived().TransformInitializer(
E->getRHS(),
false);
13622 if (RHS.isInvalid())
13625 if (!getDerived().AlwaysRebuild() &&
13626 LHS.get() ==
E->getLHS() &&
13627 RHS.get() ==
E->getRHS())
13630 if (
E->isCompoundAssignmentOp())
13632 return getDerived().RebuildBinaryOperator(
13633 E->getOperatorLoc(),
E->getOpcode(), LHS.get(), RHS.get());
13634 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13635 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13636 getSema().CurFPFeatures =
13637 NewOverrides.applyOverrides(getSema().getLangOpts());
13638 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13639 return getDerived().RebuildBinaryOperator(
E->getOperatorLoc(),
E->getOpcode(),
13640 LHS.get(), RHS.get());
13643template <
typename Derived>
13644ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
13645 CXXRewrittenBinaryOperator *
E) {
13646 CXXRewrittenBinaryOperator::DecomposedForm Decomp =
E->getDecomposedForm();
13648 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13649 if (LHS.isInvalid())
13652 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13653 if (RHS.isInvalid())
13658 UnresolvedSet<2> UnqualLookups;
13659 bool ChangedAnyLookups =
false;
13660 Expr *PossibleBinOps[] = {
E->getSemanticForm(),
13661 const_cast<Expr *
>(Decomp.InnerBinOp)};
13662 for (Expr *PossibleBinOp : PossibleBinOps) {
13663 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13666 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13667 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
13672 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13673 E->getOperatorLoc(),
Callee->getFoundDecl()));
13677 ChangedAnyLookups =
true;
13678 UnqualLookups.addDecl(
Found);
13681 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13682 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13688 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13693 return getDerived().RebuildCXXRewrittenBinaryOperator(
13694 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13697template<
typename Derived>
13699TreeTransform<Derived>::TransformCompoundAssignOperator(
13700 CompoundAssignOperator *
E) {
13701 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13702 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13703 getSema().CurFPFeatures =
13704 NewOverrides.applyOverrides(getSema().getLangOpts());
13705 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13706 return getDerived().TransformBinaryOperator(
E);
13709template<
typename Derived>
13711TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
13715 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13716 if (commonExpr.isInvalid())
13719 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13720 if (rhs.isInvalid())
13723 if (!getDerived().AlwaysRebuild() &&
13724 commonExpr.get() == e->getCommon() &&
13725 rhs.get() == e->getFalseExpr())
13728 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13729 e->getQuestionLoc(),
13735template<
typename Derived>
13737TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *
E) {
13738 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13739 if (Cond.isInvalid())
13742 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13743 if (LHS.isInvalid())
13746 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13747 if (RHS.isInvalid())
13750 if (!getDerived().AlwaysRebuild() &&
13751 Cond.get() ==
E->getCond() &&
13752 LHS.get() ==
E->getLHS() &&
13753 RHS.get() ==
E->getRHS())
13756 return getDerived().RebuildConditionalOperator(Cond.get(),
13757 E->getQuestionLoc(),
13763template<
typename Derived>
13765TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *
E) {
13768 return getDerived().TransformExpr(
E->getSubExprAsWritten());
13771template<
typename Derived>
13773TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *
E) {
13774 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeInfoAsWritten());
13779 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13780 if (SubExpr.isInvalid())
13783 if (!getDerived().AlwaysRebuild() &&
13784 Type ==
E->getTypeInfoAsWritten() &&
13785 SubExpr.get() ==
E->getSubExpr())
13788 return getDerived().RebuildCStyleCastExpr(
E->getLParenLoc(),
13794template<
typename Derived>
13796TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *
E) {
13797 TypeSourceInfo *OldT =
E->getTypeSourceInfo();
13798 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
13803 if (
Init.isInvalid())
13806 if (!getDerived().AlwaysRebuild() &&
13808 Init.get() ==
E->getInitializer())
13815 return getDerived().RebuildCompoundLiteralExpr(
13816 E->getLParenLoc(), NewT,
13820template<
typename Derived>
13822TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *
E) {
13824 if (
Base.isInvalid())
13827 if (!getDerived().AlwaysRebuild() &&
13828 Base.get() ==
E->getBase())
13832 SourceLocation FakeOperatorLoc =
13834 return getDerived().RebuildExtVectorElementExpr(
13835 Base.get(), FakeOperatorLoc,
E->isArrow(),
E->getAccessorLoc(),
13839template<
typename Derived>
13841TreeTransform<Derived>::TransformInitListExpr(InitListExpr *
E) {
13842 if (InitListExpr *Syntactic =
E->getSyntacticForm())
13845 bool InitChanged =
false;
13847 EnterExpressionEvaluationContext Context(
13851 if (getDerived().TransformExprs(
E->getInits(),
E->getNumInits(),
false,
13852 Inits, &InitChanged))
13855 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13862 return getDerived().RebuildInitList(
E->getLBraceLoc(), Inits,
13863 E->getRBraceLoc());
13866template<
typename Derived>
13868TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *
E) {
13873 if (
Init.isInvalid())
13878 bool ExprChanged =
false;
13879 for (
const DesignatedInitExpr::Designator &
D :
E->designators()) {
13880 if (
D.isFieldDesignator()) {
13881 if (
D.getFieldDecl()) {
13882 FieldDecl *
Field = cast_or_null<FieldDecl>(
13883 getDerived().TransformDecl(
D.getFieldLoc(),
D.getFieldDecl()));
13884 if (Field !=
D.getFieldDecl())
13887 ExprChanged =
true;
13888 if (
Field->isAnonymousStructOrUnion())
13894 ExprChanged =
true;
13897 D.getFieldName(),
D.getDotLoc(),
D.getFieldLoc()));
13901 if (
D.isArrayDesignator()) {
13902 ExprResult Index = getDerived().TransformExpr(
E->getArrayIndex(
D));
13903 if (Index.isInvalid())
13906 Desig.AddDesignator(
13909 ExprChanged = ExprChanged || Index.get() !=
E->getArrayIndex(
D);
13910 ArrayExprs.push_back(Index.get());
13914 assert(
D.isArrayRangeDesignator() &&
"New kind of designator?");
13916 = getDerived().TransformExpr(
E->getArrayRangeStart(
D));
13917 if (Start.isInvalid())
13920 ExprResult End = getDerived().TransformExpr(
E->getArrayRangeEnd(
D));
13921 if (End.isInvalid())
13925 Start.get(), End.get(),
D.getLBracketLoc(),
D.getEllipsisLoc()));
13927 ExprChanged = ExprChanged || Start.get() !=
E->getArrayRangeStart(
D) ||
13928 End.get() !=
E->getArrayRangeEnd(
D);
13930 ArrayExprs.push_back(Start.get());
13931 ArrayExprs.push_back(End.get());
13934 if (!getDerived().AlwaysRebuild() &&
13935 Init.get() ==
E->getInit() &&
13939 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13940 E->getEqualOrColonLoc(),
13941 E->usesGNUSyntax(),
Init.get());
13946template<
typename Derived>
13948TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
13949 DesignatedInitUpdateExpr *
E) {
13950 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13955template<
typename Derived>
13957TreeTransform<Derived>::TransformNoInitExpr(
13959 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13963template<
typename Derived>
13965TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *
E) {
13966 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13970template<
typename Derived>
13972TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *
E) {
13973 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13977template<
typename Derived>
13979TreeTransform<Derived>::TransformImplicitValueInitExpr(
13980 ImplicitValueInitExpr *
E) {
13981 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
13985 QualType
T = getDerived().TransformType(
E->
getType());
13989 if (!getDerived().AlwaysRebuild() &&
13993 return getDerived().RebuildImplicitValueInitExpr(
T);
13996template<
typename Derived>
13998TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *
E) {
13999 TypeSourceInfo *TInfo = getDerived().TransformType(
E->getWrittenTypeInfo());
14003 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
14004 if (SubExpr.isInvalid())
14007 if (!getDerived().AlwaysRebuild() &&
14008 TInfo ==
E->getWrittenTypeInfo() &&
14009 SubExpr.get() ==
E->getSubExpr())
14012 return getDerived().RebuildVAArgExpr(
E->getBuiltinLoc(), SubExpr.get(),
14013 TInfo,
E->getRParenLoc());
14016template<
typename Derived>
14018TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *
E) {
14019 bool ArgumentChanged =
false;
14021 if (TransformExprs(
E->getExprs(),
E->getNumExprs(),
true, Inits,
14025 return getDerived().RebuildParenListExpr(
E->getLParenLoc(),
14027 E->getRParenLoc());
14035template<
typename Derived>
14037TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *
E) {
14038 Decl *LD = getDerived().TransformDecl(
E->getLabel()->getLocation(),
14043 return getDerived().RebuildAddrLabelExpr(
E->getAmpAmpLoc(),
E->getLabelLoc(),
14044 cast<LabelDecl>(LD));
14047template<
typename Derived>
14049TreeTransform<Derived>::TransformStmtExpr(StmtExpr *
E) {
14052 = getDerived().TransformCompoundStmt(
E->getSubStmt(),
true);
14053 if (SubStmt.isInvalid()) {
14058 unsigned OldDepth =
E->getTemplateDepth();
14059 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14061 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14062 SubStmt.get() ==
E->getSubStmt()) {
14068 return getDerived().RebuildStmtExpr(
E->getLParenLoc(), SubStmt.get(),
14069 E->getRParenLoc(), NewDepth);
14072template<
typename Derived>
14074TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *
E) {
14075 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
14076 if (Cond.isInvalid())
14079 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
14080 if (LHS.isInvalid())
14083 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
14084 if (RHS.isInvalid())
14087 if (!getDerived().AlwaysRebuild() &&
14088 Cond.get() ==
E->getCond() &&
14089 LHS.get() ==
E->getLHS() &&
14090 RHS.get() ==
E->getRHS())
14093 return getDerived().RebuildChooseExpr(
E->getBuiltinLoc(),
14094 Cond.get(), LHS.get(), RHS.get(),
14095 E->getRParenLoc());
14098template<
typename Derived>
14100TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *
E) {
14104template<
typename Derived>
14106TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *
E) {
14107 switch (
E->getOperator()) {
14111 case OO_Array_Delete:
14112 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14117 assert(
E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14128 SourceLocation EndLoc =
static_cast<Expr *
>(
Object.get())->getEndLoc();
14130 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14131 FakeLParenLoc = EndLoc;
14135 if (getDerived().TransformExprs(
E->getArgs() + 1,
E->getNumArgs() - 1,
true,
14139 if (
E->getOperator() == OO_Subscript)
14140 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14143 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14147#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14151#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14152#include "clang/Basic/OperatorKinds.def"
14154 case OO_Conditional:
14155 llvm_unreachable(
"conditional operator is not actually overloadable");
14159 llvm_unreachable(
"not an overloaded operator?");
14163 if (
E->getNumArgs() == 1 &&
E->getOperator() == OO_Amp)
14164 First = getDerived().TransformAddressOfOperand(
E->getArg(0));
14166 First = getDerived().TransformExpr(
E->getArg(0));
14167 if (
First.isInvalid())
14171 if (
E->getNumArgs() == 2) {
14173 getDerived().TransformInitializer(
E->getArg(1),
false);
14174 if (Second.isInvalid())
14178 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
14179 FPOptionsOverride NewOverrides(
E->getFPFeatures());
14180 getSema().CurFPFeatures =
14181 NewOverrides.applyOverrides(getSema().getLangOpts());
14182 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14184 Expr *
Callee =
E->getCallee();
14185 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
14186 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14188 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14191 return getDerived().RebuildCXXOperatorCallExpr(
14192 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
14193 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14196 UnresolvedSet<1> Functions;
14197 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
14198 Callee = ICE->getSubExprAsWritten();
14199 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
14200 ValueDecl *VD = cast_or_null<ValueDecl>(
14201 getDerived().TransformDecl(DR->getLocation(), DR));
14205 if (!isa<CXXMethodDecl>(VD))
14206 Functions.addDecl(VD);
14208 return getDerived().RebuildCXXOperatorCallExpr(
14209 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
14210 false, Functions,
First.get(), Second.get());
14213template<
typename Derived>
14215TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *
E) {
14216 return getDerived().TransformCallExpr(
E);
14219template <
typename Derived>
14220ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *
E) {
14222 getSema().CurContext !=
E->getParentContext();
14224 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14227 return getDerived().RebuildSourceLocExpr(
E->getIdentKind(),
E->
getType(),
14229 getSema().CurContext);
14232template <
typename Derived>
14233ExprResult TreeTransform<Derived>::TransformEmbedExpr(EmbedExpr *
E) {
14237template<
typename Derived>
14239TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *
E) {
14246 ExprResult EC = getDerived().TransformCallExpr(
E->getConfig());
14247 if (EC.isInvalid())
14251 bool ArgChanged =
false;
14253 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14257 if (!getDerived().AlwaysRebuild() &&
14258 Callee.get() ==
E->getCallee() &&
14263 SourceLocation FakeLParenLoc
14265 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14267 E->getRParenLoc(), EC.get());
14270template<
typename Derived>
14278 = getDerived().TransformExpr(
E->getSubExprAsWritten());
14282 if (!getDerived().AlwaysRebuild() &&
14283 Type ==
E->getTypeInfoAsWritten() &&
14284 SubExpr.
get() ==
E->getSubExpr())
14286 return getDerived().RebuildCXXNamedCastExpr(
14287 E->getOperatorLoc(),
E->
getStmtClass(),
E->getAngleBrackets().getBegin(),
14288 Type,
E->getAngleBrackets().getEnd(),
14290 E->getAngleBrackets().getEnd(), SubExpr.
get(),
E->getRParenLoc());
14293template<
typename Derived>
14302 if (Sub.isInvalid())
14305 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14309template<
typename Derived>
14311TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *
E) {
14312 return getDerived().TransformCXXNamedCastExpr(
E);
14315template<
typename Derived>
14317TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *
E) {
14318 return getDerived().TransformCXXNamedCastExpr(
E);
14321template<
typename Derived>
14323TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
14324 CXXReinterpretCastExpr *
E) {
14325 return getDerived().TransformCXXNamedCastExpr(
E);
14328template<
typename Derived>
14330TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *
E) {
14331 return getDerived().TransformCXXNamedCastExpr(
E);
14334template<
typename Derived>
14336TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *
E) {
14337 return getDerived().TransformCXXNamedCastExpr(
E);
14340template<
typename Derived>
14342TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
14343 CXXFunctionalCastExpr *
E) {
14344 TypeSourceInfo *
Type =
14345 getDerived().TransformTypeWithDeducedTST(
E->getTypeInfoAsWritten());
14350 = getDerived().TransformExpr(
E->getSubExprAsWritten());
14351 if (SubExpr.isInvalid())
14354 if (!getDerived().AlwaysRebuild() &&
14355 Type ==
E->getTypeInfoAsWritten() &&
14356 SubExpr.get() ==
E->getSubExpr())
14359 return getDerived().RebuildCXXFunctionalCastExpr(Type,
14363 E->isListInitialization());
14366template<
typename Derived>
14368TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *
E) {
14369 if (
E->isTypeOperand()) {
14370 TypeSourceInfo *TInfo
14371 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
14375 if (!getDerived().AlwaysRebuild() &&
14376 TInfo ==
E->getTypeOperandSourceInfo())
14386 Expr *Op =
E->getExprOperand();
14389 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14390 RD && RD->isPolymorphic())
14393 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
14396 ExprResult SubExpr = getDerived().TransformExpr(Op);
14397 if (SubExpr.isInvalid())
14400 if (!getDerived().AlwaysRebuild() &&
14401 SubExpr.get() ==
E->getExprOperand())
14408template<
typename Derived>
14410TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *
E) {
14411 if (
E->isTypeOperand()) {
14412 TypeSourceInfo *TInfo
14413 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
14417 if (!getDerived().AlwaysRebuild() &&
14418 TInfo ==
E->getTypeOperandSourceInfo())
14428 ExprResult SubExpr = getDerived().TransformExpr(
E->getExprOperand());
14429 if (SubExpr.isInvalid())
14432 if (!getDerived().AlwaysRebuild() &&
14433 SubExpr.get() ==
E->getExprOperand())
14440template<
typename Derived>
14442TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *
E) {
14446template<
typename Derived>
14448TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
14449 CXXNullPtrLiteralExpr *
E) {
14453template<
typename Derived>
14455TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *
E) {
14468 QualType
T = [&]() {
14469 auto &S = getSema();
14470 if (
E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14473 return getDerived().TransformType(
E->
getType());
14477 if (!getDerived().AlwaysRebuild() &&
T ==
E->
getType() &&
14478 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14481 getSema().MarkThisReferenced(
E);
14485 return getDerived().RebuildCXXThisExpr(
E->
getBeginLoc(),
T,
E->isImplicit());
14488template<
typename Derived>
14490TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *
E) {
14491 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
14492 if (SubExpr.isInvalid())
14495 getSema().DiagnoseExceptionUse(
E->getThrowLoc(),
false);
14497 if (!getDerived().AlwaysRebuild() &&
14498 SubExpr.get() ==
E->getSubExpr())
14501 return getDerived().RebuildCXXThrowExpr(
E->getThrowLoc(), SubExpr.get(),
14502 E->isThrownVariableInScope());
14505template<
typename Derived>
14507TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *
E) {
14508 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
14509 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getParam()));
14514 if (
E->hasRewrittenInit()) {
14515 InitRes = getDerived().TransformExpr(
E->getRewrittenExpr());
14516 if (InitRes.isInvalid())
14520 if (!getDerived().AlwaysRebuild() && Param ==
E->getParam() &&
14522 InitRes.get() ==
E->getRewrittenExpr())
14525 return getDerived().RebuildCXXDefaultArgExpr(
E->getUsedLocation(), Param,
14529template<
typename Derived>
14531TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *
E) {
14532 FieldDecl *
Field = cast_or_null<FieldDecl>(
14533 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getField()));
14537 if (!getDerived().AlwaysRebuild() && Field ==
E->getField() &&
14541 return getDerived().RebuildCXXDefaultInitExpr(
E->
getExprLoc(), Field);
14544template<
typename Derived>
14546TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
14547 CXXScalarValueInitExpr *
E) {
14548 TypeSourceInfo *
T = getDerived().TransformType(
E->getTypeSourceInfo());
14552 if (!getDerived().AlwaysRebuild() &&
14553 T ==
E->getTypeSourceInfo())
14556 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14557 T->getTypeLoc().getEndLoc(),
14558 E->getRParenLoc());
14561template<
typename Derived>
14563TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *
E) {
14565 TypeSourceInfo *AllocTypeInfo =
14566 getDerived().TransformTypeWithDeducedTST(
E->getAllocatedTypeSourceInfo());
14567 if (!AllocTypeInfo)
14571 std::optional<Expr *> ArraySize;
14572 if (
E->isArray()) {
14574 if (std::optional<Expr *> OldArraySize =
E->getArraySize()) {
14575 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14576 if (NewArraySize.isInvalid())
14579 ArraySize = NewArraySize.get();
14583 bool ArgumentChanged =
false;
14585 if (getDerived().TransformExprs(
E->getPlacementArgs(),
14586 E->getNumPlacementArgs(),
true,
14587 PlacementArgs, &ArgumentChanged))
14591 Expr *OldInit =
E->getInitializer();
14594 NewInit = getDerived().TransformInitializer(OldInit,
true);
14595 if (NewInit.isInvalid())
14599 FunctionDecl *OperatorNew =
nullptr;
14600 if (
E->getOperatorNew()) {
14601 OperatorNew = cast_or_null<FunctionDecl>(
14602 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorNew()));
14607 FunctionDecl *OperatorDelete =
nullptr;
14608 if (
E->getOperatorDelete()) {
14609 OperatorDelete = cast_or_null<FunctionDecl>(
14610 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14611 if (!OperatorDelete)
14615 if (!getDerived().AlwaysRebuild() &&
14616 AllocTypeInfo ==
E->getAllocatedTypeSourceInfo() &&
14617 ArraySize ==
E->getArraySize() &&
14618 NewInit.get() == OldInit &&
14619 OperatorNew ==
E->getOperatorNew() &&
14620 OperatorDelete ==
E->getOperatorDelete() &&
14621 !ArgumentChanged) {
14626 if (OperatorDelete)
14629 if (
E->isArray() && !
E->getAllocatedType()->isDependentType()) {
14630 QualType ElementType
14632 if (CXXRecordDecl *
Record = ElementType->getAsCXXRecordDecl()) {
14641 QualType AllocType = AllocTypeInfo->
getType();
14651 }
else if (
const ConstantArrayType *ConsArrayT
14652 = dyn_cast<ConstantArrayType>(ArrayT)) {
14656 AllocType = ConsArrayT->getElementType();
14657 }
else if (
const DependentSizedArrayType *DepArrayT
14658 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14659 if (DepArrayT->getSizeExpr()) {
14660 ArraySize = DepArrayT->getSizeExpr();
14661 AllocType = DepArrayT->getElementType();
14666 return getDerived().RebuildCXXNewExpr(
14670 AllocTypeInfo, ArraySize,
E->getDirectInitRange(), NewInit.get());
14673template<
typename Derived>
14675TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *
E) {
14681 FunctionDecl *OperatorDelete =
nullptr;
14682 if (
E->getOperatorDelete()) {
14683 OperatorDelete = cast_or_null<FunctionDecl>(
14684 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14685 if (!OperatorDelete)
14689 if (!getDerived().AlwaysRebuild() &&
14690 Operand.get() ==
E->getArgument() &&
14691 OperatorDelete ==
E->getOperatorDelete()) {
14694 if (OperatorDelete)
14699 E->getDestroyedType());
14700 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14708 return getDerived().RebuildCXXDeleteExpr(
14712template<
typename Derived>
14714TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
14715 CXXPseudoDestructorExpr *
E) {
14717 if (
Base.isInvalid())
14721 bool MayBePseudoDestructor =
false;
14723 E->getOperatorLoc(),
14724 E->isArrow()? tok::arrow : tok::period,
14726 MayBePseudoDestructor);
14727 if (
Base.isInvalid())
14730 QualType ObjectType = ObjectTypePtr.get();
14731 NestedNameSpecifierLoc QualifierLoc =
E->getQualifierLoc();
14732 if (QualifierLoc) {
14734 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14739 SS.Adopt(QualifierLoc);
14741 PseudoDestructorTypeStorage Destroyed;
14742 if (
E->getDestroyedTypeInfo()) {
14743 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14744 E->getDestroyedTypeInfo(), ObjectType,
14746 if (!DestroyedTypeInfo)
14748 Destroyed = DestroyedTypeInfo;
14749 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14752 Destroyed = PseudoDestructorTypeStorage(
E->getDestroyedTypeIdentifier(),
14753 E->getDestroyedTypeLoc());
14757 *
E->getDestroyedTypeIdentifier(),
E->getDestroyedTypeLoc(),
14758 nullptr, SS, ObjectTypePtr,
false);
14764 E->getDestroyedTypeLoc());
14767 TypeSourceInfo *ScopeTypeInfo =
nullptr;
14768 if (
E->getScopeTypeInfo()) {
14769 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14770 E->getScopeTypeInfo(), ObjectType,
nullptr);
14771 if (!ScopeTypeInfo)
14775 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14776 E->getOperatorLoc(),
14780 E->getColonColonLoc(),
14785template <
typename Derived>
14790 bool AllEmptyPacks =
true;
14791 for (
auto *OldD : Old->
decls()) {
14792 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
14796 if (isa<UsingShadowDecl>(OldD))
14805 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
14807 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14808 Decls = UPD->expansions();
14811 for (
auto *
D : Decls) {
14812 if (
auto *UD = dyn_cast<UsingDecl>(
D)) {
14813 for (
auto *SD : UD->shadows())
14820 AllEmptyPacks &= Decls.empty();
14829 if (AllEmptyPacks && !RequiresADL) {
14830 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
14831 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
14841 getSema().FilterAcceptableTemplateNames(R,
14848 diag::err_template_kw_refers_to_non_template)
14852 diag::note_template_kw_refers_to_non_template)
14861template <
typename Derived>
14864 return TransformUnresolvedLookupExpr(Old,
false);
14867template <
typename Derived>
14870 bool IsAddressOfOperand) {
14875 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14882 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14886 SS.
Adopt(QualifierLoc);
14890 CXXRecordDecl *NamingClass
14891 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14894 if (!NamingClass) {
14899 R.setNamingClass(NamingClass);
14920 SS, TemplateKWLoc, R,
14927 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14930 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14934template<
typename Derived>
14936TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *
E) {
14937 bool ArgChanged =
false;
14939 for (
unsigned I = 0, N =
E->getNumArgs(); I != N; ++I) {
14940 TypeSourceInfo *From =
E->getArg(I);
14941 TypeLoc FromTL = From->getTypeLoc();
14942 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
14943 TypeLocBuilder TLB;
14944 TLB.reserve(FromTL.getFullDataSize());
14945 QualType To = getDerived().TransformType(TLB, FromTL);
14949 if (To == From->getType())
14950 Args.push_back(From);
14952 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14961 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
14962 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14968 bool Expand =
true;
14969 bool RetainExpansion =
false;
14970 UnsignedOrNone OrigNumExpansions =
14971 ExpansionTL.getTypePtr()->getNumExpansions();
14972 UnsignedOrNone NumExpansions = OrigNumExpansions;
14973 if (getDerived().TryExpandParameterPacks(
14974 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
14975 Unexpanded,
true, Expand,
14976 RetainExpansion, NumExpansions))
14983 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
14985 TypeLocBuilder TLB;
14986 TLB.reserve(From->getTypeLoc().getFullDataSize());
14988 QualType To = getDerived().TransformType(TLB, PatternTL);
14992 To = getDerived().RebuildPackExpansionType(To,
14993 PatternTL.getSourceRange(),
14994 ExpansionTL.getEllipsisLoc(),
14999 PackExpansionTypeLoc ToExpansionTL
15000 = TLB.push<PackExpansionTypeLoc>(To);
15001 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
15002 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15008 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15009 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, I);
15010 TypeLocBuilder TLB;
15011 TLB.reserve(PatternTL.getFullDataSize());
15012 QualType To = getDerived().TransformType(TLB, PatternTL);
15016 if (To->containsUnexpandedParameterPack()) {
15017 To = getDerived().RebuildPackExpansionType(To,
15018 PatternTL.getSourceRange(),
15019 ExpansionTL.getEllipsisLoc(),
15024 PackExpansionTypeLoc ToExpansionTL
15025 = TLB.push<PackExpansionTypeLoc>(To);
15026 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
15029 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15032 if (!RetainExpansion)
15037 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15039 TypeLocBuilder TLB;
15040 TLB.reserve(From->getTypeLoc().getFullDataSize());
15042 QualType To = getDerived().TransformType(TLB, PatternTL);
15046 To = getDerived().RebuildPackExpansionType(To,
15047 PatternTL.getSourceRange(),
15048 ExpansionTL.getEllipsisLoc(),
15053 PackExpansionTypeLoc ToExpansionTL
15054 = TLB.push<PackExpansionTypeLoc>(To);
15055 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
15056 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15059 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15062 return getDerived().RebuildTypeTrait(
E->getTrait(),
E->
getBeginLoc(), Args,
15066template<
typename Derived>
15068TreeTransform<Derived>::TransformConceptSpecializationExpr(
15069 ConceptSpecializationExpr *
E) {
15070 const ASTTemplateArgumentListInfo *Old =
E->getTemplateArgsAsWritten();
15071 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
15072 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15073 Old->NumTemplateArgs, TransArgs))
15076 return getDerived().RebuildConceptSpecializationExpr(
15077 E->getNestedNameSpecifierLoc(),
E->getTemplateKWLoc(),
15078 E->getConceptNameInfo(),
E->getFoundDecl(),
E->getNamedConcept(),
15082template<
typename Derived>
15084TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *
E) {
15087 Sema::ExtParameterInfoBuilder ExtParamInfos;
15091 EnterExpressionEvaluationContext Ctx(
15096 getSema().Context, getSema().CurContext,
15099 Sema::ContextRAII SavedContext(getSema(), Body,
false);
15101 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15102 E->getRequiresKWLoc(),
E->getRBraceLoc(),
E, Body,
15103 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15105 for (ParmVarDecl *Param : TransParams)
15107 Param->setDeclContext(Body);
15113 if (!TypeParamResult.isUnset())
15114 return TypeParamResult;
15117 if (getDerived().TransformRequiresExprRequirements(
E->getRequirements(),
15121 for (concepts::Requirement *Req : TransReqs) {
15122 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15123 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15124 ER->getReturnTypeRequirement()
15125 .getTypeConstraintTemplateParameterList()->getParam(0)
15126 ->setDeclContext(Body);
15131 return getDerived().RebuildRequiresExpr(
15132 E->getRequiresKWLoc(), Body,
E->getLParenLoc(), TransParams,
15133 E->getRParenLoc(), TransReqs,
E->getRBraceLoc());
15136template<
typename Derived>
15142 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15143 TransReq = getDerived().TransformTypeRequirement(TypeReq);
15144 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15145 TransReq = getDerived().TransformExprRequirement(ExprReq);
15147 TransReq = getDerived().TransformNestedRequirement(
15148 cast<concepts::NestedRequirement>(Req));
15151 Transformed.push_back(TransReq);
15156template<
typename Derived>
15161 if (getDerived().AlwaysRebuild())
15162 return getDerived().RebuildTypeRequirement(
15169 return getDerived().RebuildTypeRequirement(TransType);
15172template<
typename Derived>
15175 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15184 TransExpr = TransExprRes.
get();
15187 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15189 if (RetReq.isEmpty())
15190 TransRetReq.emplace();
15191 else if (RetReq.isSubstitutionFailure())
15192 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15193 else if (RetReq.isTypeConstraint()) {
15195 RetReq.getTypeConstraintTemplateParameterList();
15197 getDerived().TransformTemplateParameterList(OrigTPL);
15200 TransRetReq.emplace(TPL);
15202 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15203 if (
Expr *
E = dyn_cast<Expr *>(TransExpr))
15204 return getDerived().RebuildExprRequirement(
E, Req->
isSimple(),
15206 std::move(*TransRetReq));
15207 return getDerived().RebuildExprRequirement(
15208 cast<concepts::Requirement::SubstitutionDiagnostic *>(TransExpr),
15212template<
typename Derived>
15217 if (getDerived().AlwaysRebuild())
15218 return getDerived().RebuildNestedRequirement(
15226 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15229template<
typename Derived>
15232 TypeSourceInfo *
T = getDerived().TransformType(
E->getQueriedTypeSourceInfo());
15236 if (!getDerived().AlwaysRebuild() &&
15237 T ==
E->getQueriedTypeSourceInfo())
15244 SubExpr = getDerived().TransformExpr(
E->getDimensionExpression());
15249 return getDerived().RebuildArrayTypeTrait(
E->getTrait(),
E->
getBeginLoc(),
T,
15253template<
typename Derived>
15255TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *
E) {
15260 SubExpr = getDerived().TransformExpr(
E->getQueriedExpression());
15261 if (SubExpr.isInvalid())
15264 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getQueriedExpression())
15268 return getDerived().RebuildExpressionTrait(
E->getTrait(),
E->
getBeginLoc(),
15272template <
typename Derived>
15276 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
15277 DRE, AddrTaken, RecoveryTSI);
15284 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
15286 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
15290template <
typename Derived>
15293 return TransformDependentScopeDeclRefExpr(
E,
false,
15297template <
typename Derived>
15301 assert(
E->getQualifierLoc());
15303 getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
15313 getDerived().TransformDeclarationNameInfo(
E->getNameInfo());
15317 if (!
E->hasExplicitTemplateArgs()) {
15318 if (!getDerived().AlwaysRebuild() && QualifierLoc ==
E->getQualifierLoc() &&
15321 NameInfo.
getName() ==
E->getDeclName())
15324 return getDerived().RebuildDependentScopeDeclRefExpr(
15325 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15326 IsAddressOfOperand, RecoveryTSI);
15329 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15330 if (getDerived().TransformTemplateArguments(
15331 E->getTemplateArgs(),
E->getNumTemplateArgs(), TransArgs))
15334 return getDerived().RebuildDependentScopeDeclRefExpr(
15335 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15339template<
typename Derived>
15341TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *
E) {
15345 if (getDerived().AllowSkippingCXXConstructExpr() &&
15346 ((
E->getNumArgs() == 1 ||
15347 (
E->getNumArgs() > 1 && getDerived().DropCallArgument(
E->getArg(1)))) &&
15348 (!getDerived().DropCallArgument(
E->getArg(0))) &&
15349 !
E->isListInitialization()))
15350 return getDerived().TransformInitializer(
E->getArg(0),
15353 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
15355 QualType
T = getDerived().TransformType(
E->
getType());
15359 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15360 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15364 bool ArgumentChanged =
false;
15367 EnterExpressionEvaluationContext Context(
15369 E->isListInitialization());
15370 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15375 if (!getDerived().AlwaysRebuild() &&
15378 !ArgumentChanged) {
15385 return getDerived().RebuildCXXConstructExpr(
15387 E->hadMultipleCandidates(),
E->isListInitialization(),
15388 E->isStdInitListInitialization(),
E->requiresZeroInitialization(),
15389 E->getConstructionKind(),
E->getParenOrBraceRange());
15392template<
typename Derived>
15393ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
15394 CXXInheritedCtorInitExpr *
E) {
15395 QualType
T = getDerived().TransformType(
E->
getType());
15399 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15400 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15404 if (!getDerived().AlwaysRebuild() &&
15413 return getDerived().RebuildCXXInheritedCtorInitExpr(
15415 E->constructsVBase(),
E->inheritedFromVBase());
15422template<
typename Derived>
15424TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *
E) {
15425 if (
auto *Dtor =
E->getTemporary()->getDestructor())
15427 const_cast<CXXDestructorDecl *
>(Dtor));
15428 return getDerived().TransformExpr(
E->getSubExpr());
15436template<
typename Derived>
15438TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *
E) {
15439 return getDerived().TransformExpr(
E->getSubExpr());
15442template<
typename Derived>
15444TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
15445 CXXTemporaryObjectExpr *
E) {
15446 TypeSourceInfo *
T =
15447 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15451 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15452 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15456 bool ArgumentChanged =
false;
15458 Args.reserve(
E->getNumArgs());
15460 EnterExpressionEvaluationContext Context(
15462 E->isListInitialization());
15463 if (TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15467 if (
E->isListInitialization() && !
E->isStdInitListInitialization()) {
15469 if (Res.isInvalid())
15471 Args = {Res.get()};
15475 if (!getDerived().AlwaysRebuild() &&
15476 T ==
E->getTypeSourceInfo() &&
15478 !ArgumentChanged) {
15484 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
15485 return getDerived().RebuildCXXTemporaryObjectExpr(
15486 T, LParenLoc, Args,
E->
getEndLoc(),
E->isListInitialization());
15489template<
typename Derived>
15491TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *
E) {
15494 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15495 struct TransformedInitCapture {
15497 SourceLocation EllipsisLoc;
15502 InitCaptures.resize(
E->explicit_capture_end() -
E->explicit_capture_begin());
15504 CEnd =
E->capture_end();
15506 if (!
E->isInitCapture(
C))
15509 TransformedInitCapture &
Result = InitCaptures[
C -
E->capture_begin()];
15510 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15512 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
15513 UnsignedOrNone NumExpansions) {
15514 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15517 if (NewExprInitResult.isInvalid()) {
15518 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
15521 Expr *NewExprInit = NewExprInitResult.get();
15523 QualType NewInitCaptureType =
15524 getSema().buildLambdaInitCaptureInitialization(
15525 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15526 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15527 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
15530 Result.Expansions.push_back(
15531 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15535 if (OldVD->isParameterPack()) {
15536 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
15538 .castAs<PackExpansionTypeLoc>();
15544 bool Expand =
true;
15545 bool RetainExpansion =
false;
15546 UnsignedOrNone OrigNumExpansions =
15547 ExpansionTL.getTypePtr()->getNumExpansions();
15548 UnsignedOrNone NumExpansions = OrigNumExpansions;
15549 if (getDerived().TryExpandParameterPacks(
15550 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15551 Unexpanded,
true, Expand,
15552 RetainExpansion, NumExpansions))
15554 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15555 "capture since it cannot be extended");
15557 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15558 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), I);
15559 SubstInitCapture(SourceLocation(), std::nullopt);
15562 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15563 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15566 SubstInitCapture(SourceLocation(), std::nullopt);
15570 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
15571 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
15582 DeclContext *DC = getSema().CurContext;
15600 while (DC->isRequiresExprBody())
15601 DC = DC->getParent();
15602 if ((getSema().isUnevaluatedContext() ||
15603 getSema().isConstantEvaluatedContext()) &&
15604 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15607 CXXRecordDecl *OldClass =
E->getLambdaClass();
15608 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
15609 E->getIntroducerRange(),
nullptr, DependencyKind,
15610 E->getCaptureDefault());
15611 getDerived().transformedLocalDecl(OldClass, {
Class});
15613 CXXMethodDecl *NewCallOperator =
15614 getSema().CreateLambdaCallOperator(
E->getIntroducerRange(),
Class);
15617 getSema().buildLambdaScope(LSI, NewCallOperator,
E->getIntroducerRange(),
15618 E->getCaptureDefault(),
E->getCaptureDefaultLoc(),
15619 E->hasExplicitParameters(),
E->isMutable());
15622 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
15629 CEnd =
E->capture_end();
15633 if (
C->isImplicit())
15637 if (
C->capturesThis()) {
15643 Sema::CXXThisScopeRAII ThisScope(
15645 dyn_cast_if_present<CXXRecordDecl>(
15646 getSema().getFunctionLevelDeclContext()),
15648 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15655 if (
C->capturesVLAType())
15659 if (
E->isInitCapture(
C)) {
15660 TransformedInitCapture &NewC = InitCaptures[
C -
E->capture_begin()];
15662 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15665 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15667 QualType InitQualType = Info.second;
15668 if (
Init.isInvalid() || InitQualType.isNull()) {
15672 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15673 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15674 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15675 getSema().CurContext);
15680 NewVDs.push_back(NewVD);
15681 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15686 if (NewC.EllipsisLoc.isInvalid())
15687 LSI->ContainsUnexpandedParameterPack |=
15688 Init.get()->containsUnexpandedParameterPack();
15694 getDerived().transformedLocalDecl(OldVD, NewVDs);
15698 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15705 SourceLocation EllipsisLoc;
15706 if (
C->isPackExpansion()) {
15708 bool ShouldExpand =
false;
15709 bool RetainExpansion =
false;
15710 UnsignedOrNone NumExpansions = std::nullopt;
15711 if (getDerived().TryExpandParameterPacks(
15712 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15713 true, ShouldExpand,
15714 RetainExpansion, NumExpansions)) {
15719 if (ShouldExpand) {
15723 auto *Pack = cast<ValueDecl>(
C->getCapturedVar());
15724 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15725 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), I);
15726 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15727 getDerived().TransformDecl(
C->getLocation(), Pack));
15728 if (!CapturedVar) {
15734 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15742 EllipsisLoc =
C->getEllipsisLoc();
15746 auto *CapturedVar = cast_or_null<ValueDecl>(
15747 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15748 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15755 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15756 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15759 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15762 getSema().finishLambdaExplicitCaptures(LSI);
15766 auto TPL = getDerived().TransformTemplateParameterList(
15767 E->getTemplateParameterList());
15768 LSI->GLTemplateParameterList = TPL;
15770 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15772 LSI->ContainsUnexpandedParameterPack |=
15773 TPL->containsUnexpandedParameterPack();
15776 TypeLocBuilder NewCallOpTLBuilder;
15777 TypeLoc OldCallOpTypeLoc =
15778 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15779 QualType NewCallOpType =
15780 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15781 if (NewCallOpType.isNull())
15783 LSI->ContainsUnexpandedParameterPack |=
15784 NewCallOpType->containsUnexpandedParameterPack();
15785 TypeSourceInfo *NewCallOpTSI =
15786 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15790 auto FPTL = NewCallOpTSI->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>();
15791 assert(FPTL &&
"Not a FunctionProtoType?");
15793 AssociatedConstraint TRC =
E->getCallOperator()->getTrailingRequiresClause();
15794 if (!TRC.ArgPackSubstIndex)
15797 getSema().CompleteLambdaCallOperator(
15798 NewCallOperator,
E->getCallOperator()->getLocation(),
15799 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15800 E->getCallOperator()->getConstexprKind(),
15801 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15802 E->hasExplicitResultType());
15804 getDerived().transformAttrs(
E->getCallOperator(), NewCallOperator);
15805 getDerived().transformedLocalDecl(
E->getCallOperator(), {NewCallOperator});
15809 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
15811 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15812 if (getDerived().ReplacingOriginal()) {
15813 Numbering = OldClass->getLambdaNumbering();
15816 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15821 getSema().PushExpressionEvaluationContextForFunction(
15823 E->getCallOperator());
15825 Sema::CodeSynthesisContext
C;
15828 getSema().pushCodeSynthesisContext(
C);
15834 getSema().popCodeSynthesisContext();
15837 FuncScopeCleanup.disable();
15839 if (Body.isInvalid()) {
15840 SavedContext.pop();
15846 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15849 SavedContext.pop();
15884 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15885 Class->setLambdaDependencyKind(DependencyKind);
15887 return getDerived().RebuildLambdaExpr(
E->
getBeginLoc(),
15888 Body.get()->getEndLoc(), LSI);
15891template<
typename Derived>
15894 return TransformStmt(S);
15897template<
typename Derived>
15902 CEnd =
E->capture_end();
15906 if (!
C->isImplicit())
15910 if (
C->capturesThis()) {
15911 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15918 if (
C->capturesVLAType())
15921 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15922 assert(!
E->isInitCapture(
C) &&
"implicit init-capture?");
15925 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15926 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15931 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15937template<
typename Derived>
15942 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15946 bool ArgumentChanged =
false;
15948 Args.reserve(
E->getNumArgs());
15952 E->isListInitialization());
15953 if (getDerived().TransformExprs(
E->arg_begin(),
E->getNumArgs(),
true, Args,
15958 if (!getDerived().AlwaysRebuild() &&
15959 T ==
E->getTypeSourceInfo() &&
15964 return getDerived().RebuildCXXUnresolvedConstructExpr(
15965 T,
E->getLParenLoc(), Args,
E->getRParenLoc(),
E->isListInitialization());
15968template<
typename Derived>
15970TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
15971 CXXDependentScopeMemberExpr *
E) {
15976 QualType ObjectType;
15977 if (!
E->isImplicitAccess()) {
15978 OldBase =
E->getBase();
15979 Base = getDerived().TransformExpr(OldBase);
15980 if (
Base.isInvalid())
15985 bool MayBePseudoDestructor =
false;
15987 E->getOperatorLoc(),
15988 E->isArrow()? tok::arrow : tok::period,
15990 MayBePseudoDestructor);
15991 if (
Base.isInvalid())
15994 ObjectType = ObjectTy.get();
15995 BaseType = ((Expr*)
Base.get())->getType();
15998 BaseType = getDerived().TransformType(
E->getBaseType());
16004 NamedDecl *FirstQualifierInScope
16005 = getDerived().TransformFirstQualifierInScope(
16006 E->getFirstQualifierFoundInScope(),
16009 NestedNameSpecifierLoc QualifierLoc;
16010 if (
E->getQualifier()) {
16012 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc(),
16014 FirstQualifierInScope);
16019 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
16025 DeclarationNameInfo NameInfo
16026 = getDerived().TransformDeclarationNameInfo(
E->getMemberNameInfo());
16027 if (!NameInfo.getName())
16030 if (!
E->hasExplicitTemplateArgs()) {
16033 if (!getDerived().AlwaysRebuild() &&
16034 Base.get() == OldBase &&
16035 BaseType ==
E->getBaseType() &&
16036 QualifierLoc ==
E->getQualifierLoc() &&
16037 NameInfo.getName() ==
E->getMember() &&
16038 FirstQualifierInScope ==
E->getFirstQualifierFoundInScope())
16041 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16044 E->getOperatorLoc(),
16047 FirstQualifierInScope,
16052 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
16053 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
16054 E->getNumTemplateArgs(),
16058 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16061 E->getOperatorLoc(),
16064 FirstQualifierInScope,
16069template <
typename Derived>
16070ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
16071 UnresolvedMemberExpr *Old) {
16075 if (!Old->isImplicitAccess()) {
16076 Base = getDerived().TransformExpr(Old->getBase());
16077 if (
Base.isInvalid())
16080 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16081 if (
Base.isInvalid())
16083 BaseType =
Base.get()->getType();
16085 BaseType = getDerived().TransformType(Old->getBaseType());
16088 NestedNameSpecifierLoc QualifierLoc;
16089 if (Old->getQualifierLoc()) {
16091 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16096 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
16101 if (TransformOverloadExprDecls(Old,
false, R))
16105 if (Old->getNamingClass()) {
16106 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
16107 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16111 R.setNamingClass(NamingClass);
16114 TemplateArgumentListInfo TransArgs;
16115 if (Old->hasExplicitTemplateArgs()) {
16116 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16117 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16118 if (getDerived().TransformTemplateArguments(
16119 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16127 NamedDecl *FirstQualifierInScope =
nullptr;
16129 return getDerived().RebuildUnresolvedMemberExpr(
16130 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16131 TemplateKWLoc, FirstQualifierInScope, R,
16132 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16135template<
typename Derived>
16137TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *
E) {
16140 ExprResult SubExpr = getDerived().TransformExpr(
E->getOperand());
16141 if (SubExpr.isInvalid())
16144 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getOperand())
16147 return getDerived().RebuildCXXNoexceptExpr(
E->
getSourceRange(),SubExpr.get());
16150template<
typename Derived>
16152TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *
E) {
16153 ExprResult Pattern = getDerived().TransformExpr(
E->getPattern());
16154 if (Pattern.isInvalid())
16157 if (!getDerived().AlwaysRebuild() && Pattern.get() ==
E->getPattern())
16160 return getDerived().RebuildPackExpansion(Pattern.get(),
E->getEllipsisLoc(),
16161 E->getNumExpansions());
16164template <
typename Derived>
16169 if (!Arg.isPackExpansion()) {
16175 InventTemplateArgumentLoc(Arg, ArgLoc);
16181 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16182 OrigNumExpansions);
16187 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
16193 getSema().getFullyPackExpandedSize(OutPattern.
getArgument());
16194 if (!NumExpansions) {
16206template<
typename Derived>
16221 if (
E->isPartiallySubstituted()) {
16222 PackArgs =
E->getPartialArguments();
16225 bool ShouldExpand =
false;
16226 bool RetainExpansion =
false;
16227 UnsignedOrNone NumExpansions = std::nullopt;
16228 if (getDerived().TryExpandParameterPacks(
16229 E->getOperatorLoc(),
E->getPackLoc(), Unexpanded,
16230 true, ShouldExpand,
16231 RetainExpansion, NumExpansions))
16236 if (ShouldExpand) {
16237 auto *Pack =
E->getPack();
16238 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16239 ArgStorage = getSema().Context.getPackExpansionType(
16241 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16242 ArgStorage = TemplateArgument(
TemplateName(TTPD), std::nullopt);
16244 auto *VD = cast<ValueDecl>(Pack);
16245 ExprResult DRE = getSema().BuildDeclRefExpr(
16246 VD, VD->getType().getNonLValueExprType(getSema().Context),
16249 if (DRE.isInvalid())
16251 ArgStorage = TemplateArgument(
16252 new (getSema().Context)
16253 PackExpansionExpr(DRE.get(),
E->getPackLoc(), std::nullopt),
16256 PackArgs = ArgStorage;
16261 if (!PackArgs.size()) {
16262 auto *Pack = cast_or_null<NamedDecl>(
16263 getDerived().TransformDecl(
E->getPackLoc(),
E->getPack()));
16266 return getDerived().RebuildSizeOfPackExpr(
16267 E->getOperatorLoc(), Pack,
E->getPackLoc(),
E->getRParenLoc(),
16273 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16278 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
16280 E->getRParenLoc(), *
Result, {});
16282 TemplateArgumentListInfo TransformedPackArgs(
E->getPackLoc(),
16285 TemporaryBase Rebase(*
this,
E->getPackLoc(), getBaseEntity());
16286 typedef TemplateArgumentLocInventIterator<
16287 Derived,
const TemplateArgument*> PackLocIterator;
16288 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16289 PackLocIterator(*
this, PackArgs.end()),
16290 TransformedPackArgs,
true))
16297 bool PartialSubstitution =
false;
16298 for (
auto &
Loc : TransformedPackArgs.arguments()) {
16299 Args.push_back(
Loc.getArgument());
16300 if (
Loc.getArgument().isPackExpansion())
16301 PartialSubstitution =
true;
16304 if (PartialSubstitution)
16305 return getDerived().RebuildSizeOfPackExpr(
16306 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
16307 std::nullopt, Args);
16309 return getDerived().RebuildSizeOfPackExpr(
16310 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
16311 static_cast<unsigned>(Args.size()),
16315template <
typename Derived>
16317TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *
E) {
16324 EnterExpressionEvaluationContext ConstantContext(
16326 IndexExpr = getDerived().TransformExpr(
E->getIndexExpr());
16327 if (IndexExpr.isInvalid())
16332 bool FullySubstituted =
true;
16333 if (!
E->expandsToEmptyPack() &&
E->getExpressions().empty()) {
16334 Expr *Pattern =
E->getPackIdExpression();
16336 getSema().collectUnexpandedParameterPacks(
E->getPackIdExpression(),
16338 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16342 bool ShouldExpand =
true;
16343 bool RetainExpansion =
false;
16344 UnsignedOrNone OrigNumExpansions = std::nullopt,
16345 NumExpansions = std::nullopt;
16346 if (getDerived().TryExpandParameterPacks(
16348 true, ShouldExpand,
16349 RetainExpansion, NumExpansions))
16351 if (!ShouldExpand) {
16352 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
16353 ExprResult Pack = getDerived().TransformExpr(Pattern);
16354 if (Pack.isInvalid())
16356 return getDerived().RebuildPackIndexingExpr(
16357 E->getEllipsisLoc(),
E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16360 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16361 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), I);
16362 ExprResult Out = getDerived().TransformExpr(Pattern);
16363 if (Out.isInvalid())
16365 if (Out.get()->containsUnexpandedParameterPack()) {
16366 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
16367 OrigNumExpansions);
16368 if (Out.isInvalid())
16370 FullySubstituted =
false;
16372 ExpandedExprs.push_back(Out.get());
16376 if (RetainExpansion) {
16377 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16379 ExprResult Out = getDerived().TransformExpr(Pattern);
16380 if (Out.isInvalid())
16383 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
16384 OrigNumExpansions);
16385 if (Out.isInvalid())
16387 FullySubstituted =
false;
16388 ExpandedExprs.push_back(Out.get());
16390 }
else if (!
E->expandsToEmptyPack()) {
16391 if (getDerived().TransformExprs(
E->getExpressions().data(),
16392 E->getExpressions().size(),
false,
16397 return getDerived().RebuildPackIndexingExpr(
16398 E->getEllipsisLoc(),
E->getRSquareLoc(),
E->getPackIdExpression(),
16399 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16402template<
typename Derived>
16404TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
16405 SubstNonTypeTemplateParmPackExpr *
E) {
16410template<
typename Derived>
16412TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
16413 SubstNonTypeTemplateParmExpr *
E) {
16418template<
typename Derived>
16420TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *
E) {
16425template<
typename Derived>
16427TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
16428 MaterializeTemporaryExpr *
E) {
16429 return getDerived().TransformExpr(
E->getSubExpr());
16432template<
typename Derived>
16434TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *
E) {
16435 UnresolvedLookupExpr *
Callee =
nullptr;
16436 if (Expr *OldCallee =
E->getCallee()) {
16437 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16438 if (CalleeResult.isInvalid())
16440 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
16443 Expr *Pattern =
E->getPattern();
16446 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16447 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16451 bool Expand =
true;
16452 bool RetainExpansion =
false;
16453 UnsignedOrNone OrigNumExpansions =
E->getNumExpansions(),
16454 NumExpansions = OrigNumExpansions;
16455 if (getDerived().TryExpandParameterPacks(
16457 true, Expand, RetainExpansion,
16464 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
16467 E->getLHS() ? getDerived().TransformExpr(
E->getLHS()) :
ExprResult();
16468 if (LHS.isInvalid())
16472 E->getRHS() ? getDerived().TransformExpr(
E->getRHS()) :
ExprResult();
16473 if (RHS.isInvalid())
16476 if (!getDerived().AlwaysRebuild() &&
16477 LHS.get() ==
E->getLHS() && RHS.get() ==
E->getRHS())
16480 return getDerived().RebuildCXXFoldExpr(
16482 E->getEllipsisLoc(), RHS.get(),
E->
getEndLoc(), NumExpansions);
16488 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16489 SemaRef.
Diag(
E->getEllipsisLoc(),
16490 clang::diag::err_fold_expression_limit_exceeded)
16491 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16493 SemaRef.
Diag(
E->getEllipsisLoc(), diag::note_bracket_depth);
16502 bool LeftFold =
E->isLeftFold();
16506 if (!LeftFold && RetainExpansion) {
16507 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16509 ExprResult Out = getDerived().TransformExpr(Pattern);
16510 if (Out.isInvalid())
16513 Result = getDerived().RebuildCXXFoldExpr(
16520 bool WarnedOnComparison =
false;
16521 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16522 Sema::ArgPackSubstIndexRAII SubstIndex(
16523 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16524 ExprResult Out = getDerived().TransformExpr(Pattern);
16525 if (Out.isInvalid())
16528 if (Out.get()->containsUnexpandedParameterPack()) {
16530 Result = getDerived().RebuildCXXFoldExpr(
16532 E->getOperator(),
E->getEllipsisLoc(),
16534 OrigNumExpansions);
16535 }
else if (
Result.isUsable()) {
16537 Expr *LHS = LeftFold ?
Result.get() : Out.get();
16538 Expr *RHS = LeftFold ? Out.get() :
Result.get();
16540 UnresolvedSet<16> Functions;
16541 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
16542 Result = getDerived().RebuildCXXOperatorCallExpr(
16544 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16545 Functions, LHS, RHS);
16547 Result = getDerived().RebuildBinaryOperator(
E->getEllipsisLoc(),
16548 E->getOperator(), LHS, RHS,
16550 if (!WarnedOnComparison &&
Result.isUsable()) {
16551 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16552 BO && BO->isComparisonOp()) {
16553 WarnedOnComparison =
true;
16554 SemaRef.
Diag(BO->getBeginLoc(),
16555 diag::warn_comparison_in_fold_expression)
16556 << BO->getOpcodeStr();
16569 if (LeftFold && RetainExpansion) {
16570 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16572 ExprResult Out = getDerived().TransformExpr(Pattern);
16573 if (Out.isInvalid())
16576 Result = getDerived().RebuildCXXFoldExpr(
16578 E->getEllipsisLoc(), Out.get(),
E->
getEndLoc(), OrigNumExpansions);
16583 if (ParenExpr *PE = dyn_cast_or_null<ParenExpr>(
Result.get()))
16584 PE->setIsProducedByFoldExpansion();
16589 return getDerived().RebuildEmptyCXXFoldExpr(
E->getEllipsisLoc(),
16594template <
typename Derived>
16596TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *
E) {
16600 QualType
T = getDerived().TransformType(
E->
getType());
16602 bool ArgChanged =
false;
16604 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16605 TransformedInits, &ArgChanged))
16608 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T ==
E->
getType())
16611 return getDerived().RebuildCXXParenListInitExpr(
16612 TransformedInits,
T,
E->getUserSpecifiedInitExprs().size(),
16616template<
typename Derived>
16618TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
16619 CXXStdInitializerListExpr *
E) {
16620 return getDerived().TransformExpr(
E->getSubExpr());
16623template<
typename Derived>
16625TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *
E) {
16629template<
typename Derived>
16631TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *
E) {
16635template<
typename Derived>
16637TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *
E) {
16638 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
16639 if (SubExpr.isInvalid())
16642 if (!getDerived().AlwaysRebuild() &&
16643 SubExpr.get() ==
E->getSubExpr())
16646 return getDerived().RebuildObjCBoxedExpr(
E->
getSourceRange(), SubExpr.get());
16649template<
typename Derived>
16651TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *
E) {
16654 bool ArgChanged =
false;
16655 if (getDerived().TransformExprs(
E->getElements(),
E->getNumElements(),
16656 false, Elements, &ArgChanged))
16659 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16667template<
typename Derived>
16669TreeTransform<Derived>::TransformObjCDictionaryLiteral(
16670 ObjCDictionaryLiteral *
E) {
16673 bool ArgChanged =
false;
16674 for (
unsigned I = 0, N =
E->getNumElements(); I != N; ++I) {
16675 ObjCDictionaryElement OrigElement =
E->getKeyValueElement(I);
16677 if (OrigElement.isPackExpansion()) {
16680 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16681 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16682 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16686 bool Expand =
true;
16687 bool RetainExpansion =
false;
16688 UnsignedOrNone OrigNumExpansions = OrigElement.NumExpansions;
16689 UnsignedOrNone NumExpansions = OrigNumExpansions;
16690 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16691 OrigElement.Value->getEndLoc());
16692 if (getDerived().TryExpandParameterPacks(
16693 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16694 true, Expand, RetainExpansion,
16702 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), std::nullopt);
16703 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16704 if (Key.isInvalid())
16707 if (Key.get() != OrigElement.Key)
16711 if (
Value.isInvalid())
16714 if (
Value.get() != OrigElement.Value)
16717 ObjCDictionaryElement Expansion = {
16718 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16720 Elements.push_back(Expansion);
16730 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16731 Sema::ArgPackSubstIndexRAII SubstIndex(getSema(), I);
16732 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16733 if (Key.isInvalid())
16737 if (
Value.isInvalid())
16740 ObjCDictionaryElement Element = {
16741 Key.get(),
Value.get(), SourceLocation(), NumExpansions
16747 if (Key.get()->containsUnexpandedParameterPack() ||
16748 Value.get()->containsUnexpandedParameterPack())
16749 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16751 Elements.push_back(Element);
16761 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16762 if (Key.isInvalid())
16765 if (Key.get() != OrigElement.Key)
16770 = getDerived().TransformExpr(OrigElement.Value);
16771 if (
Value.isInvalid())
16774 if (
Value.get() != OrigElement.Value)
16777 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
16779 Elements.push_back(Element);
16782 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16785 return getDerived().RebuildObjCDictionaryLiteral(
E->
getSourceRange(),
16789template<
typename Derived>
16791TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *
E) {
16792 TypeSourceInfo *EncodedTypeInfo
16793 = getDerived().TransformType(
E->getEncodedTypeSourceInfo());
16794 if (!EncodedTypeInfo)
16797 if (!getDerived().AlwaysRebuild() &&
16798 EncodedTypeInfo ==
E->getEncodedTypeSourceInfo())
16801 return getDerived().RebuildObjCEncodeExpr(
E->getAtLoc(),
16803 E->getRParenLoc());
16806template<
typename Derived>
16808TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *
E) {
16813 return getDerived().TransformExpr(
E->getSubExpr());
16816template<
typename Derived>
16818TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *
E) {
16819 TypeSourceInfo *TSInfo
16820 = getDerived().TransformType(
E->getTypeInfoAsWritten());
16828 if (!getDerived().AlwaysRebuild() &&
16829 TSInfo ==
E->getTypeInfoAsWritten() &&
16830 Result.get() ==
E->getSubExpr())
16834 E->getLParenLoc(),
E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
16838template <
typename Derived>
16839ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
16840 ObjCAvailabilityCheckExpr *
E) {
16844template<
typename Derived>
16846TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *
E) {
16848 bool ArgChanged =
false;
16850 Args.reserve(
E->getNumArgs());
16851 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
false, Args,
16857 TypeSourceInfo *ReceiverTypeInfo
16858 = getDerived().TransformType(
E->getClassReceiverTypeInfo());
16859 if (!ReceiverTypeInfo)
16863 if (!getDerived().AlwaysRebuild() &&
16864 ReceiverTypeInfo ==
E->getClassReceiverTypeInfo() && !ArgChanged)
16869 E->getSelectorLocs(SelLocs);
16870 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16873 E->getMethodDecl(),
16880 if (!
E->getMethodDecl())
16885 E->getSelectorLocs(SelLocs);
16886 return getDerived().RebuildObjCMessageExpr(
E->getSuperLoc(),
16889 E->getReceiverType(),
16890 E->getMethodDecl(),
16898 "Only class and instance messages may be instantiated");
16900 = getDerived().TransformExpr(
E->getInstanceReceiver());
16901 if (Receiver.isInvalid())
16905 if (!getDerived().AlwaysRebuild() &&
16906 Receiver.get() ==
E->getInstanceReceiver() && !ArgChanged)
16911 E->getSelectorLocs(SelLocs);
16912 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16915 E->getMethodDecl(),
16921template<
typename Derived>
16923TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *
E) {
16927template<
typename Derived>
16929TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *
E) {
16933template<
typename Derived>
16935TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *
E) {
16938 if (
Base.isInvalid())
16944 if (!getDerived().AlwaysRebuild() &&
16945 Base.get() ==
E->getBase())
16948 return getDerived().RebuildObjCIvarRefExpr(
Base.get(),
E->getDecl(),
16950 E->isArrow(),
E->isFreeIvar());
16953template<
typename Derived>
16955TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *
E) {
16958 if (!
E->isObjectReceiver())
16963 if (
Base.isInvalid())
16969 if (!getDerived().AlwaysRebuild() &&
16970 Base.get() ==
E->getBase())
16973 if (
E->isExplicitProperty())
16974 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16975 E->getExplicitProperty(),
16978 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16980 E->getImplicitPropertyGetter(),
16981 E->getImplicitPropertySetter(),
16985template<
typename Derived>
16987TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *
E) {
16990 if (
Base.isInvalid())
16994 ExprResult Key = getDerived().TransformExpr(
E->getKeyExpr());
16995 if (Key.isInvalid())
16999 if (!getDerived().AlwaysRebuild() &&
17000 Key.get() ==
E->getKeyExpr() &&
Base.get() ==
E->getBaseExpr())
17003 return getDerived().RebuildObjCSubscriptRefExpr(
E->getRBracket(),
17004 Base.get(), Key.get(),
17005 E->getAtIndexMethodDecl(),
17006 E->setAtIndexMethodDecl());
17009template<
typename Derived>
17011TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *
E) {
17014 if (
Base.isInvalid())
17018 if (!getDerived().AlwaysRebuild() &&
17019 Base.get() ==
E->getBase())
17022 return getDerived().RebuildObjCIsaExpr(
Base.get(),
E->getIsaMemberLoc(),
17027template<
typename Derived>
17029TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *
E) {
17030 bool ArgumentChanged =
false;
17032 SubExprs.reserve(
E->getNumSubExprs());
17033 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
17034 SubExprs, &ArgumentChanged))
17037 if (!getDerived().AlwaysRebuild() &&
17041 return getDerived().RebuildShuffleVectorExpr(
E->getBuiltinLoc(),
17043 E->getRParenLoc());
17046template<
typename Derived>
17048TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *
E) {
17049 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
17050 if (SrcExpr.isInvalid())
17053 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
17057 if (!getDerived().AlwaysRebuild() &&
17058 Type ==
E->getTypeSourceInfo() &&
17059 SrcExpr.get() ==
E->getSrcExpr())
17062 return getDerived().RebuildConvertVectorExpr(
E->getBuiltinLoc(),
17063 SrcExpr.get(), Type,
17064 E->getRParenLoc());
17067template<
typename Derived>
17069TreeTransform<Derived>::TransformBlockExpr(BlockExpr *
E) {
17070 BlockDecl *oldBlock =
E->getBlockDecl();
17073 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
17076 blockScope->TheDecl->setBlockMissingReturnType(
17077 oldBlock->blockMissingReturnType());
17082 const FunctionProtoType *exprFunctionType =
E->getFunctionType();
17085 Sema::ExtParameterInfoBuilder extParamInfos;
17086 if (getDerived().TransformFunctionTypeParams(
17087 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17088 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17090 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
17094 QualType exprResultType =
17095 getDerived().TransformType(exprFunctionType->getReturnType());
17097 auto epi = exprFunctionType->getExtProtoInfo();
17098 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17101 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17105 if (!params.empty())
17106 blockScope->TheDecl->setParams(params);
17108 if (!oldBlock->blockMissingReturnType()) {
17109 blockScope->HasImplicitReturnType =
false;
17110 blockScope->ReturnType = exprResultType;
17114 StmtResult body = getDerived().TransformStmt(
E->getBody());
17115 if (body.isInvalid()) {
17116 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
17124 for (
const auto &I : oldBlock->captures()) {
17125 VarDecl *oldCapture = I.getVariable();
17128 if (oldCapture->isParameterPack())
17131 VarDecl *newCapture =
17132 cast<VarDecl>(getDerived().TransformDecl(
E->getCaretLocation(),
17134 assert(blockScope->CaptureMap.count(newCapture));
17140 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17141 "this pointer isn't captured in the old block");
17149template<
typename Derived>
17151TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *
E) {
17152 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
17153 if (SrcExpr.isInvalid())
17156 QualType
Type = getDerived().TransformType(
E->
getType());
17159 E->getRParenLoc());
17162template<
typename Derived>
17164TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *
E) {
17165 bool ArgumentChanged =
false;
17167 SubExprs.reserve(
E->getNumSubExprs());
17168 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
17169 SubExprs, &ArgumentChanged))
17172 if (!getDerived().AlwaysRebuild() &&
17176 return getDerived().RebuildAtomicExpr(
E->getBuiltinLoc(), SubExprs,
17177 E->getOp(),
E->getRParenLoc());
17184template<
typename Derived>
17188 getDerived().getBaseEntity());
17191template<
typename Derived>
17195 getDerived().getBaseEntity());
17198template<
typename Derived>
17201 bool WrittenAsLValue,
17204 Sigil, getDerived().getBaseEntity());
17207template <
typename Derived>
17212 getDerived().getBaseEntity());
17215template<
typename Derived>
17223 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17227template<
typename Derived>
17239 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17240 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17245template<
typename Derived>
17252template <
typename Derived>
17255 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17256 if (SizeExpr || !Size)
17258 IndexTypeQuals, BracketsRange,
17259 getDerived().getBaseEntity());
17267 for (
const auto &
T : Types)
17279 IndexTypeQuals, BracketsRange,
17280 getDerived().getBaseEntity());
17283template <
typename Derived>
17286 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17287 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17288 IndexTypeQuals, BracketsRange);
17291template <
typename Derived>
17295 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17296 IndexTypeQuals, BracketsRange);
17299template <
typename Derived>
17302 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17303 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17305 IndexTypeQuals, BracketsRange);
17308template <
typename Derived>
17311 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17312 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17314 IndexTypeQuals, BracketsRange);
17317template <
typename Derived>
17324template <
typename Derived>
17326 unsigned NumElements,
17332template <
typename Derived>
17339template<
typename Derived>
17341 unsigned NumElements,
17344 NumElements,
true);
17351template<
typename Derived>
17359template <
typename Derived>
17361 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17366template <
typename Derived>
17374template <
typename Derived>
17379 getDerived().getBaseLocation(),
17380 getDerived().getBaseEntity(),
17384template<
typename Derived>
17389template <
typename Derived>
17393 assert(
D &&
"no decl found");
17397 if (
auto *UPD = dyn_cast<UsingPackDecl>(
D)) {
17401 if (UPD->expansions().empty()) {
17402 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17403 << UPD->isCXXClassMember() << UPD;
17412 for (
auto *
E : UPD->expansions()) {
17414 RebuildUnresolvedUsingType(
Keyword, Qualifier, NameLoc,
E);
17419 else if (
T.isNull())
17423 "mismatched resolved types in using pack expansion");
17425 return T.isNull() ? FallbackT :
T;
17427 if (
auto *Using = dyn_cast<UsingDecl>(
D)) {
17428 assert(Using->hasTypename() &&
17429 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17432 assert(++Using->shadow_begin() == Using->shadow_end());
17439 assert(isa<UnresolvedUsingTypenameDecl>(
D) &&
17440 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17442 Keyword, Qualifier, cast<UnresolvedUsingTypenameDecl>(
D));
17445template <
typename Derived>
17451template<
typename Derived>
17457template <
typename Derived>
17462template <
typename Derived>
17468 FullySubstituted, Expansions);
17471template<
typename Derived>
17478template <
typename Derived>
17486template<
typename Derived>
17492template<
typename Derived>
17500template <
typename Derived>
17511template <
typename Derived>
17517template <
typename Derived>
17525template <
typename Derived>
17532 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17535 AllowInjectedClassName);
17539template<
typename Derived>
17546 bool AllowInjectedClassName) {
17549 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17550 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
17552 getSema().ActOnTemplateName(
17554 false,
Template, AllowInjectedClassName);
17558template <
typename Derived>
17563 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17569 Opc,
First, Second);
17584 if (Op == OO_Subscript) {
17585 if (!
First->getType()->isOverloadableType() &&
17587 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17589 }
else if (Op == OO_Arrow) {
17592 if (
First->getType()->isDependentType())
17596 }
else if (Second ==
nullptr || isPostIncDec) {
17597 if (!
First->getType()->isOverloadableType() ||
17598 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
17605 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17609 !
First->getType()->isOverloadableType() &&
17624 if (!Second || isPostIncDec) {
17634 First, Second, RequiresADL);
17641template<
typename Derived>
17651 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17653 (!isArrow && !isa<RecordType>(CanonicalBaseType)) ||
17654 (isArrow && isa<PointerType>(CanonicalBaseType) &&
17655 !cast<PointerType>(CanonicalBaseType)
17660 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17661 CCLoc, TildeLoc, Destroyed);
17673 if (!isa<TagType>(ScopeType->getType().getCanonicalType())) {
17674 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17675 diag::err_expected_class_or_namespace)
17676 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
17680 SS.
Make(SemaRef.
Context, ScopeType->getTypeLoc(), CCLoc);
17684 return getSema().BuildMemberReferenceExpr(
17685 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17691template<
typename Derived>
17699 for (
unsigned I = 0; I < NumParams; ++I) {
17700 if (I != ContextParamPos) {
17706 Params.push_back(std::make_pair(StringRef(), QualType()));
17709 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
17710 S->getCapturedRegionKind(), Params);
17713 Sema::CompoundScopeRAII CompoundScope(getSema());
17714 Body = getDerived().TransformStmt(S->getCapturedStmt());
17717 if (Body.isInvalid()) {
17718 getSema().ActOnCapturedRegionError();
17722 return getSema().ActOnCapturedRegionEnd(Body.get());
17725template <
typename Derived>
17727TreeTransform<Derived>::TransformSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
17731 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17735template <
typename Derived>
17736ExprResult TreeTransform<Derived>::TransformHLSLOutArgExpr(HLSLOutArgExpr *
E) {
17739 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.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
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)
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
DeclarationNameTable DeclarationNames
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, const DependentTemplateStorage &Name, ArrayRef< TemplateArgumentLoc > Args) 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.
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, UnsignedOrNone PackIndex, bool Final) 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 getUsingType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UsingShadowDecl *D, QualType UnderlyingType=QualType()) const
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 getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier NNS, const IdentifierInfo *Name) const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array 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 PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getTypeDeclType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypeDecl *Decl) const
CanQualType UnsignedInt128Ty
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, TemplateDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
QualType getTypedefType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType UnderlyingType=QualType(), std::optional< bool > TypeMatchesDeclOrNone=std::nullopt) const
Return the unique reference to the type for the specified typedef-name decl.
TemplateName getQualifiedTemplateName(NestedNameSpecifier Qualifier, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getTagType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TagDecl *TD, bool OwnsTag) const
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
QualType getUnresolvedUsingType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UnresolvedUsingTypenameDecl *D) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getDeducedTemplateSpecializationType(ElaboratedTypeKeyword Keyword, TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
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 ...
CanQualType getCanonicalTagType(const TagDecl *TD) const
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
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.
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
AutoTypeKeyword getKeyword() const
TemplateDecl * getTypeConstraintConcept() 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.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
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 '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
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, TemplateDecl *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.
unsigned getNumArgs() const
SourceLocation getTemplateNameLoc() const
SourceLocation getLAngleLoc() const
SourceLocation getTemplateKeywordLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Represents a template specialization type whose template cannot be resolved, e.g.
Represents a dependent template name that cannot be resolved prior to template instantiation.
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
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
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.
ArrayRef< ParmVarDecl * > parameters() const
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.
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.
Data structure that captures multiple levels of template argument lists for use in template instantia...
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 C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end 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.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() 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.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
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.
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)
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, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, 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, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, 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, ArrayRef< VarDecl * > InitRecipes, 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.
UnsignedOrNone 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
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() 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)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
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 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.
void setVarListDetails(ArrayRef< Expr * > VarList, OpenACCModifierKind ModKind)
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
OpenACCModifierKind getModifierList() const
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)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
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 * 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 * 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 * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
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 * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, 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 * 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.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
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)
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 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.
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
void ActOnStartStmtExpr()
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:
QualType CheckTemplateIdType(ElaboratedTypeKeyword Keyword, TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
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)
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)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
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)
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)
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.
QualType BuildMemberPointerType(QualType T, const CXXScopeSpec &SS, CXXRecordDecl *Cls, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
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...
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)
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.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
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.
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
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 BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
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 ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
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 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)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
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)
Represents an expression that computes the length of a parameter pack.
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone 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
Represents the result of substituting a builtin template as a pack.
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void addArgument(const TemplateArgumentLoc &Loc)
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
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() 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.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
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.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
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.
NestedNameSpecifier getQualifier() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
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.
TypeLocClass getTypeLocClass() const
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.
The base class of the type hierarchy.
bool isSignableType(const ASTContext &Ctx) const
bool isPointerType() const
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
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
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.
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 ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
The JSON file list parser is used to communicate input to InstallAPI.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
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.
@ 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.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ 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.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Detach
'detach' clause, allowed on the 'exit data' construct.
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.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
@ 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.
@ Template
We are parsing a template declaration.
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)
@ Keyword
The name has been typo-corrected to a keyword.
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
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
OpenMPNumThreadsClauseModifier
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.
@ 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
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
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.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions