13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
47#include "llvm/ADT/ArrayRef.h"
48#include "llvm/Support/ErrorHandling.h"
52using namespace llvm::omp;
108template<
typename Derived>
113 class ForgetPartiallySubstitutedPackRAII {
118 ForgetPartiallySubstitutedPackRAII(Derived &Self) : Self(Self) {
119 Old = Self.ForgetPartiallySubstitutedPack();
122 ~ForgetPartiallySubstitutedPackRAII() {
123 Self.RememberPartiallySubstitutedPack(Old);
140 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
144 return static_cast<const Derived&
>(*this);
209 OldLocation = Self.getDerived().getBaseLocation();
210 OldEntity = Self.getDerived().getBaseEntity();
213 Self.getDerived().setBase(Location, Entity);
217 Self.getDerived().setBase(OldLocation, OldEntity);
247 return E->isDefaultArgument();
290 bool &ShouldExpand,
bool &RetainExpansion,
291 std::optional<unsigned> &NumExpansions) {
292 ShouldExpand =
false;
407 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
408#include "clang/Basic/AttrList.inc"
418 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
419 const X##Attr *A) { \
420 return getDerived().Transform##X##Attr(A); \
422#include "clang/Basic/AttrList.inc"
468 bool *ArgChanged =
nullptr);
477 llvm::DenseMap<Decl *, Decl *>::iterator Known
480 return Known->second;
508 assert(New.size() == 1 &&
509 "must override transformedLocalDecl if performing pack expansion");
547 NamedDecl *FirstQualifierInScope =
nullptr);
592 NamedDecl *FirstQualifierInScope =
nullptr,
593 bool AllowInjectedClassName =
false);
605 bool Uneval =
false);
628 bool Uneval =
false) {
647 template<
typename InputIterator>
651 bool Uneval =
false);
663#define ABSTRACT_TYPELOC(CLASS, PARENT)
664#define TYPELOC(CLASS, PARENT) \
665 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
666#include "clang/AST/TypeLocNodes.def"
670 bool SuppressObjCLifetime);
674 bool SuppressObjCLifetime);
676 template<
typename Fn>
683 template <
typename Fn>
685 Fn TransformModifiedType);
733 return getDerived().TransformFunctionTypeParams(
734 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
752 KWLoc, Params,
nullptr,
753 nullptr, PTypes, &TransParams, PInfos))
766 std::optional<unsigned> NumExpansions,
767 bool ExpectParameterPack);
794 bool IsAddressOfOperand,
802 bool IsAddressOfOperand);
810#define STMT(Node, Parent) \
811 LLVM_ATTRIBUTE_NOINLINE \
812 StmtResult Transform##Node(Node *S);
813#define VALUESTMT(Node, Parent) \
814 LLVM_ATTRIBUTE_NOINLINE \
815 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
816#define EXPR(Node, Parent) \
817 LLVM_ATTRIBUTE_NOINLINE \
818 ExprResult Transform##Node(Node *E);
819#define ABSTRACT_STMT(Stmt)
820#include "clang/AST/StmtNodes.inc"
822#define GEN_CLANG_CLAUSE_CLASS
823#define CLAUSE_CLASS(Enum, Str, Class) \
824 LLVM_ATTRIBUTE_NOINLINE \
825 OMPClause *Transform##Class(Class *S);
826#include "llvm/Frontend/OpenMP/OMP.inc"
903 const llvm::APInt *Size,
Expr *SizeExpr,
904 unsigned IndexTypeQuals,
SourceRange BracketsRange);
913 const llvm::APInt &Size,
Expr *SizeExpr,
914 unsigned IndexTypeQuals,
924 unsigned IndexTypeQuals,
934 unsigned IndexTypeQuals,
945 unsigned IndexTypeQuals,
983 unsigned NumColumns);
1000 Expr *AddrSpaceExpr,
1070 bool FullySubstituted,
1084 TypeConstraintConcept,
1085 TypeConstraintArgs);
1093 Template, Deduced,
false);
1139 bool AllowInjectedClassName) {
1143 SS.
Adopt(QualifierLoc);
1145 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1146 AllowInjectedClassName);
1160 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1177 bool DeducedTSTContext) {
1179 SS.
Adopt(QualifierLoc);
1192 *
Id, IdLoc, DeducedTSTContext);
1210 switch (
Result.getResultKind()) {
1221 llvm_unreachable(
"Tag lookup cannot find non-tags");
1233 switch (
Result.getResultKind()) {
1239 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1240 << SomeDecl << NTK << llvm::to_underlying(Kind);
1246 << llvm::to_underlying(Kind) <<
Id << DC
1255 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1256 SemaRef.
Diag(Tag->getLocation(), diag::note_previous_use);
1273 std::optional<unsigned> NumExpansions) {
1318 bool AllowInjectedClassName);
1331 bool AllowInjectedClassName);
1341 Decl *AssociatedDecl,
unsigned Index,
1344 ArgPack, AssociatedDecl, Index, Final);
1422 Then, ElseLoc, Else);
1476 Inc, RParenLoc, Body);
1521 bool IsVolatile,
unsigned NumOutputs,
1528 NumInputs, Names, Constraints, Exprs,
1529 AsmString, Clobbers, NumLabels, RParenLoc);
1538 StringRef AsmString,
1539 unsigned NumOutputs,
unsigned NumInputs,
1545 NumOutputs, NumInputs,
1546 Constraints, Clobbers, Exprs, EndLoc);
1575 CoawaitLoc, Operand, OpCoawaitLookup);
1579 Suspend.
get(),
true);
1680 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1692 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1706 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1808 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1821 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1834 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1885 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1912 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1913 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1927 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1928 ReductionId, UnresolvedReductions);
1943 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1944 ReductionId, UnresolvedReductions);
1957 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1958 StepModifierLoc, EndLoc);
1971 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2031 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2044 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2059 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2060 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2061 ColonLoc, VarList, Locs,
2062 false, UnresolvedMappers);
2075 Allocate, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2123 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2136 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2171 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2186 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2187 ColonLoc, VarList, Locs, UnresolvedMappers);
2202 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2203 ColonLoc, VarList, Locs, UnresolvedMappers);
2254 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2301 StartLoc, LParenLoc, EndLoc,
Data);
2314 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2326 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2339 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2350 LParenLoc, VarLoc, EndLoc);
2362 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2501 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2549 ForLoc, Element, Collection, RParenLoc);
2567 StartLoc, IdLoc,
Id);
2605 if (RangeStmt->isSingleDecl()) {
2606 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2607 if (RangeVar->isInvalidDecl())
2610 Expr *RangeExpr = RangeVar->getInit();
2617 diag::err_objc_for_range_init_stmt)
2618 <<
Init->getSourceRange();
2621 ForLoc, LoopVar, RangeExpr, RParenLoc);
2628 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2642 QualifierLoc, NameInfo, Nested);
2704 SS.
Adopt(QualifierLoc);
2816 if (IsOMPArraySection)
2818 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2819 Stride, RBracketLoc);
2821 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2822 "Stride/second colon not allowed for OpenACC");
2825 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2837 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2849 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2859 Expr *ExecConfig =
nullptr) {
2861 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2868 nullptr, Callee, LParenLoc, Args, RParenLoc);
2886 if (!
Member->getDeclName()) {
2890 assert(
Member->getType()->isRecordType() &&
2891 "unnamed member not of record type?");
2904 if (!isArrow &&
Base->isPRValue()) {
2913 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2919 SS.
Adopt(QualifierLoc);
2922 if (
Base->containsErrors())
2936 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2937 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2938 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2941 ->getAsCXXRecordDecl()) {
2942 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2945 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2953 FirstQualifierInScope,
2954 R, ExplicitTemplateArgs,
3132 Expr *ControllingExpr,
3137 ControllingExpr, Types, Exprs);
3152 ControllingType, Types, Exprs);
3185 case Stmt::CXXStaticCastExprClass:
3186 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3187 RAngleLoc, LParenLoc,
3188 SubExpr, RParenLoc);
3190 case Stmt::CXXDynamicCastExprClass:
3191 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3192 RAngleLoc, LParenLoc,
3193 SubExpr, RParenLoc);
3195 case Stmt::CXXReinterpretCastExprClass:
3196 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3197 RAngleLoc, LParenLoc,
3201 case Stmt::CXXConstCastExprClass:
3202 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3203 RAngleLoc, LParenLoc,
3204 SubExpr, RParenLoc);
3206 case Stmt::CXXAddrspaceCastExprClass:
3207 return getDerived().RebuildCXXAddrspaceCastExpr(
3208 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3211 llvm_unreachable(
"Invalid C++ named cast");
3289 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3301 bool ListInitialization) {
3305 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3307 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3308 RParenLoc, ListInitialization);
3311 ListInitialization);
3375 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3385 bool IsThrownVariableInScope) {
3395 Expr *RewrittenExpr) {
3397 RewrittenExpr,
getSema().CurContext);
3432 std::optional<Expr *> ArraySize,
3451 bool IsGlobalDelete,
3502 bool IsAddressOfOperand,
3505 SS.
Adopt(QualifierLoc);
3507 if (TemplateArgs || TemplateKWLoc.
isValid())
3509 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3512 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3534 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3535 bool ListInitialization,
bool StdInitListInitialization,
3541 if (Constructor->isInheritingConstructor())
3542 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3545 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3552 HadMultipleCandidates,
3554 StdInitListInitialization,
3555 RequiresZeroInit, ConstructKind,
3563 bool ConstructsVBase,
3564 bool InheritedFromVBase) {
3566 Loc,
T, Constructor, ConstructsVBase, InheritedFromVBase);
3577 bool ListInitialization) {
3579 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3590 bool ListInitialization) {
3592 RParenLoc, ListInitialization);
3609 SS.
Adopt(QualifierLoc);
3612 OperatorLoc, IsArrow,
3614 FirstQualifierInScope,
3616 TemplateArgs,
nullptr);
3632 SS.
Adopt(QualifierLoc);
3635 OperatorLoc, IsArrow,
3637 FirstQualifierInScope,
3638 R, TemplateArgs,
nullptr);
3653 std::optional<unsigned> Length,
3656 RParenLoc, Length, PartialArgs);
3661 Expr *PackIdExpression,
Expr *IndexExpr,
3663 bool EmptyPack =
false) {
3665 IndexExpr, RSquareLoc, ExpandedExprs,
3695 NamedConcept, TALI);
3713 LocalParameters, RParenLoc, Requirements,
3767 Expr **Elements,
unsigned NumElements) {
3777 RB,
Base, Key, getterMethod, setterMethod);
3809 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3824 Sel, Method, LBracLoc,
3825 SelectorLocs, RBracLoc, Args);
3839 nullptr, SuperType, SuperLoc, Sel, Method, LBracLoc,
3840 SelectorLocs, RBracLoc, Args)
3842 Sel, Method, LBracLoc,
3843 SelectorLocs, RBracLoc, Args);
3852 bool IsArrow,
bool IsFreeIvar) {
3861 if (IsFreeIvar &&
Result.isUsable())
3862 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3898 PropertyLoc,
Base));
3930 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3939 CK_BuiltinFnToFnPtr).
get();
3965 std::optional<unsigned> NumExpansions) {
3970 EllipsisLoc, NumExpansions);
3992 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4013 std::optional<unsigned> NumExpansions) {
4026 std::optional<unsigned> NumExpansions) {
4028 EllipsisLoc, RHS, RParenLoc,
4037 Init->containsUnexpandedParameterPack();
4038 else if (PVD->hasUninstantiatedDefaultArg())
4040 PVD->getUninstantiatedDefaultArg()
4041 ->containsUnexpandedParameterPack();
4081 EndLoc, Clauses, StrBlock);
4110 bool DeducibleTSTContext);
4122template <
typename Derived>
4127 switch (S->getStmtClass()) {
4132#define STMT(Node, Parent) \
4133 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4134#define VALUESTMT(Node, Parent) \
4135 case Stmt::Node##Class: \
4136 return getDerived().Transform##Node(cast<Node>(S), SDK);
4137#define ABSTRACT_STMT(Node)
4138#define EXPR(Node, Parent)
4139#include "clang/AST/StmtNodes.inc"
4142#define STMT(Node, Parent)
4143#define ABSTRACT_STMT(Stmt)
4144#define EXPR(Node, Parent) case Stmt::Node##Class:
4145#include "clang/AST/StmtNodes.inc"
4147 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4149 if (SDK == SDK_StmtExprResult)
4150 E = getSema().ActOnStmtExprResult(
E);
4151 return getSema().ActOnExprStmt(
E, SDK == SDK_Discarded);
4158template<
typename Derived>
4163 switch (S->getClauseKind()) {
4166#define GEN_CLANG_CLAUSE_CLASS
4167#define CLAUSE_CLASS(Enum, Str, Class) \
4169 return getDerived().Transform##Class(cast<Class>(S));
4170#include "llvm/Frontend/OpenMP/OMP.inc"
4177template<
typename Derived>
4184#define STMT(Node, Parent) case Stmt::Node##Class: break;
4185#define ABSTRACT_STMT(Stmt)
4186#define EXPR(Node, Parent) \
4187 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4188#include "clang/AST/StmtNodes.inc"
4194template<
typename Derived>
4202 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4203 Init = FE->getSubExpr();
4205 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4211 Init = MTE->getSubExpr();
4214 Init = Binder->getSubExpr();
4217 Init = ICE->getSubExprAsWritten();
4220 dyn_cast<CXXStdInitializerListExpr>(
Init))
4221 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4228 return getDerived().TransformExpr(
Init);
4233 return getDerived().RebuildParenListExpr(
Parens.getBegin(), std::nullopt,
4238 if (isa<ImplicitValueInitExpr>(
Init))
4239 return getDerived().RebuildParenListExpr(
SourceLocation(), std::nullopt,
4244 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4245 return getDerived().TransformExpr(
Init);
4250 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4257 getSema().keepInLifetimeExtendingContext();
4259 bool ArgChanged =
false;
4261 true, NewArgs, &ArgChanged))
4266 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4271 if (
Parens.isInvalid()) {
4274 assert(NewArgs.empty() &&
4275 "no parens or braces but have direct init with arguments?");
4278 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4282template<
typename Derived>
4288 for (
unsigned I = 0; I != NumInputs; ++I) {
4290 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4298 Expr *Pattern = Expansion->getPattern();
4301 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4302 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4307 bool RetainExpansion =
false;
4308 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4309 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4310 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4313 Expand, RetainExpansion,
4322 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4326 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4327 Expansion->getEllipsisLoc(),
4329 if (Out.isInvalid())
4334 Outputs.push_back(Out.get());
4340 if (ArgChanged) *ArgChanged =
true;
4344 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4346 ExprResult Out = getDerived().TransformExpr(Pattern);
4347 if (Out.isInvalid())
4350 if (Out.get()->containsUnexpandedParameterPack()) {
4351 Out = getDerived().RebuildPackExpansion(
4352 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4353 if (Out.isInvalid())
4357 Outputs.push_back(Out.get());
4362 if (RetainExpansion) {
4363 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4365 ExprResult Out = getDerived().TransformExpr(Pattern);
4366 if (Out.isInvalid())
4369 Out = getDerived().RebuildPackExpansion(
4370 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4371 if (Out.isInvalid())
4374 Outputs.push_back(Out.get());
4381 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4382 : getDerived().TransformExpr(Inputs[I]);
4386 if (
Result.get() != Inputs[I] && ArgChanged)
4389 Outputs.push_back(
Result.get());
4395template <
typename Derived>
4399 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4400 getDerived().TransformDefinition(Var->
getLocation(), Var));
4405 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4414 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4421template <
typename Derived>
4429 Qualifier = Qualifier.getPrefix())
4445 SS, FirstQualifierInScope,
false))
4452 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4460 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4475 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4484 FirstQualifierInScope, SS);
4494 diag::warn_cxx98_compat_enum_nested_name_spec);
4497 SS.
Adopt(ETL.getQualifierLoc());
4498 TL = ETL.getNamedTypeLoc();
4517 FirstQualifierInScope =
nullptr;
4523 !getDerived().AlwaysRebuild())
4536template<
typename Derived>
4544 switch (Name.getNameKind()) {
4555 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4556 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4557 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4573 NewTInfo = getDerived().TransformType(OldTInfo);
4581 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4597 llvm_unreachable(
"Unknown name kind.");
4600template<
typename Derived>
4607 bool AllowInjectedClassName) {
4609 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4610 assert(Template &&
"qualified template name must refer to a template");
4613 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4618 if (!getDerived().AlwaysRebuild() &&
4620 TransTemplate == Template)
4623 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4631 FirstQualifierInScope =
nullptr;
4634 if (!getDerived().AlwaysRebuild() &&
4642 if (DTN->isIdentifier()) {
4643 return getDerived().RebuildTemplateName(SS,
4645 *DTN->getIdentifier(),
4648 FirstQualifierInScope,
4649 AllowInjectedClassName);
4652 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4653 DTN->getOperator(), NameLoc,
4654 ObjectType, AllowInjectedClassName);
4658 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4660 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4665 return getDerived().RebuildTemplateName(SS,
false,
4670 = Name.getAsSubstTemplateTemplateParmPack()) {
4671 return getDerived().RebuildTemplateName(
4672 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4673 SubstPack->getIndex(), SubstPack->getFinal());
4677 llvm_unreachable(
"overloaded function decl survived to here");
4680template<
typename Derived>
4684 Output = getSema().getTrivialTemplateArgumentLoc(
4685 Arg,
QualType(), getDerived().getBaseLocation());
4688template <
typename Derived>
4696 llvm_unreachable(
"Unexpected TemplateArgument");
4706 QualType NewT = getDerived().TransformType(
T);
4713 ValueDecl *NewD =
D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4714 getDerived().getBaseLocation(),
D))
4719 if (NewT ==
T &&
D == NewD)
4736 llvm_unreachable(
"unexpected template argument kind");
4746 DI = getDerived().TransformType(DI);
4757 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4763 SS.
Adopt(QualifierLoc);
4764 TemplateName Template = getDerived().TransformTemplateName(
4775 llvm_unreachable(
"Caller should expand pack expansions");
4790 ExprResult E = getDerived().TransformExpr(InputExpr);
4805template<
typename Derived,
typename InputIterator>
4813 typedef typename std::iterator_traits<InputIterator>::difference_type
4843 Self.InventTemplateArgumentLoc(*
Iter,
Result);
4851 return X.Iter == Y.Iter;
4856 return X.Iter != Y.Iter;
4860template<
typename Derived>
4861template<
typename InputIterator>
4878 if (TransformTemplateArguments(PackLocIterator(*
this,
4879 In.getArgument().pack_begin()),
4880 PackLocIterator(*
this,
4881 In.getArgument().pack_end()),
4888 if (In.getArgument().isPackExpansion()) {
4892 std::optional<unsigned> OrigNumExpansions;
4894 = getSema().getTemplateArgumentPackExpansionPattern(
4895 In, Ellipsis, OrigNumExpansions);
4898 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4899 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4904 bool RetainExpansion =
false;
4905 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4906 if (getDerived().TryExpandParameterPacks(Ellipsis,
4920 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
4923 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
4925 if (Out.getArgument().isNull())
4934 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4937 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4940 if (Out.getArgument().containsUnexpandedParameterPack()) {
4941 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4943 if (Out.getArgument().isNull())
4952 if (RetainExpansion) {
4953 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4955 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4958 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4960 if (Out.getArgument().isNull())
4970 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
4984template<
typename Derived>
4986 if (getDerived().AlreadyTransformed(
T))
4992 getDerived().getBaseLocation());
5002template<
typename Derived>
5006 getDerived().getBaseEntity());
5007 if (getDerived().AlreadyTransformed(DI->
getType()))
5022template<
typename Derived>
5025 switch (
T.getTypeLocClass()) {
5026#define ABSTRACT_TYPELOC(CLASS, PARENT)
5027#define TYPELOC(CLASS, PARENT) \
5028 case TypeLoc::CLASS: \
5029 return getDerived().Transform##CLASS##Type(TLB, \
5030 T.castAs<CLASS##TypeLoc>());
5031#include "clang/AST/TypeLocNodes.def"
5034 llvm_unreachable(
"unhandled type loc!");
5037template<
typename Derived>
5039 if (!isa<DependentNameType>(
T))
5040 return TransformType(
T);
5042 if (getDerived().AlreadyTransformed(
T))
5045 getDerived().getBaseLocation());
5046 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5050template<
typename Derived>
5053 if (!isa<DependentNameType>(DI->
getType()))
5054 return TransformType(DI);
5058 getDerived().getBaseEntity());
5059 if (getDerived().AlreadyTransformed(DI->
getType()))
5079 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5088template<
typename Derived>
5093 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5094 auto SuppressObjCLifetime =
5095 T.getType().getLocalQualifiers().hasObjCLifetime();
5097 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5098 SuppressObjCLifetime);
5099 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5100 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5101 TLB, STTP, SuppressObjCLifetime);
5103 Result = getDerived().TransformType(TLB, UnqualTL);
5122template <
typename Derived>
5132 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5163 else if (
T.getObjCLifetime()) {
5168 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5184 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5193template<
typename Derived>
5199 if (getDerived().AlreadyTransformed(TL.
getType()))
5203 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5209template<
typename Derived>
5211TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5212 QualType ObjectType,
5213 NamedDecl *UnqualLookup,
5215 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5218 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5222template <
typename Derived>
5223TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5224 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5226 QualType
T = TL.getType();
5227 assert(!getDerived().AlreadyTransformed(
T));
5232 if (isa<TemplateSpecializationType>(
T)) {
5233 TemplateSpecializationTypeLoc SpecTL =
5234 TL.castAs<TemplateSpecializationTypeLoc>();
5236 TemplateName Template = getDerived().TransformTemplateName(
5237 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5238 ObjectType, UnqualLookup,
true);
5239 if (Template.isNull())
5242 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5244 }
else if (isa<DependentTemplateSpecializationType>(
T)) {
5245 DependentTemplateSpecializationTypeLoc SpecTL =
5246 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5248 TemplateName Template
5249 = getDerived().RebuildTemplateName(SS,
5250 SpecTL.getTemplateKeywordLoc(),
5251 *SpecTL.getTypePtr()->getIdentifier(),
5252 SpecTL.getTemplateNameLoc(),
5253 ObjectType, UnqualLookup,
5255 if (Template.isNull())
5258 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5264 Result = getDerived().TransformType(TLB, TL);
5273template <
class TyLoc>
static inline
5275 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5276 NewT.setNameLoc(
T.getNameLoc());
5280template<
typename Derived>
5281QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5283 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5284 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5285 if (
T.needsExtraLocalData())
5286 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5290template<
typename Derived>
5291QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5297template <
typename Derived>
5298QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5299 AdjustedTypeLoc TL) {
5301 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5304template<
typename Derived>
5305QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5306 DecayedTypeLoc TL) {
5307 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5308 if (OriginalType.isNull())
5311 QualType
Result = TL.getType();
5312 if (getDerived().AlwaysRebuild() ||
5313 OriginalType != TL.getOriginalLoc().getType())
5315 TLB.push<DecayedTypeLoc>(
Result);
5320template <
typename Derived>
5322TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5323 ArrayParameterTypeLoc TL) {
5324 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5325 if (OriginalType.isNull())
5328 QualType
Result = TL.getType();
5329 if (getDerived().AlwaysRebuild() ||
5330 OriginalType != TL.getElementLoc().getType())
5332 TLB.push<ArrayParameterTypeLoc>(
Result);
5337template<
typename Derived>
5338QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5339 PointerTypeLoc TL) {
5340 QualType PointeeType
5341 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5342 if (PointeeType.isNull())
5345 QualType
Result = TL.getType();
5346 if (PointeeType->getAs<ObjCObjectType>()) {
5353 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5354 NewT.setStarLoc(TL.getStarLoc());
5358 if (getDerived().AlwaysRebuild() ||
5359 PointeeType != TL.getPointeeLoc().getType()) {
5360 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5367 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5369 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5370 NewT.setSigilLoc(TL.getSigilLoc());
5374template<
typename Derived>
5376TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5377 BlockPointerTypeLoc TL) {
5378 QualType PointeeType
5379 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5380 if (PointeeType.isNull())
5383 QualType
Result = TL.getType();
5384 if (getDerived().AlwaysRebuild() ||
5385 PointeeType != TL.getPointeeLoc().getType()) {
5386 Result = getDerived().RebuildBlockPointerType(PointeeType,
5392 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5393 NewT.setSigilLoc(TL.getSigilLoc());
5401template<
typename Derived>
5409 if (PointeeType.
isNull())
5413 if (getDerived().AlwaysRebuild() ||
5414 PointeeType !=
T->getPointeeTypeAsWritten()) {
5415 Result = getDerived().RebuildReferenceType(PointeeType,
5416 T->isSpelledAsLValue(),
5429 if (isa<LValueReferenceType>(
Result))
5438template<
typename Derived>
5442 return TransformReferenceType(TLB, TL);
5445template<
typename Derived>
5447TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5448 RValueReferenceTypeLoc TL) {
5449 return TransformReferenceType(TLB, TL);
5452template<
typename Derived>
5454TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5455 MemberPointerTypeLoc TL) {
5456 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5457 if (PointeeType.isNull())
5460 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5461 TypeSourceInfo *NewClsTInfo =
nullptr;
5463 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5468 const MemberPointerType *
T = TL.getTypePtr();
5469 QualType OldClsType = QualType(
T->getClass(), 0);
5470 QualType NewClsType;
5472 NewClsType = NewClsTInfo->getType();
5474 NewClsType = getDerived().TransformType(OldClsType);
5475 if (NewClsType.isNull())
5479 QualType
Result = TL.getType();
5480 if (getDerived().AlwaysRebuild() ||
5482 NewClsType != OldClsType) {
5483 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5491 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5492 if (MPT && PointeeType != MPT->getPointeeType()) {
5493 assert(isa<AdjustedType>(MPT->getPointeeType()));
5494 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5497 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5498 NewTL.setSigilLoc(TL.getSigilLoc());
5499 NewTL.setClassTInfo(NewClsTInfo);
5504template<
typename Derived>
5506TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5507 ConstantArrayTypeLoc TL) {
5508 const ConstantArrayType *
T = TL.getTypePtr();
5509 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5510 if (ElementType.isNull())
5514 Expr *
OldSize = TL.getSizeExpr();
5516 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5517 Expr *NewSize =
nullptr;
5521 NewSize = getDerived().TransformExpr(
OldSize).template getAs<Expr>();
5525 QualType
Result = TL.getType();
5526 if (getDerived().AlwaysRebuild() ||
5527 ElementType !=
T->getElementType() ||
5528 (
T->getSizeExpr() && NewSize !=
OldSize)) {
5529 Result = getDerived().RebuildConstantArrayType(ElementType,
5530 T->getSizeModifier(),
5531 T->getSize(), NewSize,
5532 T->getIndexTypeCVRQualifiers(),
5533 TL.getBracketsRange());
5542 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5543 NewTL.setLBracketLoc(TL.getLBracketLoc());
5544 NewTL.setRBracketLoc(TL.getRBracketLoc());
5545 NewTL.setSizeExpr(NewSize);
5550template<
typename Derived>
5551QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5552 TypeLocBuilder &TLB,
5553 IncompleteArrayTypeLoc TL) {
5554 const IncompleteArrayType *
T = TL.getTypePtr();
5555 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5556 if (ElementType.isNull())
5559 QualType
Result = TL.getType();
5560 if (getDerived().AlwaysRebuild() ||
5561 ElementType !=
T->getElementType()) {
5562 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5563 T->getSizeModifier(),
5564 T->getIndexTypeCVRQualifiers(),
5565 TL.getBracketsRange());
5570 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5571 NewTL.setLBracketLoc(TL.getLBracketLoc());
5572 NewTL.setRBracketLoc(TL.getRBracketLoc());
5573 NewTL.setSizeExpr(
nullptr);
5578template<
typename Derived>
5580TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5581 VariableArrayTypeLoc TL) {
5582 const VariableArrayType *
T = TL.getTypePtr();
5583 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5584 if (ElementType.isNull())
5589 EnterExpressionEvaluationContext Context(
5591 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5593 if (SizeResult.isInvalid())
5597 if (SizeResult.isInvalid())
5600 Expr *
Size = SizeResult.get();
5602 QualType
Result = TL.getType();
5603 if (getDerived().AlwaysRebuild() ||
5604 ElementType !=
T->getElementType() ||
5605 Size !=
T->getSizeExpr()) {
5606 Result = getDerived().RebuildVariableArrayType(ElementType,
5607 T->getSizeModifier(),
5609 T->getIndexTypeCVRQualifiers(),
5610 TL.getBracketsRange());
5617 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5618 NewTL.setLBracketLoc(TL.getLBracketLoc());
5619 NewTL.setRBracketLoc(TL.getRBracketLoc());
5620 NewTL.setSizeExpr(Size);
5625template<
typename Derived>
5627TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5628 DependentSizedArrayTypeLoc TL) {
5629 const DependentSizedArrayType *
T = TL.getTypePtr();
5630 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5631 if (ElementType.isNull())
5639 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5642 Expr *origSize = TL.getSizeExpr();
5643 if (!origSize) origSize =
T->getSizeExpr();
5646 = getDerived().TransformExpr(origSize);
5648 if (sizeResult.isInvalid())
5651 Expr *size = sizeResult.get();
5653 QualType
Result = TL.getType();
5654 if (getDerived().AlwaysRebuild() ||
5655 ElementType !=
T->getElementType() ||
5657 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5658 T->getSizeModifier(),
5660 T->getIndexTypeCVRQualifiers(),
5661 TL.getBracketsRange());
5668 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5669 NewTL.setLBracketLoc(TL.getLBracketLoc());
5670 NewTL.setRBracketLoc(TL.getRBracketLoc());
5671 NewTL.setSizeExpr(size);
5676template <
typename Derived>
5677QualType TreeTransform<Derived>::TransformDependentVectorType(
5678 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5679 const DependentVectorType *
T = TL.getTypePtr();
5680 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5681 if (ElementType.isNull())
5689 if (
Size.isInvalid())
5692 QualType
Result = TL.getType();
5693 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5694 Size.get() !=
T->getSizeExpr()) {
5695 Result = getDerived().RebuildDependentVectorType(
5696 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5702 if (isa<DependentVectorType>(
Result)) {
5703 DependentVectorTypeLoc NewTL =
5704 TLB.push<DependentVectorTypeLoc>(
Result);
5705 NewTL.setNameLoc(TL.getNameLoc());
5707 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5708 NewTL.setNameLoc(TL.getNameLoc());
5714template<
typename Derived>
5715QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5716 TypeLocBuilder &TLB,
5717 DependentSizedExtVectorTypeLoc TL) {
5718 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5721 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5722 if (ElementType.isNull())
5731 if (
Size.isInvalid())
5734 QualType
Result = TL.getType();
5735 if (getDerived().AlwaysRebuild() ||
5736 ElementType !=
T->getElementType() ||
5737 Size.get() !=
T->getSizeExpr()) {
5738 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5740 T->getAttributeLoc());
5746 if (isa<DependentSizedExtVectorType>(
Result)) {
5747 DependentSizedExtVectorTypeLoc NewTL
5748 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5749 NewTL.setNameLoc(TL.getNameLoc());
5751 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5752 NewTL.setNameLoc(TL.getNameLoc());
5758template <
typename Derived>
5760TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5761 ConstantMatrixTypeLoc TL) {
5762 const ConstantMatrixType *
T = TL.getTypePtr();
5763 QualType ElementType = getDerived().TransformType(
T->getElementType());
5764 if (ElementType.isNull())
5767 QualType
Result = TL.getType();
5768 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
5769 Result = getDerived().RebuildConstantMatrixType(
5770 ElementType,
T->getNumRows(),
T->getNumColumns());
5775 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5776 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5777 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5778 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5779 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5784template <
typename Derived>
5785QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5786 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5787 const DependentSizedMatrixType *
T = TL.getTypePtr();
5789 QualType ElementType = getDerived().TransformType(
T->getElementType());
5790 if (ElementType.isNull()) {
5798 Expr *origRows = TL.getAttrRowOperand();
5800 origRows =
T->getRowExpr();
5801 Expr *origColumns = TL.getAttrColumnOperand();
5803 origColumns =
T->getColumnExpr();
5805 ExprResult rowResult = getDerived().TransformExpr(origRows);
5807 if (rowResult.isInvalid())
5810 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5812 if (columnResult.isInvalid())
5815 Expr *rows = rowResult.get();
5816 Expr *columns = columnResult.get();
5818 QualType
Result = TL.getType();
5819 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5820 rows != origRows || columns != origColumns) {
5821 Result = getDerived().RebuildDependentSizedMatrixType(
5822 ElementType, rows, columns,
T->getAttributeLoc());
5830 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5831 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5832 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5833 NewTL.setAttrRowOperand(rows);
5834 NewTL.setAttrColumnOperand(columns);
5838template <
typename Derived>
5839QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5840 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5841 const DependentAddressSpaceType *
T = TL.getTypePtr();
5843 QualType pointeeType =
5844 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
5846 if (pointeeType.isNull())
5853 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
5855 if (AddrSpace.isInvalid())
5858 QualType
Result = TL.getType();
5859 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
5860 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
5861 Result = getDerived().RebuildDependentAddressSpaceType(
5862 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
5868 if (isa<DependentAddressSpaceType>(
Result)) {
5869 DependentAddressSpaceTypeLoc NewTL =
5870 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
5872 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5873 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
5874 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5877 TLB.TypeWasModifiedSafely(
Result);
5883template <
typename Derived>
5884QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
5886 const VectorType *
T = TL.getTypePtr();
5887 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5888 if (ElementType.isNull())
5891 QualType
Result = TL.getType();
5892 if (getDerived().AlwaysRebuild() ||
5893 ElementType !=
T->getElementType()) {
5894 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
5895 T->getVectorKind());
5900 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5901 NewTL.setNameLoc(TL.getNameLoc());
5906template<
typename Derived>
5907QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
5908 ExtVectorTypeLoc TL) {
5909 const VectorType *
T = TL.getTypePtr();
5910 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5911 if (ElementType.isNull())
5914 QualType
Result = TL.getType();
5915 if (getDerived().AlwaysRebuild() ||
5916 ElementType !=
T->getElementType()) {
5917 Result = getDerived().RebuildExtVectorType(ElementType,
5918 T->getNumElements(),
5924 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5925 NewTL.setNameLoc(TL.getNameLoc());
5930template <
typename Derived>
5933 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
5937 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
5964 NewDI = getDerived().TransformType(OldDI);
5968 if (NewDI == OldDI && indexAdjustment == 0)
5982 transformedLocalDecl(OldParm, {newParm});
5986template <
typename Derived>
5994 unsigned *LastParamTransformed) {
5995 int indexAdjustment = 0;
5997 unsigned NumParams = Params.size();
5998 for (
unsigned i = 0; i != NumParams; ++i) {
5999 if (LastParamTransformed)
6000 *LastParamTransformed = i;
6002 assert(OldParm->getFunctionScopeIndex() == i);
6004 std::optional<unsigned> NumExpansions;
6006 if (OldParm->isParameterPack()) {
6011 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6017 bool ShouldExpand =
false;
6018 bool RetainExpansion =
false;
6019 std::optional<unsigned> OrigNumExpansions;
6020 if (Unexpanded.size() > 0) {
6022 NumExpansions = OrigNumExpansions;
6023 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
6024 Pattern.getSourceRange(),
6036 "Could not find parameter packs or undeduced auto type!");
6043 getDerived().ExpandingFunctionParameterPack(OldParm);
6044 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6047 = getDerived().TransformFunctionTypeParam(OldParm,
6055 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6056 OutParamTypes.push_back(NewParm->
getType());
6058 PVars->push_back(NewParm);
6063 if (RetainExpansion) {
6064 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6066 = getDerived().TransformFunctionTypeParam(OldParm,
6074 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6075 OutParamTypes.push_back(NewParm->
getType());
6077 PVars->push_back(NewParm);
6093 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6098 "Parameter pack no longer a parameter pack after "
6101 NewParm = getDerived().TransformFunctionTypeParam(
6102 OldParm, indexAdjustment, std::nullopt,
6110 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6111 OutParamTypes.push_back(NewParm->
getType());
6113 PVars->push_back(NewParm);
6121 bool IsPackExpansion =
false;
6122 std::optional<unsigned> NumExpansions;
6125 = dyn_cast<PackExpansionType>(OldType)) {
6127 QualType Pattern = Expansion->getPattern();
6129 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6132 bool ShouldExpand =
false;
6133 bool RetainExpansion =
false;
6145 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6147 QualType NewType = getDerived().TransformType(Pattern);
6152 NewType = getSema().getASTContext().getPackExpansionType(
6153 NewType, std::nullopt);
6160 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6161 OutParamTypes.push_back(NewType);
6163 PVars->push_back(
nullptr);
6172 if (RetainExpansion) {
6173 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6174 QualType NewType = getDerived().TransformType(Pattern);
6179 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6180 OutParamTypes.push_back(NewType);
6182 PVars->push_back(
nullptr);
6187 OldType = Expansion->getPattern();
6188 IsPackExpansion =
true;
6190 NewType = getDerived().TransformType(OldType);
6192 NewType = getDerived().TransformType(OldType);
6198 if (IsPackExpansion)
6199 NewType = getSema().Context.getPackExpansionType(NewType,
6203 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6204 OutParamTypes.push_back(NewType);
6206 PVars->push_back(
nullptr);
6211 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6213 assert(parm->getFunctionScopeIndex() == i);
6220template<
typename Derived>
6225 return getDerived().TransformFunctionProtoType(
6228 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6229 ExceptionStorage, Changed);
6233template<
typename Derived>
template<
typename Fn>
6236 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6253 if (getDerived().TransformFunctionTypeParams(
6257 ParamTypes, &ParamDecls, ExtParamInfos))
6269 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6271 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6277 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6281 if (getDerived().TransformFunctionTypeParams(
6285 ParamTypes, &ParamDecls, ExtParamInfos))
6291 bool EPIChanged =
false;
6296 if (
auto NewExtParamInfos =
6312 std::optional<FunctionEffectSet> NewFX;
6321 ExprResult NewExpr = getDerived().TransformExpr(CondExpr);
6324 std::optional<FunctionEffectMode> Mode =
6344 "FunctionEffectMode::None shouldn't be possible here");
6350 NewFX->insert(NewEC, Errs);
6351 assert(Errs.empty());
6359 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6361 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6372 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6378template<
typename Derived>
6388 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6390 SemaRef, Method ? Method->getParent() :
nullptr,
6391 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6401 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6424 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6429 bool Expand =
false;
6430 bool RetainExpansion =
false;
6431 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6434 if (getDerived().TryExpandParameterPacks(
6436 RetainExpansion, NumExpansions))
6444 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6449 Exceptions.push_back(
U);
6455 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6458 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6462 Exceptions.push_back(
U);
6471 Exceptions.push_back(
U);
6481template<
typename Derived>
6491 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6492 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6503template <
typename Derived>
6504QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6505 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6506 const UnresolvedUsingType *
T = TL.getTypePtr();
6507 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6511 QualType
Result = TL.getType();
6512 if (getDerived().AlwaysRebuild() ||
D !=
T->getDecl()) {
6513 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(),
D);
6520 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6521 NewTL.setNameLoc(TL.getNameLoc());
6526template <
typename Derived>
6527QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6529 const UsingType *
T = TL.getTypePtr();
6531 auto *
Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6532 TL.getLocalSourceRange().getBegin(),
T->getFoundDecl()));
6536 QualType Underlying = getDerived().TransformType(
T->
desugar());
6537 if (Underlying.isNull())
6540 QualType
Result = TL.getType();
6541 if (getDerived().AlwaysRebuild() ||
Found !=
T->getFoundDecl() ||
6542 Underlying !=
T->getUnderlyingType()) {
6543 Result = getDerived().RebuildUsingType(
Found, Underlying);
6548 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6552template<
typename Derived>
6553QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6554 TypedefTypeLoc TL) {
6555 const TypedefType *
T = TL.getTypePtr();
6556 TypedefNameDecl *Typedef
6557 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6562 QualType
Result = TL.getType();
6563 if (getDerived().AlwaysRebuild() ||
6564 Typedef !=
T->getDecl()) {
6565 Result = getDerived().RebuildTypedefType(Typedef);
6570 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6571 NewTL.setNameLoc(TL.getNameLoc());
6576template<
typename Derived>
6577QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6578 TypeOfExprTypeLoc TL) {
6584 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6592 QualType
Result = TL.getType();
6594 if (getDerived().AlwaysRebuild() ||
E.get() != TL.getUnderlyingExpr()) {
6596 getDerived().RebuildTypeOfExprType(
E.get(), TL.getTypeofLoc(), Kind);
6601 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6602 NewTL.setTypeofLoc(TL.getTypeofLoc());
6603 NewTL.setLParenLoc(TL.getLParenLoc());
6604 NewTL.setRParenLoc(TL.getRParenLoc());
6609template<
typename Derived>
6610QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6612 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6613 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6617 QualType
Result = TL.getType();
6619 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6620 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6625 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6626 NewTL.setTypeofLoc(TL.getTypeofLoc());
6627 NewTL.setLParenLoc(TL.getLParenLoc());
6628 NewTL.setRParenLoc(TL.getRParenLoc());
6629 NewTL.setUnmodifiedTInfo(New_Under_TI);
6634template<
typename Derived>
6635QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6636 DecltypeTypeLoc TL) {
6637 const DecltypeType *
T = TL.getTypePtr();
6644 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6648 E = getSema().ActOnDecltypeExpression(
E.get());
6652 QualType
Result = TL.getType();
6653 if (getDerived().AlwaysRebuild() ||
6654 E.get() !=
T->getUnderlyingExpr()) {
6655 Result = getDerived().RebuildDecltypeType(
E.get(), TL.getDecltypeLoc());
6661 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6662 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6663 NewTL.setRParenLoc(TL.getRParenLoc());
6667template <
typename Derived>
6669TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6670 PackIndexingTypeLoc TL) {
6672 ExprResult IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6673 if (IndexExpr.isInvalid())
6675 QualType Pattern = TL.getPattern();
6677 const PackIndexingType *PIT = TL.getTypePtr();
6681 bool NotYetExpanded = Types.empty();
6682 bool FullySubstituted =
true;
6687 for (
const QualType &
T : Types) {
6689 QualType Transformed = getDerived().TransformType(
T);
6690 if (Transformed.isNull())
6692 SubtitutedTypes.push_back(Transformed);
6697 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
6698 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6701 bool ShouldExpand =
true;
6702 bool RetainExpansion =
false;
6703 std::optional<unsigned> OrigNumExpansions;
6704 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6705 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6706 Unexpanded, ShouldExpand,
6707 RetainExpansion, NumExpansions))
6709 if (!ShouldExpand) {
6710 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6713 TypeSourceInfo *TI =
6715 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6718 if (NotYetExpanded) {
6719 FullySubstituted =
false;
6720 QualType Out = getDerived().RebuildPackIndexingType(
6721 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6726 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6727 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6730 SubtitutedTypes.push_back(Pack);
6733 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6734 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6735 QualType Out = getDerived().TransformType(
T);
6738 SubtitutedTypes.push_back(Out);
6742 if (RetainExpansion) {
6743 FullySubstituted =
false;
6744 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6745 QualType Out = getDerived().TransformType(
T);
6748 SubtitutedTypes.push_back(Out);
6755 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6756 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6758 QualType Out = getDerived().RebuildPackIndexingType(
6759 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6760 FullySubstituted, SubtitutedTypes);
6764 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6765 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6769template<
typename Derived>
6770QualType TreeTransform<Derived>::TransformUnaryTransformType(
6771 TypeLocBuilder &TLB,
6772 UnaryTransformTypeLoc TL) {
6773 QualType
Result = TL.getType();
6774 if (
Result->isDependentType()) {
6775 const UnaryTransformType *
T = TL.getTypePtr();
6777 TypeSourceInfo *NewBaseTSI =
6778 getDerived().TransformType(TL.getUnderlyingTInfo());
6781 QualType NewBase = NewBaseTSI->getType();
6783 Result = getDerived().RebuildUnaryTransformType(NewBase,
6790 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6791 NewTL.setKWLoc(TL.getKWLoc());
6792 NewTL.setParensRange(TL.getParensRange());
6793 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6797template<
typename Derived>
6798QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6799 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6800 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
6803 TemplateName TemplateName = getDerived().TransformTemplateName(
6804 SS,
T->getTemplateName(), TL.getTemplateNameLoc());
6805 if (TemplateName.isNull())
6808 QualType OldDeduced =
T->getDeducedType();
6809 QualType NewDeduced;
6810 if (!OldDeduced.isNull()) {
6811 NewDeduced = getDerived().TransformType(OldDeduced);
6812 if (NewDeduced.isNull())
6816 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6817 TemplateName, NewDeduced);
6821 DeducedTemplateSpecializationTypeLoc NewTL =
6822 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6823 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6828template<
typename Derived>
6829QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6831 const RecordType *
T = TL.getTypePtr();
6833 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6838 QualType
Result = TL.getType();
6839 if (getDerived().AlwaysRebuild() ||
6846 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6847 NewTL.setNameLoc(TL.getNameLoc());
6852template<
typename Derived>
6853QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
6855 const EnumType *
T = TL.getTypePtr();
6857 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6862 QualType
Result = TL.getType();
6863 if (getDerived().AlwaysRebuild() ||
6864 Enum !=
T->getDecl()) {
6870 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
6871 NewTL.setNameLoc(TL.getNameLoc());
6876template<
typename Derived>
6877QualType TreeTransform<Derived>::TransformInjectedClassNameType(
6878 TypeLocBuilder &TLB,
6879 InjectedClassNameTypeLoc TL) {
6880 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
6881 TL.getTypePtr()->getDecl());
6882 if (!
D)
return QualType();
6885 TLB.pushTypeSpec(
T).setNameLoc(TL.getNameLoc());
6889template<
typename Derived>
6893 return getDerived().TransformTemplateTypeParmType(
6898template <
typename Derived>
6904template<
typename Derived>
6905QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
6906 TypeLocBuilder &TLB,
6907 SubstTemplateTypeParmTypeLoc TL) {
6908 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
6911 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
6916 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
6917 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
6918 if (Replacement.isNull())
6922 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex());
6925 SubstTemplateTypeParmTypeLoc NewTL
6926 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
6927 NewTL.setNameLoc(TL.getNameLoc());
6932template<
typename Derived>
6936 return getDerived().TransformSubstTemplateTypeParmPackType(
6940template <
typename Derived>
6946template<
typename Derived>
6956 = getDerived().TransformTemplateName(SS,
T->getTemplateName(),
6961 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
6964template<
typename Derived>
6972 if (getDerived().AlwaysRebuild() ||
6974 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
6979 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
6987template <
typename Derived>
6988QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
6990 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
6991 if (ValueType.isNull())
6994 QualType
Result = TL.getType();
6995 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
6996 const PipeType *PT =
Result->castAs<PipeType>();
6997 bool isReadPipe = PT->isReadOnly();
6998 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7003 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
7004 NewTL.setKWLoc(TL.getKWLoc());
7009template <
typename Derived>
7010QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
7012 const BitIntType *EIT = TL.getTypePtr();
7013 QualType
Result = TL.getType();
7015 if (getDerived().AlwaysRebuild()) {
7016 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7017 EIT->getNumBits(), TL.getNameLoc());
7022 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7023 NewTL.setNameLoc(TL.getNameLoc());
7027template <
typename Derived>
7028QualType TreeTransform<Derived>::TransformDependentBitIntType(
7029 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
7030 const DependentBitIntType *EIT = TL.getTypePtr();
7034 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7037 if (BitsExpr.isInvalid())
7040 QualType
Result = TL.getType();
7042 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7043 Result = getDerived().RebuildDependentBitIntType(
7044 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7050 if (isa<DependentBitIntType>(
Result)) {
7051 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
7052 NewTL.setNameLoc(TL.getNameLoc());
7054 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7055 NewTL.setNameLoc(TL.getNameLoc());
7065 template<
typename ArgLocContainer>
7067 ArgLocContainer *Container;
7092 : Container(&Container), Index(Index) { }
7106 return Container->getArgLoc(Index);
7110 return pointer(Container->getArgLoc(Index));
7115 return X.Container == Y.Container &&
X.Index == Y.Index;
7124template<
typename Derived>
7125QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7127 const AutoType *
T = TL.getTypePtr();
7128 QualType OldDeduced =
T->getDeducedType();
7129 QualType NewDeduced;
7130 if (!OldDeduced.isNull()) {
7131 NewDeduced = getDerived().TransformType(OldDeduced);
7132 if (NewDeduced.isNull())
7136 ConceptDecl *NewCD =
nullptr;
7137 TemplateArgumentListInfo NewTemplateArgs;
7138 NestedNameSpecifierLoc NewNestedNameSpec;
7139 if (
T->isConstrained()) {
7140 assert(TL.getConceptReference());
7141 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7142 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7144 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7145 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7146 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7147 if (getDerived().TransformTemplateArguments(
7148 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7152 if (TL.getNestedNameSpecifierLoc()) {
7154 = getDerived().TransformNestedNameSpecifierLoc(
7155 TL.getNestedNameSpecifierLoc());
7156 if (!NewNestedNameSpec)
7161 QualType
Result = TL.getType();
7162 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7166 NewArgList.reserve(NewTemplateArgs.size());
7167 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7168 NewArgList.push_back(ArgLoc.getArgument());
7169 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7175 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7176 NewTL.setNameLoc(TL.getNameLoc());
7177 NewTL.setRParenLoc(TL.getRParenLoc());
7178 NewTL.setConceptReference(
nullptr);
7180 if (
T->isConstrained()) {
7181 DeclarationNameInfo DNI = DeclarationNameInfo(
7182 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7183 TL.getConceptNameLoc(),
7184 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7186 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7187 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7189 NewTL.setConceptReference(CR);
7195template <
typename Derived>
7197 TypeLocBuilder &TLB,
7198 TemplateSpecializationTypeLoc TL,
7199 TemplateName Template) {
7200 TemplateArgumentListInfo NewTemplateArgs;
7201 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7202 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7203 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7205 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7206 ArgIterator(TL, TL.getNumArgs()),
7213 getDerived().RebuildTemplateSpecializationType(Template,
7214 TL.getTemplateNameLoc(),
7222 if (isa<DependentTemplateSpecializationType>(
Result)) {
7223 DependentTemplateSpecializationTypeLoc NewTL
7224 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7225 NewTL.setElaboratedKeywordLoc(SourceLocation());
7226 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7227 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7228 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7229 NewTL.setLAngleLoc(TL.getLAngleLoc());
7230 NewTL.setRAngleLoc(TL.getRAngleLoc());
7231 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7232 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7236 TemplateSpecializationTypeLoc NewTL
7237 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7238 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7239 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7240 NewTL.setLAngleLoc(TL.getLAngleLoc());
7241 NewTL.setRAngleLoc(TL.getRAngleLoc());
7242 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7243 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7249template <
typename Derived>
7260 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7268 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7270 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7280 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7286 = getDerived().RebuildTemplateSpecializationType(Template,
7298 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7305template<
typename Derived>
7320 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7321 if (NamedT.isNull())
7330 if (
const TemplateSpecializationType *TST =
7331 NamedT->getAs<TemplateSpecializationType>()) {
7332 TemplateName Template = TST->getTemplateName();
7333 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7334 Template.getAsTemplateDecl())) {
7336 diag::err_tag_reference_non_tag)
7338 << llvm::to_underlying(
7340 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7346 if (getDerived().AlwaysRebuild() ||
7348 NamedT !=
T->getNamedType()) {
7351 QualifierLoc, NamedT);
7356 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7358 NewTL.setQualifierLoc(QualifierLoc);
7362template <
typename Derived>
7363template <
typename Fn>
7368 if (modifiedType.
isNull())
7373 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7374 if (oldAttr && !newAttr)
7380 if (getDerived().AlwaysRebuild() ||
7386 if (equivalentType.
isNull())
7395 diag::err_nullability_nonpointer)
7411template <
typename Derived>
7414 return getDerived().TransformAttributedType(
7416 return getDerived().TransformType(TLB, ModifiedLoc);
7420template <
typename Derived>
7429 Expr *NewCount =
nullptr;
7431 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7434 NewCount = CountResult.
get();
7438 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->
desugar() ||
7439 OldCount != NewCount) {
7449template <
typename Derived>
7450QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7451 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7453 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7456template<
typename Derived>
7458TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7460 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7464 QualType
Result = TL.getType();
7465 if (getDerived().AlwaysRebuild() ||
7466 Inner != TL.getInnerLoc().getType()) {
7467 Result = getDerived().RebuildParenType(Inner);
7472 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7473 NewTL.setLParenLoc(TL.getLParenLoc());
7474 NewTL.setRParenLoc(TL.getRParenLoc());
7478template <
typename Derived>
7480TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7481 MacroQualifiedTypeLoc TL) {
7482 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7486 QualType
Result = TL.getType();
7487 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7489 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7494 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7495 NewTL.setExpansionLoc(TL.getExpansionLoc());
7499template<
typename Derived>
7500QualType TreeTransform<Derived>::TransformDependentNameType(
7501 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7502 return TransformDependentNameType(TLB, TL,
false);
7505template<
typename Derived>
7506QualType TreeTransform<Derived>::TransformDependentNameType(
7507 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7508 const DependentNameType *
T = TL.getTypePtr();
7510 NestedNameSpecifierLoc QualifierLoc
7511 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7516 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7517 TL.getElaboratedKeywordLoc(),
7525 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7526 QualType NamedT = ElabT->getNamedType();
7527 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7529 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7530 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7531 NewTL.setQualifierLoc(QualifierLoc);
7533 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7534 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7535 NewTL.setQualifierLoc(QualifierLoc);
7536 NewTL.setNameLoc(TL.getNameLoc());
7541template<
typename Derived>
7544 DependentTemplateSpecializationTypeLoc TL) {
7545 NestedNameSpecifierLoc QualifierLoc;
7546 if (TL.getQualifierLoc()) {
7548 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7554 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7557template<
typename Derived>
7570 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7575 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7583 QualType NamedT = ElabT->getNamedType();
7592 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7599 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7608 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7617 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7623template<
typename Derived>
7632 if (getDerived().AlwaysRebuild() ||
7634 Result = getDerived().RebuildPackExpansionType(Pattern,
7642 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7647template<
typename Derived>
7649TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7650 ObjCInterfaceTypeLoc TL) {
7652 TLB.pushFullCopy(TL);
7653 return TL.getType();
7656template<
typename Derived>
7658TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7659 ObjCTypeParamTypeLoc TL) {
7660 const ObjCTypeParamType *
T = TL.getTypePtr();
7661 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7662 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7666 QualType
Result = TL.getType();
7667 if (getDerived().AlwaysRebuild() ||
7668 OTP !=
T->getDecl()) {
7669 Result = getDerived().RebuildObjCTypeParamType(
7670 OTP, TL.getProtocolLAngleLoc(),
7671 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7672 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7677 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7678 if (TL.getNumProtocols()) {
7679 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7680 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7681 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7682 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7687template<
typename Derived>
7689TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7690 ObjCObjectTypeLoc TL) {
7692 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7693 if (BaseType.isNull())
7696 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7700 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7701 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7702 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7703 QualType TypeArg = TypeArgInfo->getType();
7704 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7708 const auto *PackExpansion = PackExpansionLoc.getType()
7709 ->castAs<PackExpansionType>();
7713 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7717 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7718 bool Expand =
false;
7719 bool RetainExpansion =
false;
7720 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7721 if (getDerived().TryExpandParameterPacks(
7722 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7723 Unexpanded, Expand, RetainExpansion, NumExpansions))
7730 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7732 TypeLocBuilder TypeArgBuilder;
7733 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7734 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7736 if (NewPatternType.isNull())
7740 NewPatternType, NumExpansions);
7741 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7742 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7743 NewTypeArgInfos.push_back(
7744 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7750 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7751 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7753 TypeLocBuilder TypeArgBuilder;
7754 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7756 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7758 if (NewTypeArg.isNull())
7761 NewTypeArgInfos.push_back(
7762 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7768 TypeLocBuilder TypeArgBuilder;
7769 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7770 QualType NewTypeArg =
7771 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7772 if (NewTypeArg.isNull())
7776 if (NewTypeArg == TypeArg) {
7777 NewTypeArgInfos.push_back(TypeArgInfo);
7781 NewTypeArgInfos.push_back(
7782 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7786 QualType
Result = TL.getType();
7787 if (getDerived().AlwaysRebuild() || AnyChanged) {
7789 Result = getDerived().RebuildObjCObjectType(
7790 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7791 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7792 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7793 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7799 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7800 NewT.setHasBaseTypeAsWritten(
true);
7801 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7802 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7803 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7804 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7805 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7806 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7807 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7808 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7812template<
typename Derived>
7814TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
7815 ObjCObjectPointerTypeLoc TL) {
7816 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7817 if (PointeeType.isNull())
7820 QualType
Result = TL.getType();
7821 if (getDerived().AlwaysRebuild() ||
7822 PointeeType != TL.getPointeeLoc().getType()) {
7823 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
7829 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
7830 NewT.setStarLoc(TL.getStarLoc());
7837template<
typename Derived>
7839TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
7843template<
typename Derived>
7846 return getDerived().TransformCompoundStmt(S,
false);
7849template<
typename Derived>
7855 if (S->hasStoredFPFeatures())
7856 getSema().resetFPOptions(
7857 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
7860 bool SubStmtInvalid =
false;
7861 bool SubStmtChanged =
false;
7863 for (
auto *B : S->body()) {
7865 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
7867 if (
Result.isInvalid()) {
7870 if (isa<DeclStmt>(B))
7874 SubStmtInvalid =
true;
7878 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
7879 Statements.push_back(
Result.getAs<Stmt>());
7885 if (!getDerived().AlwaysRebuild() &&
7889 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
7895template<
typename Derived>
7897TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
7904 LHS = getDerived().TransformExpr(S->getLHS());
7906 if (LHS.isInvalid())
7910 RHS = getDerived().TransformExpr(S->getRHS());
7912 if (RHS.isInvalid())
7919 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
7921 S->getEllipsisLoc(),
7924 if (Case.isInvalid())
7929 getDerived().TransformStmt(S->getSubStmt());
7930 if (SubStmt.isInvalid())
7934 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
7937template <
typename Derived>
7938StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
7941 getDerived().TransformStmt(S->getSubStmt());
7942 if (SubStmt.isInvalid())
7946 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
7950template<
typename Derived>
7952TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
7953 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7954 if (SubStmt.isInvalid())
7957 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
7965 if (LD == S->getDecl())
7966 S->getDecl()->setStmt(
nullptr);
7969 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
7970 cast<LabelDecl>(LD), SourceLocation(),
7974template <
typename Derived>
7983 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
7984#include "clang/Basic/AttrList.inc"
7989template <
typename Derived>
8000 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8001#include "clang/Basic/AttrList.inc"
8003 return TransformAttr(R);
8006template <
typename Derived>
8009 StmtDiscardKind SDK) {
8010 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8014 bool AttrsChanged =
false;
8018 for (
const auto *I : S->getAttrs()) {
8020 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
8021 AttrsChanged |= (I != R);
8026 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
8034 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8038template<
typename Derived>
8040TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
8043 if (
Init.isInvalid())
8046 Sema::ConditionResult Cond;
8047 if (!S->isConsteval()) {
8049 Cond = getDerived().TransformCondition(
8050 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8053 if (Cond.isInvalid())
8058 std::optional<bool> ConstexprConditionValue;
8059 if (S->isConstexpr())
8060 ConstexprConditionValue = Cond.getKnownValue();
8064 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8065 EnterExpressionEvaluationContext Ctx(
8068 S->isNonNegatedConsteval());
8070 Then = getDerived().TransformStmt(S->getThen());
8071 if (Then.isInvalid())
8077 Then =
new (getSema().Context)
8078 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8083 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8084 EnterExpressionEvaluationContext Ctx(
8087 S->isNegatedConsteval());
8089 Else = getDerived().TransformStmt(S->getElse());
8090 if (Else.isInvalid())
8092 }
else if (S->getElse() && ConstexprConditionValue &&
8093 *ConstexprConditionValue) {
8097 Else =
new (getSema().Context)
8098 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8101 if (!getDerived().AlwaysRebuild() &&
8102 Init.get() == S->getInit() &&
8103 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8104 Then.get() == S->getThen() &&
8105 Else.get() == S->getElse())
8108 return getDerived().RebuildIfStmt(
8109 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8110 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8113template<
typename Derived>
8115TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8118 if (
Init.isInvalid())
8122 Sema::ConditionResult Cond = getDerived().TransformCondition(
8123 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8125 if (Cond.isInvalid())
8130 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8131 Init.get(), Cond, S->getRParenLoc());
8136 StmtResult Body = getDerived().TransformStmt(S->getBody());
8137 if (Body.isInvalid())
8141 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8145template<
typename Derived>
8147TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8149 Sema::ConditionResult Cond = getDerived().TransformCondition(
8150 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8152 if (Cond.isInvalid())
8156 StmtResult Body = getDerived().TransformStmt(S->getBody());
8157 if (Body.isInvalid())
8160 if (!getDerived().AlwaysRebuild() &&
8161 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8162 Body.get() == S->getBody())
8165 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8166 Cond, S->getRParenLoc(), Body.get());
8169template<
typename Derived>
8171TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8173 StmtResult Body = getDerived().TransformStmt(S->getBody());
8174 if (Body.isInvalid())
8178 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8179 if (Cond.isInvalid())
8182 if (!getDerived().AlwaysRebuild() &&
8183 Cond.get() == S->getCond() &&
8184 Body.get() == S->getBody())
8187 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8188 S->getWhileLoc(), Cond.get(),
8192template<
typename Derived>
8194TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8195 if (getSema().getLangOpts().OpenMP)
8196 getSema().OpenMP().startOpenMPLoop();
8200 if (
Init.isInvalid())
8205 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8206 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8210 Sema::ConditionResult Cond = getDerived().TransformCondition(
8211 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8213 if (Cond.isInvalid())
8218 if (
Inc.isInvalid())
8221 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8222 if (S->getInc() && !FullInc.get())
8226 StmtResult Body = getDerived().TransformStmt(S->getBody());
8227 if (Body.isInvalid())
8230 if (!getDerived().AlwaysRebuild() &&
8231 Init.get() == S->getInit() &&
8232 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8233 Inc.get() == S->getInc() &&
8234 Body.get() == S->getBody())
8237 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8238 Init.get(), Cond, FullInc,
8239 S->getRParenLoc(), Body.get());
8242template<
typename Derived>
8244TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8245 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8251 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8252 cast<LabelDecl>(LD));
8255template<
typename Derived>
8257TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8263 if (!getDerived().AlwaysRebuild() &&
8264 Target.get() == S->getTarget())
8267 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8271template<
typename Derived>
8273TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8277template<
typename Derived>
8279TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8283template<
typename Derived>
8285TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8293 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8296template<
typename Derived>
8298TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8299 bool DeclChanged =
false;
8301 LambdaScopeInfo *LSI = getSema().getCurLambda();
8302 for (
auto *
D : S->decls()) {
8307 if (Transformed !=
D)
8310 if (LSI && isa<TypeDecl>(Transformed))
8311 LSI->ContainsUnexpandedParameterPack |=
8314 .getTypeDeclType(cast<TypeDecl>(Transformed))
8317 ->containsUnexpandedParameterPack();
8319 Decls.push_back(Transformed);
8322 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8325 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8328template<
typename Derived>
8330TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8339 bool ExprsChanged =
false;
8342 for (
unsigned I = 0,
E = S->getNumOutputs(); I !=
E; ++I) {
8343 Names.push_back(S->getOutputIdentifier(I));
8346 Constraints.push_back(S->getOutputConstraintLiteral(I));
8349 Expr *OutputExpr = S->getOutputExpr(I);
8354 ExprsChanged |=
Result.get() != OutputExpr;
8356 Exprs.push_back(
Result.get());
8360 for (
unsigned I = 0,
E = S->getNumInputs(); I !=
E; ++I) {
8361 Names.push_back(S->getInputIdentifier(I));
8364 Constraints.push_back(S->getInputConstraintLiteral(I));
8367 Expr *InputExpr = S->getInputExpr(I);
8372 ExprsChanged |=
Result.get() != InputExpr;
8374 Exprs.push_back(
Result.get());
8378 for (
unsigned I = 0,
E = S->getNumLabels(); I !=
E; ++I) {
8379 Names.push_back(S->getLabelIdentifier(I));
8384 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8385 Exprs.push_back(
Result.get());
8387 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8391 for (
unsigned I = 0,
E = S->getNumClobbers(); I !=
E; ++I)
8392 Clobbers.push_back(S->getClobberStringLiteral(I));
8395 AsmString = S->getAsmString();
8396 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8397 S->isVolatile(), S->getNumOutputs(),
8398 S->getNumInputs(), Names.data(),
8399 Constraints, Exprs, AsmString.get(),
8400 Clobbers, S->getNumLabels(),
8404template<
typename Derived>
8406TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8409 bool HadError =
false, HadChange =
false;
8413 TransformedExprs.reserve(SrcExprs.size());
8414 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8416 if (!
Result.isUsable()) {
8419 HadChange |= (
Result.get() != SrcExprs[i]);
8420 TransformedExprs.push_back(
Result.get());
8425 if (!HadChange && !getDerived().AlwaysRebuild())
8428 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8429 AsmToks, S->getAsmString(),
8430 S->getNumOutputs(), S->getNumInputs(),
8431 S->getAllConstraints(), S->getClobbers(),
8432 TransformedExprs, S->getEndLoc());
8436template<
typename Derived>
8438TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8440 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8441 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8442 ScopeInfo->NeedsCoroutineSuspends &&
8443 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8444 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8445 "expected clean scope info");
8449 ScopeInfo->setNeedsCoroutineSuspends(
false);
8462 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8463 ScopeInfo->CoroutinePromise = Promise;
8468 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8469 if (InitSuspend.isInvalid())
8472 getDerived().TransformStmt(S->getFinalSuspendStmt());
8473 if (FinalSuspend.isInvalid() ||
8476 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8477 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8479 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8480 if (BodyRes.isInvalid())
8483 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8484 if (Builder.isInvalid())
8487 Expr *ReturnObject = S->getReturnValueInit();
8488 assert(ReturnObject &&
"the return object is expected to be valid");
8489 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8491 if (Res.isInvalid())
8493 Builder.ReturnValue = Res.get();
8498 if (S->hasDependentPromiseType()) {
8501 if (!Promise->getType()->isDependentType()) {
8502 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8503 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8504 "these nodes should not have been built yet");
8505 if (!Builder.buildDependentStatements())
8509 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8510 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8511 if (Res.isInvalid())
8513 Builder.OnFallthrough = Res.get();
8516 if (
auto *OnException = S->getExceptionHandler()) {
8517 StmtResult Res = getDerived().TransformStmt(OnException);
8518 if (Res.isInvalid())
8520 Builder.OnException = Res.get();
8523 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8524 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8525 if (Res.isInvalid())
8527 Builder.ReturnStmtOnAllocFailure = Res.get();
8531 assert(S->getAllocate() && S->getDeallocate() &&
8532 "allocation and deallocation calls must already be built");
8533 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8534 if (AllocRes.isInvalid())
8536 Builder.Allocate = AllocRes.get();
8538 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8539 if (DeallocRes.isInvalid())
8541 Builder.Deallocate = DeallocRes.get();
8543 if (
auto *ResultDecl = S->getResultDecl()) {
8544 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8545 if (Res.isInvalid())
8547 Builder.ResultDecl = Res.get();
8550 if (
auto *ReturnStmt = S->getReturnStmt()) {
8551 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8552 if (Res.isInvalid())
8554 Builder.ReturnStmt = Res.get();
8558 return getDerived().RebuildCoroutineBodyStmt(Builder);
8561template<
typename Derived>
8563TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8571 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8575template <
typename Derived>
8576ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *
E) {
8588 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8589 getSema().getCurScope(),
E->getKeywordLoc());
8593 return getDerived().RebuildCoawaitExpr(
8595 cast<UnresolvedLookupExpr>(Lookup.get()),
E->isImplicit());
8598template <
typename Derived>
8600TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *
E) {
8601 ExprResult OperandResult = getDerived().TransformInitializer(
E->getOperand(),
8603 if (OperandResult.isInvalid())
8606 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8607 E->getOperatorCoawaitLookup());
8609 if (LookupResult.isInvalid())
8614 return getDerived().RebuildDependentCoawaitExpr(
8615 E->getKeywordLoc(), OperandResult.get(),
8616 cast<UnresolvedLookupExpr>(LookupResult.get()));
8619template<
typename Derived>
8621TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *
E) {
8629 return getDerived().RebuildCoyieldExpr(
E->getKeywordLoc(),
Result.get());
8634template<
typename Derived>
8636TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8638 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8639 if (TryBody.isInvalid())
8643 bool AnyCatchChanged =
false;
8645 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8646 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8647 if (Catch.isInvalid())
8649 if (Catch.get() != S->getCatchStmt(I))
8650 AnyCatchChanged =
true;
8651 CatchStmts.push_back(Catch.get());
8656 if (S->getFinallyStmt()) {
8657 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8658 if (Finally.isInvalid())
8663 if (!getDerived().AlwaysRebuild() &&
8664 TryBody.get() == S->getTryBody() &&
8666 Finally.get() == S->getFinallyStmt())
8670 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8671 CatchStmts, Finally.get());
8674template<
typename Derived>
8676TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8678 VarDecl *Var =
nullptr;
8679 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8680 TypeSourceInfo *TSInfo =
nullptr;
8681 if (FromVar->getTypeSourceInfo()) {
8682 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8689 T = TSInfo->getType();
8691 T = getDerived().TransformType(FromVar->getType());
8696 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8701 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8702 if (Body.isInvalid())
8705 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8710template<
typename Derived>
8712TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8714 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8715 if (Body.isInvalid())
8719 if (!getDerived().AlwaysRebuild() &&
8720 Body.get() == S->getFinallyBody())
8724 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8728template<
typename Derived>
8730TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8732 if (S->getThrowExpr()) {
8733 Operand = getDerived().TransformExpr(S->getThrowExpr());
8738 if (!getDerived().AlwaysRebuild() &&
8739 Operand.get() == S->getThrowExpr())
8742 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8745template<
typename Derived>
8747TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8748 ObjCAtSynchronizedStmt *S) {
8754 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8760 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8761 if (Body.isInvalid())
8765 if (!getDerived().AlwaysRebuild() &&
8766 Object.get() == S->getSynchExpr() &&
8767 Body.get() == S->getSynchBody())
8771 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8772 Object.get(), Body.get());
8775template<
typename Derived>
8777TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8778 ObjCAutoreleasePoolStmt *S) {
8780 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8781 if (Body.isInvalid())
8785 if (!getDerived().AlwaysRebuild() &&
8786 Body.get() == S->getSubStmt())
8790 return getDerived().RebuildObjCAutoreleasePoolStmt(
8791 S->getAtLoc(), Body.get());
8794template<
typename Derived>
8796TreeTransform<Derived>::TransformObjCForCollectionStmt(
8797 ObjCForCollectionStmt *S) {
8800 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
8801 if (Element.isInvalid())
8805 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
8806 if (Collection.isInvalid())
8810 StmtResult Body = getDerived().TransformStmt(S->getBody());
8811 if (Body.isInvalid())
8815 if (!getDerived().AlwaysRebuild() &&
8816 Element.get() == S->getElement() &&
8817 Collection.get() == S->getCollection() &&
8818 Body.get() == S->getBody())
8822 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
8829template <
typename Derived>
8830StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
8832 VarDecl *Var =
nullptr;
8833 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
8835 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
8839 Var = getDerived().RebuildExceptionDecl(
8840 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
8841 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
8842 if (!Var || Var->isInvalidDecl())
8847 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
8848 if (Handler.isInvalid())
8851 if (!getDerived().AlwaysRebuild() && !Var &&
8852 Handler.get() == S->getHandlerBlock())
8855 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
8858template <
typename Derived>
8859StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
8861 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
8862 if (TryBlock.isInvalid())
8866 bool HandlerChanged =
false;
8868 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
8869 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
8870 if (Handler.isInvalid())
8873 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
8874 Handlers.push_back(Handler.getAs<Stmt>());
8877 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
8881 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
8885template<
typename Derived>
8887TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
8888 EnterExpressionEvaluationContext ForRangeInitContext(
8896 auto &LastRecord = getSema().ExprEvalContexts.back();
8897 LastRecord.InLifetimeExtendingContext =
true;
8900 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
8901 if (
Init.isInvalid())
8910 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
8911 auto ForRangeLifetimeExtendTemps =
8912 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
8917 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
8918 if (End.isInvalid())
8921 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8922 if (Cond.isInvalid())
8926 if (Cond.isInvalid())
8932 if (
Inc.isInvalid())
8937 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
8938 if (LoopVar.isInvalid())
8942 if (getDerived().AlwaysRebuild() ||
8943 Init.get() != S->getInit() ||
8944 Range.get() != S->getRangeStmt() ||
8945 Begin.get() != S->getBeginStmt() ||
8946 End.get() != S->getEndStmt() ||
8947 Cond.get() != S->getCond() ||
8948 Inc.get() != S->getInc() ||
8949 LoopVar.get() != S->getLoopVarStmt()) {
8950 NewStmt = getDerived().RebuildCXXForRangeStmt(
8951 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8953 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8954 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
8957 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
8962 StmtResult Body = getDerived().TransformStmt(S->getBody());
8963 if (Body.isInvalid())
8968 if (Body.get() != S->getBody() && NewStmt.get() == S) {
8969 NewStmt = getDerived().RebuildCXXForRangeStmt(
8970 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8972 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8973 if (NewStmt.isInvalid())
8977 if (NewStmt.get() == S)
8980 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
8983template<
typename Derived>
8985TreeTransform<Derived>::TransformMSDependentExistsStmt(
8986 MSDependentExistsStmt *S) {
8988 NestedNameSpecifierLoc QualifierLoc;
8989 if (S->getQualifierLoc()) {
8991 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
8997 DeclarationNameInfo NameInfo = S->getNameInfo();
8998 if (NameInfo.getName()) {
8999 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9000 if (!NameInfo.getName())
9005 if (!getDerived().AlwaysRebuild() &&
9006 QualifierLoc == S->getQualifierLoc() &&
9007 NameInfo.getName() == S->getNameInfo().getName())
9012 SS.Adopt(QualifierLoc);
9014 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9016 if (S->isIfExists())
9019 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9022 if (S->isIfNotExists())
9025 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9036 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9037 if (SubStmt.isInvalid())
9045 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9052template<
typename Derived>
9054TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *
E) {
9055 NestedNameSpecifierLoc QualifierLoc;
9056 if (
E->getQualifierLoc()) {
9058 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
9063 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
9064 getDerived().TransformDecl(
E->getMemberLoc(),
E->getPropertyDecl()));
9069 if (
Base.isInvalid())
9073 MSPropertyRefExpr(
Base.get(), PD,
E->isArrow(),
9075 QualifierLoc,
E->getMemberLoc());
9078template <
typename Derived>
9079ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
9080 MSPropertySubscriptExpr *
E) {
9081 auto BaseRes = getDerived().TransformExpr(
E->getBase());
9082 if (BaseRes.isInvalid())
9084 auto IdxRes = getDerived().TransformExpr(
E->getIdx());
9085 if (IdxRes.isInvalid())
9088 if (!getDerived().AlwaysRebuild() &&
9089 BaseRes.get() ==
E->getBase() &&
9090 IdxRes.get() ==
E->getIdx())
9093 return getDerived().RebuildArraySubscriptExpr(
9094 BaseRes.get(), SourceLocation(), IdxRes.get(),
E->getRBracketLoc());
9097template <
typename Derived>
9098StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
9099 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9100 if (TryBlock.isInvalid())
9103 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9104 if (Handler.isInvalid())
9107 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9108 Handler.get() == S->getHandler())
9111 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9112 TryBlock.get(), Handler.get());
9115template <
typename Derived>
9116StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9118 if (
Block.isInvalid())
9121 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9124template <
typename Derived>
9125StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9126 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9127 if (FilterExpr.isInvalid())
9131 if (
Block.isInvalid())
9134 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9138template <
typename Derived>
9140 if (isa<SEHFinallyStmt>(Handler))
9141 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9143 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9146template<
typename Derived>
9156template <
typename Derived>
9158TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9162 return getDerived().TransformStmt(L->getLoopStmt());
9165template <
typename Derived>
9172 TClauses.reserve(Clauses.size());
9176 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9177 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9178 getDerived().getSema().OpenMP().EndOpenMPClause();
9180 TClauses.push_back(Clause);
9182 TClauses.push_back(
nullptr);
9186 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9187 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9188 D->getDirectiveKind(),
9194 if (
D->getDirectiveKind() == OMPD_atomic ||
9195 D->getDirectiveKind() == OMPD_critical ||
9196 D->getDirectiveKind() == OMPD_section ||
9197 D->getDirectiveKind() == OMPD_master)
9198 CS =
D->getAssociatedStmt();
9200 CS =
D->getRawStmt();
9201 Body = getDerived().TransformStmt(CS);
9203 getSema().getLangOpts().OpenMPIRBuilder)
9204 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9207 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9212 if (TClauses.size() != Clauses.size()) {
9218 if (
D->getDirectiveKind() == OMPD_critical) {
9219 DirName = cast<OMPCriticalDirective>(
D)->getDirectiveName();
9220 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9223 if (
D->getDirectiveKind() == OMPD_cancellation_point) {
9224 CancelRegion = cast<OMPCancellationPointDirective>(
D)->getCancelRegion();
9225 }
else if (
D->getDirectiveKind() == OMPD_cancel) {
9226 CancelRegion = cast<OMPCancelDirective>(
D)->getCancelRegion();
9229 return getDerived().RebuildOMPExecutableDirective(
9230 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9239template <
typename Derived>
9246 TClauses.reserve(Clauses.size());
9249 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9250 OMPClause *Clause = getDerived().TransformOMPClause(
C);
9251 getDerived().getSema().OpenMP().EndOpenMPClause();
9253 TClauses.push_back(Clause);
9255 TClauses.push_back(
nullptr);
9259 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9260 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9261 D->getDirectiveKind(),
9266 assert(
D->getDirectiveKind() == OMPD_assume &&
9267 "Unexpected informational directive");
9268 Stmt *CS =
D->getAssociatedStmt();
9269 Body = getDerived().TransformStmt(CS);
9272 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9276 if (TClauses.size() != Clauses.size())
9281 return getDerived().RebuildOMPInformationalDirective(
9282 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9286template <
typename Derived>
9291 << getOpenMPDirectiveName(
D->getDirectiveKind());
9295template <
typename Derived>
9297TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *
D) {
9298 DeclarationNameInfo DirName;
9299 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9301 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9302 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9306template <
typename Derived>
9308TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *
D) {
9309 DeclarationNameInfo DirName;
9310 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9312 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9313 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9317template <
typename Derived>
9319TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *
D) {
9320 DeclarationNameInfo DirName;
9321 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9323 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9324 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9328template <
typename Derived>
9330TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *
D) {
9331 DeclarationNameInfo DirName;
9332 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9334 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9335 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9339template <
typename Derived>
9341TreeTransform<Derived>::TransformOMPReverseDirective(OMPReverseDirective *
D) {
9342 DeclarationNameInfo DirName;
9343 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9345 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9346 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9350template <
typename Derived>
9351StmtResult TreeTransform<Derived>::TransformOMPInterchangeDirective(
9352 OMPInterchangeDirective *
D) {
9353 DeclarationNameInfo DirName;
9354 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9356 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9357 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9361template <
typename Derived>
9363TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *
D) {
9364 DeclarationNameInfo DirName;
9365 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9367 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9368 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9372template <
typename Derived>
9374TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *
D) {
9375 DeclarationNameInfo DirName;
9376 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9378 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9379 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9383template <
typename Derived>
9385TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *
D) {
9386 DeclarationNameInfo DirName;
9387 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9389 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9390 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9394template <
typename Derived>
9396TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *
D) {
9397 DeclarationNameInfo DirName;
9398 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9400 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9401 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9405template <
typename Derived>
9407TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *
D) {
9408 DeclarationNameInfo DirName;
9409 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9411 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9412 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9416template <
typename Derived>
9418TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *
D) {
9419 DeclarationNameInfo DirName;
9420 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9422 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9423 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9427template <
typename Derived>
9429TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *
D) {
9430 DeclarationNameInfo DirName;
9431 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9433 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9434 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9438template <
typename Derived>
9440TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *
D) {
9441 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9442 OMPD_critical,
D->getDirectiveName(),
nullptr,
D->
getBeginLoc());
9443 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9444 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9448template <
typename Derived>
9449StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9450 OMPParallelForDirective *
D) {
9451 DeclarationNameInfo DirName;
9452 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9453 OMPD_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9454 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9455 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9459template <
typename Derived>
9460StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9461 OMPParallelForSimdDirective *
D) {
9462 DeclarationNameInfo DirName;
9463 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9464 OMPD_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9465 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9466 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9470template <
typename Derived>
9471StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9472 OMPParallelMasterDirective *
D) {
9473 DeclarationNameInfo DirName;
9474 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9475 OMPD_parallel_master, DirName,
nullptr,
D->
getBeginLoc());
9476 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9477 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9481template <
typename Derived>
9482StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9483 OMPParallelMaskedDirective *
D) {
9484 DeclarationNameInfo DirName;
9485 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9486 OMPD_parallel_masked, DirName,
nullptr,
D->
getBeginLoc());
9487 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9488 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9492template <
typename Derived>
9493StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9494 OMPParallelSectionsDirective *
D) {
9495 DeclarationNameInfo DirName;
9496 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9497 OMPD_parallel_sections, DirName,
nullptr,
D->
getBeginLoc());
9498 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9499 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9503template <
typename Derived>
9505TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *
D) {
9506 DeclarationNameInfo DirName;
9507 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9509 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9510 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9514template <
typename Derived>
9515StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9516 OMPTaskyieldDirective *
D) {
9517 DeclarationNameInfo DirName;
9518 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9520 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9521 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9525template <
typename Derived>
9527TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *
D) {
9528 DeclarationNameInfo DirName;
9529 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9531 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9532 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9536template <
typename Derived>
9538TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *
D) {
9539 DeclarationNameInfo DirName;
9540 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9542 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9543 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9547template <
typename Derived>
9549TreeTransform<Derived>::TransformOMPAssumeDirective(OMPAssumeDirective *
D) {
9550 DeclarationNameInfo DirName;
9551 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9553 StmtResult Res = getDerived().TransformOMPInformationalDirective(
D);
9554 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9558template <
typename Derived>
9560TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *
D) {
9561 DeclarationNameInfo DirName;
9562 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9564 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9565 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9569template <
typename Derived>
9570StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9571 OMPTaskgroupDirective *
D) {
9572 DeclarationNameInfo DirName;
9573 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9575 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9576 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9580template <
typename Derived>
9582TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *
D) {
9583 DeclarationNameInfo DirName;
9584 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9586 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9587 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9591template <
typename Derived>
9593TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *
D) {
9594 DeclarationNameInfo DirName;
9595 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9597 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9598 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9602template <
typename Derived>
9604TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *
D) {
9605 DeclarationNameInfo DirName;
9606 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9608 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9609 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9613template <
typename Derived>
9615TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *
D) {
9616 DeclarationNameInfo DirName;
9617 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9619 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9620 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9624template <
typename Derived>
9626TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *
D) {
9627 DeclarationNameInfo DirName;
9628 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9630 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9631 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9635template <
typename Derived>
9637TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *
D) {
9638 DeclarationNameInfo DirName;
9639 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9641 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9642 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9646template <
typename Derived>
9647StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9648 OMPTargetDataDirective *
D) {
9649 DeclarationNameInfo DirName;
9650 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9652 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9653 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9657template <
typename Derived>
9658StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9659 OMPTargetEnterDataDirective *
D) {
9660 DeclarationNameInfo DirName;
9661 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9662 OMPD_target_enter_data, DirName,
nullptr,
D->
getBeginLoc());
9663 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9664 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9668template <
typename Derived>
9669StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9670 OMPTargetExitDataDirective *
D) {
9671 DeclarationNameInfo DirName;
9672 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9673 OMPD_target_exit_data, DirName,
nullptr,
D->
getBeginLoc());
9674 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9675 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9679template <
typename Derived>
9680StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9681 OMPTargetParallelDirective *
D) {
9682 DeclarationNameInfo DirName;
9683 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9684 OMPD_target_parallel, DirName,
nullptr,
D->
getBeginLoc());
9685 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9686 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9690template <
typename Derived>
9691StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9692 OMPTargetParallelForDirective *
D) {
9693 DeclarationNameInfo DirName;
9694 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9695 OMPD_target_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9696 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9697 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9701template <
typename Derived>
9702StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9703 OMPTargetUpdateDirective *
D) {
9704 DeclarationNameInfo DirName;
9705 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9706 OMPD_target_update, DirName,
nullptr,
D->
getBeginLoc());
9707 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9708 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9712template <
typename Derived>
9714TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *
D) {
9715 DeclarationNameInfo DirName;
9716 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9718 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9719 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9723template <
typename Derived>
9724StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9725 OMPCancellationPointDirective *
D) {
9726 DeclarationNameInfo DirName;
9727 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9728 OMPD_cancellation_point, DirName,
nullptr,
D->
getBeginLoc());
9729 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9730 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9734template <
typename Derived>
9736TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *
D) {
9737 DeclarationNameInfo DirName;
9738 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9740 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9741 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9745template <
typename Derived>
9747TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *
D) {
9748 DeclarationNameInfo DirName;
9749 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9751 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9752 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9756template <
typename Derived>
9757StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9758 OMPTaskLoopSimdDirective *
D) {
9759 DeclarationNameInfo DirName;
9760 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9761 OMPD_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9762 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9763 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9767template <
typename Derived>
9768StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9769 OMPMasterTaskLoopDirective *
D) {
9770 DeclarationNameInfo DirName;
9771 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9772 OMPD_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9773 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9774 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9778template <
typename Derived>
9779StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
9780 OMPMaskedTaskLoopDirective *
D) {
9781 DeclarationNameInfo DirName;
9782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9783 OMPD_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9784 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9789template <
typename Derived>
9790StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
9791 OMPMasterTaskLoopSimdDirective *
D) {
9792 DeclarationNameInfo DirName;
9793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9794 OMPD_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9795 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9796 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9800template <
typename Derived>
9801StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
9802 OMPMaskedTaskLoopSimdDirective *
D) {
9803 DeclarationNameInfo DirName;
9804 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9805 OMPD_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9806 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9807 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9811template <
typename Derived>
9812StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
9813 OMPParallelMasterTaskLoopDirective *
D) {
9814 DeclarationNameInfo DirName;
9815 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9816 OMPD_parallel_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9817 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9818 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9822template <
typename Derived>
9823StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
9824 OMPParallelMaskedTaskLoopDirective *
D) {
9825 DeclarationNameInfo DirName;
9826 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9827 OMPD_parallel_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9828 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9829 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9833template <
typename Derived>
9835TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
9836 OMPParallelMasterTaskLoopSimdDirective *
D) {
9837 DeclarationNameInfo DirName;
9838 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9839 OMPD_parallel_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9840 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9841 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9845template <
typename Derived>
9847TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
9848 OMPParallelMaskedTaskLoopSimdDirective *
D) {
9849 DeclarationNameInfo DirName;
9850 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9851 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9852 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9853 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9857template <
typename Derived>
9858StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
9859 OMPDistributeDirective *
D) {
9860 DeclarationNameInfo DirName;
9861 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9863 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9864 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9868template <
typename Derived>
9869StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
9870 OMPDistributeParallelForDirective *
D) {
9871 DeclarationNameInfo DirName;
9872 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9873 OMPD_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9874 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9875 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9879template <
typename Derived>
9881TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
9882 OMPDistributeParallelForSimdDirective *
D) {
9883 DeclarationNameInfo DirName;
9884 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9885 OMPD_distribute_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9886 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9887 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9891template <
typename Derived>
9892StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
9893 OMPDistributeSimdDirective *
D) {
9894 DeclarationNameInfo DirName;
9895 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9896 OMPD_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
9897 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9898 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9902template <
typename Derived>
9903StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
9904 OMPTargetParallelForSimdDirective *
D) {
9905 DeclarationNameInfo DirName;
9906 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9907 OMPD_target_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9908 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9909 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9913template <
typename Derived>
9914StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
9915 OMPTargetSimdDirective *
D) {
9916 DeclarationNameInfo DirName;
9917 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9919 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9920 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9924template <
typename Derived>
9925StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
9926 OMPTeamsDistributeDirective *
D) {
9927 DeclarationNameInfo DirName;
9928 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9929 OMPD_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
9930 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9931 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9935template <
typename Derived>
9936StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
9937 OMPTeamsDistributeSimdDirective *
D) {
9938 DeclarationNameInfo DirName;
9939 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9940 OMPD_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
9941 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9942 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9946template <
typename Derived>
9947StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
9948 OMPTeamsDistributeParallelForSimdDirective *
D) {
9949 DeclarationNameInfo DirName;
9950 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9951 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
9953 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9954 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9958template <
typename Derived>
9959StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
9960 OMPTeamsDistributeParallelForDirective *
D) {
9961 DeclarationNameInfo DirName;
9962 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9963 OMPD_teams_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9964 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9965 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9969template <
typename Derived>
9970StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
9971 OMPTargetTeamsDirective *
D) {
9972 DeclarationNameInfo DirName;
9973 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9974 OMPD_target_teams, DirName,
nullptr,
D->
getBeginLoc());
9975 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9976 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9980template <
typename Derived>
9981StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
9982 OMPTargetTeamsDistributeDirective *
D) {
9983 DeclarationNameInfo DirName;
9984 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9985 OMPD_target_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
9986 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9987 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9991template <
typename Derived>
9993TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
9994 OMPTargetTeamsDistributeParallelForDirective *
D) {
9995 DeclarationNameInfo DirName;
9996 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9997 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
9999 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10000 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10004template <
typename Derived>
10006 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
10007 OMPTargetTeamsDistributeParallelForSimdDirective *
D) {
10008 DeclarationNameInfo DirName;
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10012 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10013 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10017template <
typename Derived>
10019TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
10020 OMPTargetTeamsDistributeSimdDirective *
D) {
10021 DeclarationNameInfo DirName;
10022 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10023 OMPD_target_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10024 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10025 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10029template <
typename Derived>
10031TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *
D) {
10032 DeclarationNameInfo DirName;
10033 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10035 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10036 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10040template <
typename Derived>
10042TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *
D) {
10043 DeclarationNameInfo DirName;
10044 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10046 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10047 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10051template <
typename Derived>
10053TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *
D) {
10054 DeclarationNameInfo DirName;
10055 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10057 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10058 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10062template <
typename Derived>
10063StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
10064 OMPGenericLoopDirective *
D) {
10065 DeclarationNameInfo DirName;
10066 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10068 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10069 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10073template <
typename Derived>
10074StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
10075 OMPTeamsGenericLoopDirective *
D) {
10076 DeclarationNameInfo DirName;
10077 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10079 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10080 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10084template <
typename Derived>
10085StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
10086 OMPTargetTeamsGenericLoopDirective *
D) {
10087 DeclarationNameInfo DirName;
10088 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10089 OMPD_target_teams_loop, DirName,
nullptr,
D->
getBeginLoc());
10090 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10091 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10095template <
typename Derived>
10096StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
10097 OMPParallelGenericLoopDirective *
D) {
10098 DeclarationNameInfo DirName;
10099 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10100 OMPD_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10101 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10102 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10106template <
typename Derived>
10108TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
10109 OMPTargetParallelGenericLoopDirective *
D) {
10110 DeclarationNameInfo DirName;
10111 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10112 OMPD_target_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10113 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10114 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10121template <
typename Derived>
10122OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
10123 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10124 if (Cond.isInvalid())
10126 return getDerived().RebuildOMPIfClause(
10127 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10128 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10131template <
typename Derived>
10132OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
10133 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10134 if (Cond.isInvalid())
10136 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10137 C->getLParenLoc(),
C->getEndLoc());
10140template <
typename Derived>
10142TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
10143 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10144 if (NumThreads.isInvalid())
10146 return getDerived().RebuildOMPNumThreadsClause(
10147 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10150template <
typename Derived>
10152TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
10153 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10156 return getDerived().RebuildOMPSafelenClause(
10157 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10160template <
typename Derived>
10162TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
10163 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10166 return getDerived().RebuildOMPAllocatorClause(
10167 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10170template <
typename Derived>
10172TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
10173 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10176 return getDerived().RebuildOMPSimdlenClause(
10177 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10180template <
typename Derived>
10181OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
10183 TransformedSizes.reserve(
C->getNumSizes());
10185 for (Expr *
E :
C->getSizesRefs()) {
10187 TransformedSizes.push_back(
nullptr);
10196 TransformedSizes.push_back(
T.get());
10199 if (!Changed && !getDerived().AlwaysRebuild())
10201 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10202 C->getLParenLoc(),
C->getEndLoc());
10205template <
typename Derived>
10206OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10207 if (!getDerived().AlwaysRebuild())
10209 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10212template <
typename Derived>
10214TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10215 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10218 Expr *Factor =
T.get();
10219 bool Changed = Factor !=
C->getFactor();
10221 if (!Changed && !getDerived().AlwaysRebuild())
10223 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10227template <
typename Derived>
10229TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10230 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10233 return getDerived().RebuildOMPCollapseClause(
10234 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10237template <
typename Derived>
10239TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10240 return getDerived().RebuildOMPDefaultClause(
10241 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10242 C->getLParenLoc(),
C->getEndLoc());
10245template <
typename Derived>
10247TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10248 return getDerived().RebuildOMPProcBindClause(
10249 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10250 C->getLParenLoc(),
C->getEndLoc());
10253template <
typename Derived>
10255TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10256 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10259 return getDerived().RebuildOMPScheduleClause(
10260 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10261 C->getScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10262 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10263 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10266template <
typename Derived>
10268TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10270 if (
auto *Num =
C->getNumForLoops()) {
10271 E = getDerived().TransformExpr(Num);
10275 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10276 C->getLParenLoc(),
E.get());
10279template <
typename Derived>
10281TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10283 if (Expr *Evt =
C->getEventHandler()) {
10284 E = getDerived().TransformExpr(Evt);
10288 return getDerived().RebuildOMPDetachClause(
E.get(),
C->getBeginLoc(),
10289 C->getLParenLoc(),
C->getEndLoc());
10292template <
typename Derived>
10294TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10299template <
typename Derived>
10301TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10306template <
typename Derived>
10308TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10313template <
typename Derived>
10314OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10319template <
typename Derived>
10320OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10325template <
typename Derived>
10327TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10332template <
typename Derived>
10334TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10339template <
typename Derived>
10341TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10346template <
typename Derived>
10347OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10352template <
typename Derived>
10354TreeTransform<Derived>::TransformOMPAbsentClause(OMPAbsentClause *
C) {
10358template <
typename Derived>
10359OMPClause *TreeTransform<Derived>::TransformOMPHoldsClause(OMPHoldsClause *
C) {
10360 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10363 return getDerived().RebuildOMPHoldsClause(
E.get(),
C->getBeginLoc(),
10364 C->getLParenLoc(),
C->getEndLoc());
10367template <
typename Derived>
10369TreeTransform<Derived>::TransformOMPContainsClause(OMPContainsClause *
C) {
10373template <
typename Derived>
10375TreeTransform<Derived>::TransformOMPNoOpenMPClause(OMPNoOpenMPClause *
C) {
10378template <
typename Derived>
10379OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPRoutinesClause(
10380 OMPNoOpenMPRoutinesClause *
C) {
10383template <
typename Derived>
10384OMPClause *TreeTransform<Derived>::TransformOMPNoParallelismClause(
10385 OMPNoParallelismClause *
C) {
10389template <
typename Derived>
10391TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10396template <
typename Derived>
10398TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10403template <
typename Derived>
10405TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10410template <
typename Derived>
10412TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10417template <
typename Derived>
10419TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10424template <
typename Derived>
10425OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10430template <
typename Derived>
10432TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10437template <
typename Derived>
10438OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10443template <
typename Derived>
10445TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10450template <
typename Derived>
10451OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10452 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10453 if (IVR.isInvalid())
10456 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10457 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10458 for (Expr *
E : llvm::drop_begin(
C->varlist())) {
10459 ExprResult ER = getDerived().TransformExpr(cast<Expr>(
E));
10460 if (ER.isInvalid())
10462 InteropInfo.PreferTypes.push_back(ER.get());
10464 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10465 C->getBeginLoc(),
C->getLParenLoc(),
10466 C->getVarLoc(),
C->getEndLoc());
10469template <
typename Derived>
10470OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10471 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10472 if (ER.isInvalid())
10474 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10475 C->getLParenLoc(),
C->getVarLoc(),
10479template <
typename Derived>
10481TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10483 if (Expr *IV =
C->getInteropVar()) {
10484 ER = getDerived().TransformExpr(IV);
10485 if (ER.isInvalid())
10488 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10489 C->getLParenLoc(),
C->getVarLoc(),
10493template <
typename Derived>
10495TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10496 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10497 if (Cond.isInvalid())
10499 return getDerived().RebuildOMPNovariantsClause(
10500 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10503template <
typename Derived>
10505TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10506 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10507 if (Cond.isInvalid())
10509 return getDerived().RebuildOMPNocontextClause(
10510 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10513template <
typename Derived>
10515TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10516 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10517 if (ThreadID.isInvalid())
10519 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10520 C->getLParenLoc(),
C->getEndLoc());
10523template <
typename Derived>
10524OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10525 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10528 return getDerived().RebuildOMPAlignClause(
E.get(),
C->getBeginLoc(),
10529 C->getLParenLoc(),
C->getEndLoc());
10532template <
typename Derived>
10533OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10534 OMPUnifiedAddressClause *
C) {
10535 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10538template <
typename Derived>
10539OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10540 OMPUnifiedSharedMemoryClause *
C) {
10542 "unified_shared_memory clause cannot appear in dependent context");
10545template <
typename Derived>
10546OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10547 OMPReverseOffloadClause *
C) {
10548 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10551template <
typename Derived>
10552OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10553 OMPDynamicAllocatorsClause *
C) {
10555 "dynamic_allocators clause cannot appear in dependent context");
10558template <
typename Derived>
10559OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10560 OMPAtomicDefaultMemOrderClause *
C) {
10562 "atomic_default_mem_order clause cannot appear in dependent context");
10565template <
typename Derived>
10566OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10567 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10568 C->getBeginLoc(),
C->getLParenLoc(),
10572template <
typename Derived>
10574TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10575 return getDerived().RebuildOMPSeverityClause(
10576 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10577 C->getLParenLoc(),
C->getEndLoc());
10580template <
typename Derived>
10582TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10583 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10586 return getDerived().RebuildOMPMessageClause(
10587 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10591template <
typename Derived>
10593TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10595 Vars.reserve(
C->varlist_size());
10596 for (
auto *VE :
C->varlist()) {
10597 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10598 if (EVar.isInvalid())
10600 Vars.push_back(EVar.get());
10602 return getDerived().RebuildOMPPrivateClause(
10603 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10606template <
typename Derived>
10607OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10608 OMPFirstprivateClause *
C) {
10610 Vars.reserve(
C->varlist_size());
10611 for (
auto *VE :
C->varlist()) {
10612 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10613 if (EVar.isInvalid())
10615 Vars.push_back(EVar.get());
10617 return getDerived().RebuildOMPFirstprivateClause(
10618 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10621template <
typename Derived>
10623TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10625 Vars.reserve(
C->varlist_size());
10626 for (
auto *VE :
C->varlist()) {
10627 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10628 if (EVar.isInvalid())
10630 Vars.push_back(EVar.get());
10632 return getDerived().RebuildOMPLastprivateClause(
10633 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10634 C->getLParenLoc(),
C->getEndLoc());
10637template <
typename Derived>
10639TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10641 Vars.reserve(
C->varlist_size());
10642 for (
auto *VE :
C->varlist()) {
10643 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10644 if (EVar.isInvalid())
10646 Vars.push_back(EVar.get());
10648 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10649 C->getLParenLoc(),
C->getEndLoc());
10652template <
typename Derived>
10654TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10656 Vars.reserve(
C->varlist_size());
10657 for (
auto *VE :
C->varlist()) {
10658 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10659 if (EVar.isInvalid())
10661 Vars.push_back(EVar.get());
10663 CXXScopeSpec ReductionIdScopeSpec;
10664 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10666 DeclarationNameInfo NameInfo =
C->getNameInfo();
10667 if (NameInfo.getName()) {
10668 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10669 if (!NameInfo.getName())
10675 for (
auto *
E :
C->reduction_ops()) {
10678 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10679 UnresolvedSet<8> Decls;
10680 for (
auto *
D : ULE->decls()) {
10682 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10683 Decls.addDecl(InstD, InstD->getAccess());
10687 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10688 true, Decls.begin(), Decls.end(),
10691 UnresolvedReductions.push_back(
nullptr);
10693 return getDerived().RebuildOMPReductionClause(
10694 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10695 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10696 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10699template <
typename Derived>
10700OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10701 OMPTaskReductionClause *
C) {
10703 Vars.reserve(
C->varlist_size());
10704 for (
auto *VE :
C->varlist()) {
10705 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10706 if (EVar.isInvalid())
10708 Vars.push_back(EVar.get());
10710 CXXScopeSpec ReductionIdScopeSpec;
10711 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10713 DeclarationNameInfo NameInfo =
C->getNameInfo();
10714 if (NameInfo.getName()) {
10715 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10716 if (!NameInfo.getName())
10722 for (
auto *
E :
C->reduction_ops()) {
10725 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10726 UnresolvedSet<8> Decls;
10727 for (
auto *
D : ULE->decls()) {
10729 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10730 Decls.addDecl(InstD, InstD->getAccess());
10734 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10735 true, Decls.begin(), Decls.end(),
10738 UnresolvedReductions.push_back(
nullptr);
10740 return getDerived().RebuildOMPTaskReductionClause(
10741 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10742 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10745template <
typename Derived>
10747TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10749 Vars.reserve(
C->varlist_size());
10750 for (
auto *VE :
C->varlist()) {
10751 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10752 if (EVar.isInvalid())
10754 Vars.push_back(EVar.get());
10756 CXXScopeSpec ReductionIdScopeSpec;
10757 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10759 DeclarationNameInfo NameInfo =
C->getNameInfo();
10760 if (NameInfo.getName()) {
10761 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10762 if (!NameInfo.getName())
10768 for (
auto *
E :
C->reduction_ops()) {
10771 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10772 UnresolvedSet<8> Decls;
10773 for (
auto *
D : ULE->decls()) {
10775 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10776 Decls.addDecl(InstD, InstD->getAccess());
10780 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10781 true, Decls.begin(), Decls.end(),
10784 UnresolvedReductions.push_back(
nullptr);
10786 return getDerived().RebuildOMPInReductionClause(
10787 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10788 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10791template <
typename Derived>
10793TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
10795 Vars.reserve(
C->varlist_size());
10796 for (
auto *VE :
C->varlist()) {
10797 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10798 if (EVar.isInvalid())
10800 Vars.push_back(EVar.get());
10802 ExprResult Step = getDerived().TransformExpr(
C->getStep());
10803 if (Step.isInvalid())
10805 return getDerived().RebuildOMPLinearClause(
10806 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
10807 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
10811template <
typename Derived>
10813TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
10815 Vars.reserve(
C->varlist_size());
10816 for (
auto *VE :
C->varlist()) {
10817 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10818 if (EVar.isInvalid())
10820 Vars.push_back(EVar.get());
10822 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
10823 if (Alignment.isInvalid())
10825 return getDerived().RebuildOMPAlignedClause(
10826 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10827 C->getColonLoc(),
C->getEndLoc());
10830template <
typename Derived>
10832TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
10834 Vars.reserve(
C->varlist_size());
10835 for (
auto *VE :
C->varlist()) {
10836 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10837 if (EVar.isInvalid())
10839 Vars.push_back(EVar.get());
10841 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
10842 C->getLParenLoc(),
C->getEndLoc());
10845template <
typename Derived>
10847TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
10849 Vars.reserve(
C->varlist_size());
10850 for (
auto *VE :
C->varlist()) {
10851 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10852 if (EVar.isInvalid())
10854 Vars.push_back(EVar.get());
10856 return getDerived().RebuildOMPCopyprivateClause(
10857 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10860template <
typename Derived>
10861OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
10863 Vars.reserve(
C->varlist_size());
10864 for (
auto *VE :
C->varlist()) {
10865 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10866 if (EVar.isInvalid())
10868 Vars.push_back(EVar.get());
10870 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
10871 C->getLParenLoc(),
C->getEndLoc());
10874template <
typename Derived>
10876TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
10877 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
10880 return getDerived().RebuildOMPDepobjClause(
E.get(),
C->getBeginLoc(),
10881 C->getLParenLoc(),
C->getEndLoc());
10884template <
typename Derived>
10886TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
10888 Expr *DepModifier =
C->getModifier();
10890 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
10891 if (DepModRes.isInvalid())
10893 DepModifier = DepModRes.
get();
10895 Vars.reserve(
C->varlist_size());
10896 for (
auto *VE :
C->varlist()) {
10897 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10898 if (EVar.isInvalid())
10900 Vars.push_back(EVar.get());
10902 return getDerived().RebuildOMPDependClause(
10903 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
10904 C->getOmpAllMemoryLoc()},
10905 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10908template <
typename Derived>
10910TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
10911 ExprResult E = getDerived().TransformExpr(
C->getDevice());
10914 return getDerived().RebuildOMPDeviceClause(
10915 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10916 C->getModifierLoc(),
C->getEndLoc());
10919template <
typename Derived,
class T>
10926 Vars.reserve(
C->varlist_size());
10927 for (
auto *VE :
C->varlist()) {
10931 Vars.push_back(EVar.
get());
10935 if (
C->getMapperQualifierLoc()) {
10936 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
10937 C->getMapperQualifierLoc());
10941 MapperIdScopeSpec.
Adopt(QualifierLoc);
10942 MapperIdInfo =
C->getMapperIdInfo();
10943 if (MapperIdInfo.
getName()) {
10944 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
10950 for (
auto *
E :
C->mapperlists()) {
10953 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10955 for (
auto *
D : ULE->decls()) {
10963 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
10966 UnresolvedMappers.push_back(
nullptr);
10972template <
typename Derived>
10973OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
10974 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10976 Expr *IteratorModifier =
C->getIteratorModifier();
10977 if (IteratorModifier) {
10978 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
10979 if (MapModRes.isInvalid())
10981 IteratorModifier = MapModRes.
get();
10983 CXXScopeSpec MapperIdScopeSpec;
10984 DeclarationNameInfo MapperIdInfo;
10986 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
10987 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10989 return getDerived().RebuildOMPMapClause(
10990 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
10991 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
10992 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10995template <
typename Derived>
10997TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
10998 Expr *Allocator =
C->getAllocator();
11000 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11001 if (AllocatorRes.isInvalid())
11003 Allocator = AllocatorRes.get();
11006 Vars.reserve(
C->varlist_size());
11007 for (
auto *VE :
C->varlist()) {
11008 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11009 if (EVar.isInvalid())
11011 Vars.push_back(EVar.get());
11013 return getDerived().RebuildOMPAllocateClause(
11014 Allocator, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11018template <
typename Derived>
11020TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
11022 Vars.reserve(
C->varlist_size());
11023 for (
auto *VE :
C->varlist()) {
11024 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11025 if (EVar.isInvalid())
11027 Vars.push_back(EVar.get());
11029 return getDerived().RebuildOMPNumTeamsClause(
11030 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11033template <
typename Derived>
11035TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
11037 Vars.reserve(
C->varlist_size());
11038 for (
auto *VE :
C->varlist()) {
11039 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11040 if (EVar.isInvalid())
11042 Vars.push_back(EVar.get());
11044 return getDerived().RebuildOMPThreadLimitClause(
11045 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11048template <
typename Derived>
11050TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
11051 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11054 return getDerived().RebuildOMPPriorityClause(
11055 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11058template <
typename Derived>
11060TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
11061 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11064 return getDerived().RebuildOMPGrainsizeClause(
11065 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11066 C->getModifierLoc(),
C->getEndLoc());
11069template <
typename Derived>
11071TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
11072 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11075 return getDerived().RebuildOMPNumTasksClause(
11076 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11077 C->getModifierLoc(),
C->getEndLoc());
11080template <
typename Derived>
11081OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
11082 ExprResult E = getDerived().TransformExpr(
C->getHint());
11085 return getDerived().RebuildOMPHintClause(
E.get(),
C->getBeginLoc(),
11086 C->getLParenLoc(),
C->getEndLoc());
11089template <
typename Derived>
11090OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
11091 OMPDistScheduleClause *
C) {
11092 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11095 return getDerived().RebuildOMPDistScheduleClause(
11096 C->getDistScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11097 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11100template <
typename Derived>
11102TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
11105 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
11106 C->getDefaultmapKind(),
11109 C->getDefaultmapModifierLoc(),
11110 C->getDefaultmapKindLoc(),
11114template <
typename Derived>
11115OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
11116 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11118 CXXScopeSpec MapperIdScopeSpec;
11119 DeclarationNameInfo MapperIdInfo;
11121 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
11122 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11124 return getDerived().RebuildOMPToClause(
11125 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11126 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11129template <
typename Derived>
11130OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
11131 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11133 CXXScopeSpec MapperIdScopeSpec;
11134 DeclarationNameInfo MapperIdInfo;
11136 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
11137 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11139 return getDerived().RebuildOMPFromClause(
11140 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11141 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11144template <
typename Derived>
11145OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
11146 OMPUseDevicePtrClause *
C) {
11148 Vars.reserve(
C->varlist_size());
11149 for (
auto *VE :
C->varlist()) {
11150 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11151 if (EVar.isInvalid())
11153 Vars.push_back(EVar.get());
11155 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11156 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11159template <
typename Derived>
11160OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
11161 OMPUseDeviceAddrClause *
C) {
11163 Vars.reserve(
C->varlist_size());
11164 for (
auto *VE :
C->varlist()) {
11165 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11166 if (EVar.isInvalid())
11168 Vars.push_back(EVar.get());
11170 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11171 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11174template <
typename Derived>
11176TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
11178 Vars.reserve(
C->varlist_size());
11179 for (
auto *VE :
C->varlist()) {
11180 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11181 if (EVar.isInvalid())
11183 Vars.push_back(EVar.get());
11185 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11186 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11189template <
typename Derived>
11190OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
11191 OMPHasDeviceAddrClause *
C) {
11193 Vars.reserve(
C->varlist_size());
11194 for (
auto *VE :
C->varlist()) {
11195 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11196 if (EVar.isInvalid())
11198 Vars.push_back(EVar.get());
11200 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11201 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11204template <
typename Derived>
11206TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
11208 Vars.reserve(
C->varlist_size());
11209 for (
auto *VE :
C->varlist()) {
11210 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11211 if (EVar.isInvalid())
11213 Vars.push_back(EVar.get());
11215 return getDerived().RebuildOMPNontemporalClause(
11216 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11219template <
typename Derived>
11221TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
11223 Vars.reserve(
C->varlist_size());
11224 for (
auto *VE :
C->varlist()) {
11225 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11226 if (EVar.isInvalid())
11228 Vars.push_back(EVar.get());
11230 return getDerived().RebuildOMPInclusiveClause(
11231 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11234template <
typename Derived>
11236TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
11238 Vars.reserve(
C->varlist_size());
11239 for (
auto *VE :
C->varlist()) {
11240 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11241 if (EVar.isInvalid())
11243 Vars.push_back(EVar.get());
11245 return getDerived().RebuildOMPExclusiveClause(
11246 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11249template <
typename Derived>
11250OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11251 OMPUsesAllocatorsClause *
C) {
11253 Data.reserve(
C->getNumberOfAllocators());
11254 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
11255 OMPUsesAllocatorsClause::Data
D =
C->getAllocatorData(I);
11256 ExprResult Allocator = getDerived().TransformExpr(
D.Allocator);
11257 if (Allocator.isInvalid())
11260 if (Expr *AT =
D.AllocatorTraits) {
11261 AllocatorTraits = getDerived().TransformExpr(AT);
11262 if (AllocatorTraits.isInvalid())
11265 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11266 NewD.Allocator = Allocator.get();
11267 NewD.AllocatorTraits = AllocatorTraits.get();
11268 NewD.LParenLoc =
D.LParenLoc;
11269 NewD.RParenLoc =
D.RParenLoc;
11271 return getDerived().RebuildOMPUsesAllocatorsClause(
11272 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11275template <
typename Derived>
11277TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11279 Locators.reserve(
C->varlist_size());
11281 if (Expr *Modifier =
C->getModifier()) {
11282 ModifierRes = getDerived().TransformExpr(Modifier);
11283 if (ModifierRes.isInvalid())
11286 for (Expr *
E :
C->varlist()) {
11287 ExprResult Locator = getDerived().TransformExpr(
E);
11288 if (Locator.isInvalid())
11290 Locators.push_back(Locator.get());
11292 return getDerived().RebuildOMPAffinityClause(
11293 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11294 ModifierRes.get(), Locators);
11297template <
typename Derived>
11298OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11299 return getDerived().RebuildOMPOrderClause(
11300 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11301 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11304template <
typename Derived>
11305OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11306 return getDerived().RebuildOMPBindClause(
11307 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11308 C->getLParenLoc(),
C->getEndLoc());
11311template <
typename Derived>
11312OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11313 OMPXDynCGroupMemClause *
C) {
11315 if (
Size.isInvalid())
11317 return getDerived().RebuildOMPXDynCGroupMemClause(
11318 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11321template <
typename Derived>
11323TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11325 Vars.reserve(
C->varlist_size());
11326 for (
auto *VE :
C->varlist()) {
11327 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11328 if (EVar.isInvalid())
11330 Vars.push_back(EVar.get());
11332 return getDerived().RebuildOMPDoacrossClause(
11333 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11334 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11337template <
typename Derived>
11339TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11341 for (
auto *A :
C->getAttrs())
11342 NewAttrs.push_back(getDerived().TransformAttr(A));
11343 return getDerived().RebuildOMPXAttributeClause(
11344 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11347template <
typename Derived>
11348OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11349 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11356template <
typename Derived>
11357class OpenACCClauseTransform final
11358 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11359 TreeTransform<Derived> &Self;
11361 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11362 OpenACCClause *NewClause =
nullptr;
11366 for (Expr *CurVar : VarList) {
11367 ExprResult Res = Self.TransformExpr(CurVar);
11369 if (!Res.isUsable())
11372 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getClauseKind(),
11375 if (Res.isUsable())
11376 InstantiatedVarList.push_back(Res.get());
11379 return InstantiatedVarList;
11383 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11385 SemaOpenACC::OpenACCParsedClause &PC)
11386 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11388 OpenACCClause *CreatedClause()
const {
return NewClause; }
11390#define VISIT_CLAUSE(CLAUSE_NAME) \
11391 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11392#include "clang/Basic/OpenACCClauses.def"
11395template <
typename Derived>
11396void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11397 const OpenACCDefaultClause &
C) {
11406template <
typename Derived>
11407void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11408 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11409 assert(Cond &&
"If constructed with invalid Condition");
11410 Sema::ConditionResult Res =
Self.TransformCondition(
11413 if (Res.isInvalid() || !Res.get().second)
11424template <
typename Derived>
11425void OpenACCClauseTransform<Derived>::VisitSelfClause(
11426 const OpenACCSelfClause &
C) {
11428 if (
C.hasConditionExpr()) {
11429 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11430 Sema::ConditionResult Res =
11431 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11434 if (Res.isInvalid() || !Res.get().second)
11446template <
typename Derived>
11447void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11448 const OpenACCNumGangsClause &
C) {
11451 for (Expr *CurIntExpr :
C.getIntExprs()) {
11454 if (!Res.isUsable())
11459 C.getBeginLoc(), Res.get());
11460 if (!Res.isUsable())
11463 InstantiatedIntExprs.push_back(Res.get());
11473template <
typename Derived>
11474void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11475 const OpenACCPrivateClause &
C) {
11485template <
typename Derived>
11486void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11487 const OpenACCFirstPrivateClause &
C) {
11497template <
typename Derived>
11498void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11499 const OpenACCNoCreateClause &
C) {
11509template <
typename Derived>
11510void OpenACCClauseTransform<Derived>::VisitPresentClause(
11511 const OpenACCPresentClause &
C) {
11521template <
typename Derived>
11522void OpenACCClauseTransform<Derived>::VisitCopyClause(
11523 const OpenACCCopyClause &
C) {
11533template <
typename Derived>
11534void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11535 const OpenACCCopyInClause &
C) {
11546template <
typename Derived>
11547void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11548 const OpenACCCopyOutClause &
C) {
11550 false,
C.isZero());
11559template <
typename Derived>
11560void OpenACCClauseTransform<Derived>::VisitCreateClause(
11561 const OpenACCCreateClause &
C) {
11563 false,
C.isZero());
11571template <
typename Derived>
11572void OpenACCClauseTransform<Derived>::VisitAttachClause(
11573 const OpenACCAttachClause &
C) {
11577 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11578 return Self.getSema().OpenACC().CheckVarIsPointerType(
11579 OpenACCClauseKind::Attach, E);
11580 }), VarList.end());
11590template <
typename Derived>
11591void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
11592 const OpenACCDevicePtrClause &
C) {
11596 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11597 return Self.getSema().OpenACC().CheckVarIsPointerType(
11598 OpenACCClauseKind::DevicePtr, E);
11599 }), VarList.end());
11609template <
typename Derived>
11610void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
11611 const OpenACCNumWorkersClause &
C) {
11612 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11613 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
11616 if (!Res.isUsable())
11621 C.getBeginLoc(), Res.get());
11622 if (!Res.isUsable())
11632template <
typename Derived>
11633void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
11634 const OpenACCVectorLengthClause &
C) {
11635 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11636 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
11639 if (!Res.isUsable())
11644 C.getBeginLoc(), Res.get());
11645 if (!Res.isUsable())
11655template <
typename Derived>
11656void OpenACCClauseTransform<Derived>::VisitAsyncClause(
11657 const OpenACCAsyncClause &
C) {
11658 if (
C.hasIntExpr()) {
11659 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
11660 if (!Res.isUsable())
11665 C.getBeginLoc(), Res.get());
11666 if (!Res.isUsable())
11678template <
typename Derived>
11679void OpenACCClauseTransform<Derived>::VisitWaitClause(
11680 const OpenACCWaitClause &
C) {
11681 if (!
C.getLParenLoc().isInvalid()) {
11682 Expr *DevNumExpr =
nullptr;
11686 if (
C.getDevNumExpr()) {
11688 if (!Res.isUsable())
11692 C.getBeginLoc(), Res.get());
11693 if (!Res.isUsable())
11696 DevNumExpr = Res.get();
11700 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
11702 if (!Res.isUsable())
11706 C.getBeginLoc(), Res.get());
11707 if (!Res.isUsable())
11710 InstantiatedQueueIdExprs.push_back(Res.get());
11714 std::move(InstantiatedQueueIdExprs));
11724template <
typename Derived>
11725void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
11726 const OpenACCDeviceTypeClause &
C) {
11729 Self.getSema().getASTContext(),
C.getClauseKind(),
11731 C.getArchitectures(), ParsedClause.
getEndLoc());
11734template <
typename Derived>
11735void OpenACCClauseTransform<Derived>::VisitAutoClause(
11736 const OpenACCAutoClause &
C) {
11743template <
typename Derived>
11744void OpenACCClauseTransform<Derived>::VisitIndependentClause(
11745 const OpenACCIndependentClause &
C) {
11751template <
typename Derived>
11752void OpenACCClauseTransform<Derived>::VisitSeqClause(
11753 const OpenACCSeqClause &
C) {
11759template <
typename Derived>
11760void OpenACCClauseTransform<Derived>::VisitReductionClause(
11761 const OpenACCReductionClause &
C) {
11765 for (Expr *Var : TransformedVars) {
11766 ExprResult Res =
Self.getSema().OpenACC().CheckReductionVar(Var);
11767 if (Res.isUsable())
11768 ValidVars.push_back(Res.get());
11773 ParsedClause.
getLParenLoc(),
C.getReductionOp(), ValidVars,
11777template <
typename Derived>
11778OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
11782 SemaOpenACC::OpenACCParsedClause ParsedClause(
11783 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
11784 ParsedClause.
setEndLoc(OldClause->getEndLoc());
11786 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
11789 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
11791 Transform.Visit(OldClause);
11793 return Transform.CreatedClause();
11796template <
typename Derived>
11798TreeTransform<Derived>::TransformOpenACCClauseList(
11801 for (
const auto *Clause : OldClauses) {
11802 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
11803 TransformedClauses, DirKind, Clause))
11804 TransformedClauses.push_back(TransformedClause);
11806 return TransformedClauses;
11809template <
typename Derived>
11810StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
11811 OpenACCComputeConstruct *
C) {
11812 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
11814 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
11819 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
11822 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(getSema().OpenACC(),
11823 C->getDirectiveKind());
11824 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
11825 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
11826 C->getBeginLoc(),
C->getDirectiveKind(), StrBlock);
11828 return getDerived().RebuildOpenACCComputeConstruct(
11829 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
11830 C->getEndLoc(), TransformedClauses, StrBlock);
11833template <
typename Derived>
11835TreeTransform<Derived>::TransformOpenACCLoopConstruct(OpenACCLoopConstruct *
C) {
11837 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
11839 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
11844 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
11848 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(getSema().OpenACC(),
11849 C->getDirectiveKind());
11851 Loop = getSema().OpenACC().ActOnAssociatedStmt(
C->getBeginLoc(),
11852 C->getDirectiveKind(),
Loop);
11854 return getDerived().RebuildOpenACCLoopConstruct(
11855 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
11856 TransformedClauses,
Loop);
11862template<
typename Derived>
11864TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *
E) {
11865 return TransformExpr(
E->getSubExpr());
11868template <
typename Derived>
11869ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
11870 SYCLUniqueStableNameExpr *
E) {
11874 TypeSourceInfo *NewT = getDerived().TransformType(
E->getTypeSourceInfo());
11879 if (!getDerived().AlwaysRebuild() &&
E->getTypeSourceInfo() == NewT)
11882 return getDerived().RebuildSYCLUniqueStableNameExpr(
11883 E->getLocation(),
E->getLParenLocation(),
E->getRParenLocation(), NewT);
11886template<
typename Derived>
11888TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *
E) {
11892 return getDerived().RebuildPredefinedExpr(
E->getLocation(),
11893 E->getIdentKind());
11896template<
typename Derived>
11898TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *
E) {
11899 NestedNameSpecifierLoc QualifierLoc;
11900 if (
E->getQualifierLoc()) {
11902 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
11908 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getLocation(),
11913 NamedDecl *
Found = ND;
11914 if (
E->getFoundDecl() !=
E->getDecl()) {
11915 Found = cast_or_null<NamedDecl>(
11916 getDerived().TransformDecl(
E->getLocation(),
E->getFoundDecl()));
11921 DeclarationNameInfo NameInfo =
E->getNameInfo();
11922 if (NameInfo.getName()) {
11923 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11924 if (!NameInfo.getName())
11928 if (!getDerived().AlwaysRebuild() &&
11929 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
11930 QualifierLoc ==
E->getQualifierLoc() && ND ==
E->getDecl() &&
11931 Found ==
E->getFoundDecl() &&
11932 NameInfo.getName() ==
E->getDecl()->getDeclName() &&
11933 !
E->hasExplicitTemplateArgs()) {
11942 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
11943 if (
E->hasExplicitTemplateArgs()) {
11944 TemplateArgs = &TransArgs;
11945 TransArgs.setLAngleLoc(
E->getLAngleLoc());
11946 TransArgs.setRAngleLoc(
E->getRAngleLoc());
11947 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
11948 E->getNumTemplateArgs(),
11953 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
11954 Found, TemplateArgs);
11957template<
typename Derived>
11959TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *
E) {
11963template <
typename Derived>
11964ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
11965 FixedPointLiteral *
E) {
11969template<
typename Derived>
11971TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *
E) {
11975template<
typename Derived>
11977TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *
E) {
11981template<
typename Derived>
11983TreeTransform<Derived>::TransformStringLiteral(StringLiteral *
E) {
11987template<
typename Derived>
11989TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *
E) {
11993template<
typename Derived>
11995TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *
E) {
11996 return getDerived().TransformCallExpr(
E);
11999template<
typename Derived>
12001TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *
E) {
12003 TypeSourceInfo *ControllingType =
nullptr;
12004 if (
E->isExprPredicate())
12005 ControllingExpr = getDerived().TransformExpr(
E->getControllingExpr());
12007 ControllingType = getDerived().TransformType(
E->getControllingType());
12009 if (ControllingExpr.isInvalid() && !ControllingType)
12015 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
12017 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
12020 AssocTypes.push_back(AssocType);
12022 AssocTypes.push_back(
nullptr);
12026 getDerived().TransformExpr(Assoc.getAssociationExpr());
12027 if (AssocExpr.isInvalid())
12029 AssocExprs.push_back(AssocExpr.get());
12032 if (!ControllingType)
12033 return getDerived().RebuildGenericSelectionExpr(
E->getGenericLoc(),
12034 E->getDefaultLoc(),
12036 ControllingExpr.get(),
12039 return getDerived().RebuildGenericSelectionExpr(
12040 E->getGenericLoc(),
E->getDefaultLoc(),
E->getRParenLoc(),
12041 ControllingType, AssocTypes, AssocExprs);
12044template<
typename Derived>
12046TreeTransform<Derived>::TransformParenExpr(ParenExpr *
E) {
12047 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
12048 if (SubExpr.isInvalid())
12051 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getSubExpr())
12054 return getDerived().RebuildParenExpr(SubExpr.get(),
E->getLParen(),
12061template<
typename Derived>
12065 return getDerived().TransformDependentScopeDeclRefExpr(
12066 DRE,
true,
nullptr);
12068 return getDerived().TransformUnresolvedLookupExpr(
12071 return getDerived().TransformExpr(
E);
12074template<
typename Derived>
12078 if (
E->getOpcode() == UO_AddrOf)
12079 SubExpr = TransformAddressOfOperand(
E->getSubExpr());
12081 SubExpr = TransformExpr(
E->getSubExpr());
12085 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getSubExpr())
12088 return getDerived().RebuildUnaryOperator(
E->getOperatorLoc(),
12093template<
typename Derived>
12095TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *
E) {
12097 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
12107 bool ExprChanged =
false;
12108 typedef Sema::OffsetOfComponent Component;
12110 for (
unsigned I = 0, N =
E->getNumComponents(); I != N; ++I) {
12111 const OffsetOfNode &ON =
E->getComponent(I);
12113 Comp.isBrackets =
true;
12114 Comp.LocStart = ON.getSourceRange().getBegin();
12115 Comp.LocEnd = ON.getSourceRange().getEnd();
12116 switch (ON.getKind()) {
12118 Expr *FromIndex =
E->getIndexExpr(ON.getArrayExprIndex());
12119 ExprResult Index = getDerived().TransformExpr(FromIndex);
12120 if (Index.isInvalid())
12123 ExprChanged = ExprChanged || Index.get() != FromIndex;
12124 Comp.isBrackets =
true;
12125 Comp.U.E = Index.get();
12131 Comp.isBrackets =
false;
12132 Comp.U.IdentInfo = ON.getFieldName();
12133 if (!
Comp.U.IdentInfo)
12143 Components.push_back(Comp);
12147 if (!getDerived().AlwaysRebuild() &&
12148 Type ==
E->getTypeSourceInfo() &&
12153 return getDerived().RebuildOffsetOfExpr(
E->getOperatorLoc(), Type,
12154 Components,
E->getRParenLoc());
12157template<
typename Derived>
12159TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *
E) {
12160 assert((!
E->getSourceExpr() || getDerived().AlreadyTransformed(
E->
getType())) &&
12161 "opaque value expression requires transformation");
12165template<
typename Derived>
12167TreeTransform<Derived>::TransformTypoExpr(TypoExpr *
E) {
12171template <
typename Derived>
12172ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *
E) {
12175 for (Expr *
C :
E->subExpressions()) {
12177 if (NewC.isInvalid())
12179 Children.push_back(NewC.get());
12183 if (!getDerived().AlwaysRebuild() && !Changed)
12189template<
typename Derived>
12191TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *
E) {
12199 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
12200 if (result.isInvalid())
return ExprError();
12205 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
12211template<
typename Derived>
12213TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
12214 UnaryExprOrTypeTraitExpr *
E) {
12215 if (
E->isArgumentType()) {
12216 TypeSourceInfo *OldT =
E->getArgumentTypeInfo();
12218 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12222 if (!getDerived().AlwaysRebuild() && OldT == NewT)
12225 return getDerived().RebuildUnaryExprOrTypeTrait(NewT,
E->getOperatorLoc(),
12239 TypeSourceInfo *RecoveryTSI =
nullptr;
12241 auto *PE = dyn_cast<ParenExpr>(
E->getArgumentExpr());
12243 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
12244 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
12245 PE, DRE,
false, &RecoveryTSI);
12247 SubExpr = getDerived().TransformExpr(
E->getArgumentExpr());
12250 return getDerived().RebuildUnaryExprOrTypeTrait(
12252 }
else if (SubExpr.isInvalid())
12255 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getArgumentExpr())
12258 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
12259 E->getOperatorLoc(),
12264template<
typename Derived>
12266TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *
E) {
12267 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12268 if (LHS.isInvalid())
12271 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
12272 if (RHS.isInvalid())
12276 if (!getDerived().AlwaysRebuild() &&
12277 LHS.get() ==
E->getLHS() &&
12278 RHS.get() ==
E->getRHS())
12281 return getDerived().RebuildArraySubscriptExpr(
12283 E->getLHS()->
getBeginLoc(), RHS.get(),
E->getRBracketLoc());
12286template <
typename Derived>
12288TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *
E) {
12290 if (
Base.isInvalid())
12293 ExprResult RowIdx = getDerived().TransformExpr(
E->getRowIdx());
12294 if (RowIdx.isInvalid())
12297 ExprResult ColumnIdx = getDerived().TransformExpr(
E->getColumnIdx());
12298 if (ColumnIdx.isInvalid())
12301 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
12302 RowIdx.get() ==
E->getRowIdx() && ColumnIdx.get() ==
E->getColumnIdx())
12305 return getDerived().RebuildMatrixSubscriptExpr(
12306 Base.get(), RowIdx.get(), ColumnIdx.get(),
E->getRBracketLoc());
12309template <
typename Derived>
12311TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *
E) {
12313 if (
Base.isInvalid())
12317 if (
E->getLowerBound()) {
12318 LowerBound = getDerived().TransformExpr(
E->getLowerBound());
12319 if (LowerBound.isInvalid())
12324 if (
E->getLength()) {
12325 Length = getDerived().TransformExpr(
E->getLength());
12326 if (Length.isInvalid())
12331 if (
E->isOMPArraySection()) {
12332 if (Expr *Str =
E->getStride()) {
12333 Stride = getDerived().TransformExpr(Str);
12334 if (Stride.isInvalid())
12339 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
12340 LowerBound.get() ==
E->getLowerBound() &&
12341 Length.get() ==
E->getLength() &&
12342 (
E->isOpenACCArraySection() || Stride.get() ==
E->getStride()))
12345 return getDerived().RebuildArraySectionExpr(
12347 LowerBound.get(),
E->getColonLocFirst(),
12348 E->isOMPArraySection() ?
E->getColonLocSecond() : SourceLocation{},
12349 Length.get(), Stride.get(),
E->getRBracketLoc());
12352template <
typename Derived>
12354TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *
E) {
12356 if (
Base.isInvalid())
12360 bool ErrorFound =
false;
12361 for (Expr *Dim :
E->getDimensions()) {
12362 ExprResult DimRes = getDerived().TransformExpr(Dim);
12363 if (DimRes.isInvalid()) {
12367 Dims.push_back(DimRes.get());
12372 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(),
E->getLParenLoc(),
12373 E->getRParenLoc(), Dims,
12374 E->getBracketsRanges());
12377template <
typename Derived>
12379TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *
E) {
12380 unsigned NumIterators =
E->numOfIterators();
12383 bool ErrorFound =
false;
12384 bool NeedToRebuild = getDerived().AlwaysRebuild();
12385 for (
unsigned I = 0; I < NumIterators; ++I) {
12386 auto *
D = cast<VarDecl>(
E->getIteratorDecl(I));
12387 Data[I].DeclIdent =
D->getIdentifier();
12391 "Implicit type must be int.");
12393 TypeSourceInfo *TSI = getDerived().TransformType(
D->getTypeSourceInfo());
12394 QualType
DeclTy = getDerived().TransformType(
D->getType());
12397 OMPIteratorExpr::IteratorRange
Range =
E->getIteratorRange(I);
12401 ErrorFound = ErrorFound ||
12402 !(!
D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
12403 !
Data[I].Type.get().isNull())) ||
12408 Data[I].Range.End = End.get();
12409 Data[I].Range.Step = Step.get();
12410 Data[I].AssignLoc =
E->getAssignLoc(I);
12411 Data[I].ColonLoc =
E->getColonLoc(I);
12412 Data[I].SecColonLoc =
E->getSecondColonLoc(I);
12415 (
D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
12416 D->getType().getTypePtrOrNull()) ||
12422 if (!NeedToRebuild)
12425 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
12426 E->getIteratorKwLoc(),
E->getLParenLoc(),
E->getRParenLoc(),
Data);
12427 if (!Res.isUsable())
12429 auto *IE = cast<OMPIteratorExpr>(Res.get());
12430 for (
unsigned I = 0; I < NumIterators; ++I)
12431 getDerived().transformedLocalDecl(
E->getIteratorDecl(I),
12432 IE->getIteratorDecl(I));
12436template<
typename Derived>
12438TreeTransform<Derived>::TransformCallExpr(CallExpr *
E) {
12445 bool ArgChanged =
false;
12447 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
12451 if (!getDerived().AlwaysRebuild() &&
12452 Callee.get() ==
E->getCallee() &&
12457 SourceLocation FakeLParenLoc
12460 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12461 if (
E->hasStoredFPFeatures()) {
12462 FPOptionsOverride NewOverrides =
E->getFPFeatures();
12463 getSema().CurFPFeatures =
12464 NewOverrides.applyOverrides(getSema().getLangOpts());
12465 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12468 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
12470 E->getRParenLoc());
12473template<
typename Derived>
12475TreeTransform<Derived>::TransformMemberExpr(MemberExpr *
E) {
12477 if (
Base.isInvalid())
12480 NestedNameSpecifierLoc QualifierLoc;
12481 if (
E->hasQualifier()) {
12483 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
12488 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
12491 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getMemberLoc(),
12492 E->getMemberDecl()));
12496 NamedDecl *FoundDecl =
E->getFoundDecl();
12497 if (FoundDecl ==
E->getMemberDecl()) {
12500 FoundDecl = cast_or_null<NamedDecl>(
12501 getDerived().TransformDecl(
E->getMemberLoc(), FoundDecl));
12506 if (!getDerived().AlwaysRebuild() &&
12507 Base.get() ==
E->getBase() &&
12508 QualifierLoc ==
E->getQualifierLoc() &&
12509 Member ==
E->getMemberDecl() &&
12510 FoundDecl ==
E->getFoundDecl() &&
12511 !
E->hasExplicitTemplateArgs()) {
12515 if (!(isa<CXXThisExpr>(
E->getBase()) &&
12516 getSema().OpenMP().isOpenMPRebuildMemberExpr(
12517 cast<ValueDecl>(
Member)))) {
12525 TemplateArgumentListInfo TransArgs;
12526 if (
E->hasExplicitTemplateArgs()) {
12527 TransArgs.setLAngleLoc(
E->getLAngleLoc());
12528 TransArgs.setRAngleLoc(
E->getRAngleLoc());
12529 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
12530 E->getNumTemplateArgs(),
12536 SourceLocation FakeOperatorLoc =
12543 NamedDecl *FirstQualifierInScope =
nullptr;
12544 DeclarationNameInfo MemberNameInfo =
E->getMemberNameInfo();
12545 if (MemberNameInfo.getName()) {
12546 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
12547 if (!MemberNameInfo.getName())
12551 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
12558 (
E->hasExplicitTemplateArgs()
12559 ? &TransArgs :
nullptr),
12560 FirstQualifierInScope);
12563template<
typename Derived>
12565TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *
E) {
12566 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12567 if (LHS.isInvalid())
12571 getDerived().TransformInitializer(
E->getRHS(),
false);
12572 if (RHS.isInvalid())
12575 if (!getDerived().AlwaysRebuild() &&
12576 LHS.get() ==
E->getLHS() &&
12577 RHS.get() ==
E->getRHS())
12580 if (
E->isCompoundAssignmentOp())
12582 return getDerived().RebuildBinaryOperator(
12583 E->getOperatorLoc(),
E->getOpcode(), LHS.get(), RHS.get());
12584 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12585 FPOptionsOverride NewOverrides(
E->getFPFeatures());
12586 getSema().CurFPFeatures =
12587 NewOverrides.applyOverrides(getSema().getLangOpts());
12588 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12589 return getDerived().RebuildBinaryOperator(
E->getOperatorLoc(),
E->getOpcode(),
12590 LHS.get(), RHS.get());
12593template <
typename Derived>
12594ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
12595 CXXRewrittenBinaryOperator *
E) {
12596 CXXRewrittenBinaryOperator::DecomposedForm Decomp =
E->getDecomposedForm();
12598 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
12599 if (LHS.isInvalid())
12602 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
12603 if (RHS.isInvalid())
12608 UnresolvedSet<2> UnqualLookups;
12609 bool ChangedAnyLookups =
false;
12610 Expr *PossibleBinOps[] = {
E->getSemanticForm(),
12611 const_cast<Expr *
>(Decomp.InnerBinOp)};
12612 for (Expr *PossibleBinOp : PossibleBinOps) {
12613 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
12616 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
12617 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
12622 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
12623 E->getOperatorLoc(),
Callee->getFoundDecl()));
12627 ChangedAnyLookups =
true;
12628 UnqualLookups.addDecl(
Found);
12631 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
12632 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
12638 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
12643 return getDerived().RebuildCXXRewrittenBinaryOperator(
12644 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
12647template<
typename Derived>
12649TreeTransform<Derived>::TransformCompoundAssignOperator(
12650 CompoundAssignOperator *
E) {
12651 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12652 FPOptionsOverride NewOverrides(
E->getFPFeatures());
12653 getSema().CurFPFeatures =
12654 NewOverrides.applyOverrides(getSema().getLangOpts());
12655 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12656 return getDerived().TransformBinaryOperator(
E);
12659template<
typename Derived>
12661TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
12665 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
12666 if (commonExpr.isInvalid())
12669 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
12670 if (rhs.isInvalid())
12673 if (!getDerived().AlwaysRebuild() &&
12674 commonExpr.get() == e->getCommon() &&
12675 rhs.get() == e->getFalseExpr())
12678 return getDerived().RebuildConditionalOperator(commonExpr.get(),
12679 e->getQuestionLoc(),
12685template<
typename Derived>
12687TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *
E) {
12688 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
12689 if (Cond.isInvalid())
12692 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12693 if (LHS.isInvalid())
12696 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
12697 if (RHS.isInvalid())
12700 if (!getDerived().AlwaysRebuild() &&
12701 Cond.get() ==
E->getCond() &&
12702 LHS.get() ==
E->getLHS() &&
12703 RHS.get() ==
E->getRHS())
12706 return getDerived().RebuildConditionalOperator(Cond.get(),
12707 E->getQuestionLoc(),
12713template<
typename Derived>
12715TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *
E) {
12718 return getDerived().TransformExpr(
E->getSubExprAsWritten());
12721template<
typename Derived>
12723TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *
E) {
12724 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeInfoAsWritten());
12729 = getDerived().TransformExpr(
E->getSubExprAsWritten());
12730 if (SubExpr.isInvalid())
12733 if (!getDerived().AlwaysRebuild() &&
12734 Type ==
E->getTypeInfoAsWritten() &&
12735 SubExpr.get() ==
E->getSubExpr())
12738 return getDerived().RebuildCStyleCastExpr(
E->getLParenLoc(),
12744template<
typename Derived>
12746TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *
E) {
12747 TypeSourceInfo *OldT =
E->getTypeSourceInfo();
12748 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12753 if (
Init.isInvalid())
12756 if (!getDerived().AlwaysRebuild() &&
12758 Init.get() ==
E->getInitializer())
12765 return getDerived().RebuildCompoundLiteralExpr(
12766 E->getLParenLoc(), NewT,
12770template<
typename Derived>
12772TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *
E) {
12774 if (
Base.isInvalid())
12777 if (!getDerived().AlwaysRebuild() &&
12778 Base.get() ==
E->getBase())
12782 SourceLocation FakeOperatorLoc =
12784 return getDerived().RebuildExtVectorElementExpr(
12785 Base.get(), FakeOperatorLoc,
E->isArrow(),
E->getAccessorLoc(),
12789template<
typename Derived>
12791TreeTransform<Derived>::TransformInitListExpr(InitListExpr *
E) {
12792 if (InitListExpr *Syntactic =
E->getSyntacticForm())
12795 bool InitChanged =
false;
12797 EnterExpressionEvaluationContext Context(
12801 if (getDerived().TransformExprs(
E->getInits(),
E->getNumInits(),
false,
12802 Inits, &InitChanged))
12805 if (!getDerived().AlwaysRebuild() && !InitChanged) {
12812 return getDerived().RebuildInitList(
E->getLBraceLoc(), Inits,
12813 E->getRBraceLoc());
12816template<
typename Derived>
12818TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *
E) {
12823 if (
Init.isInvalid())
12828 bool ExprChanged =
false;
12829 for (
const DesignatedInitExpr::Designator &
D :
E->designators()) {
12830 if (
D.isFieldDesignator()) {
12831 if (
D.getFieldDecl()) {
12832 FieldDecl *
Field = cast_or_null<FieldDecl>(
12833 getDerived().TransformDecl(
D.getFieldLoc(),
D.getFieldDecl()));
12834 if (Field !=
D.getFieldDecl())
12837 ExprChanged =
true;
12838 if (
Field->isAnonymousStructOrUnion())
12844 ExprChanged =
true;
12847 D.getFieldName(),
D.getDotLoc(),
D.getFieldLoc()));
12851 if (
D.isArrayDesignator()) {
12852 ExprResult Index = getDerived().TransformExpr(
E->getArrayIndex(
D));
12853 if (Index.isInvalid())
12856 Desig.AddDesignator(
12859 ExprChanged = ExprChanged ||
Init.get() !=
E->getArrayIndex(
D);
12860 ArrayExprs.push_back(Index.get());
12864 assert(
D.isArrayRangeDesignator() &&
"New kind of designator?");
12866 = getDerived().TransformExpr(
E->getArrayRangeStart(
D));
12867 if (Start.isInvalid())
12870 ExprResult End = getDerived().TransformExpr(
E->getArrayRangeEnd(
D));
12871 if (End.isInvalid())
12875 Start.get(), End.get(),
D.getLBracketLoc(),
D.getEllipsisLoc()));
12877 ExprChanged = ExprChanged || Start.get() !=
E->getArrayRangeStart(
D) ||
12878 End.get() !=
E->getArrayRangeEnd(
D);
12880 ArrayExprs.push_back(Start.get());
12881 ArrayExprs.push_back(End.get());
12884 if (!getDerived().AlwaysRebuild() &&
12885 Init.get() ==
E->getInit() &&
12889 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
12890 E->getEqualOrColonLoc(),
12891 E->usesGNUSyntax(),
Init.get());
12896template<
typename Derived>
12898TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
12899 DesignatedInitUpdateExpr *
E) {
12900 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
12905template<
typename Derived>
12907TreeTransform<Derived>::TransformNoInitExpr(
12909 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
12913template<
typename Derived>
12915TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *
E) {
12916 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
12920template<
typename Derived>
12922TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *
E) {
12923 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
12927template<
typename Derived>
12929TreeTransform<Derived>::TransformImplicitValueInitExpr(
12930 ImplicitValueInitExpr *
E) {
12931 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
12935 QualType
T = getDerived().TransformType(
E->
getType());
12939 if (!getDerived().AlwaysRebuild() &&
12943 return getDerived().RebuildImplicitValueInitExpr(
T);
12946template<
typename Derived>
12948TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *
E) {
12949 TypeSourceInfo *TInfo = getDerived().TransformType(
E->getWrittenTypeInfo());
12953 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
12954 if (SubExpr.isInvalid())
12957 if (!getDerived().AlwaysRebuild() &&
12958 TInfo ==
E->getWrittenTypeInfo() &&
12959 SubExpr.get() ==
E->getSubExpr())
12962 return getDerived().RebuildVAArgExpr(
E->getBuiltinLoc(), SubExpr.get(),
12963 TInfo,
E->getRParenLoc());
12966template<
typename Derived>
12968TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *
E) {
12969 bool ArgumentChanged =
false;
12971 if (TransformExprs(
E->getExprs(),
E->getNumExprs(),
true, Inits,
12975 return getDerived().RebuildParenListExpr(
E->getLParenLoc(),
12977 E->getRParenLoc());
12985template<
typename Derived>
12987TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *
E) {
12988 Decl *LD = getDerived().TransformDecl(
E->getLabel()->getLocation(),
12993 return getDerived().RebuildAddrLabelExpr(
E->getAmpAmpLoc(),
E->getLabelLoc(),
12994 cast<LabelDecl>(LD));
12997template<
typename Derived>
12999TreeTransform<Derived>::TransformStmtExpr(StmtExpr *
E) {
13002 = getDerived().TransformCompoundStmt(
E->getSubStmt(),
true);
13003 if (SubStmt.isInvalid()) {
13008 unsigned OldDepth =
E->getTemplateDepth();
13009 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13011 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13012 SubStmt.get() ==
E->getSubStmt()) {
13018 return getDerived().RebuildStmtExpr(
E->getLParenLoc(), SubStmt.get(),
13019 E->getRParenLoc(), NewDepth);
13022template<
typename Derived>
13024TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *
E) {
13025 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13026 if (Cond.isInvalid())
13029 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13030 if (LHS.isInvalid())
13033 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13034 if (RHS.isInvalid())
13037 if (!getDerived().AlwaysRebuild() &&
13038 Cond.get() ==
E->getCond() &&
13039 LHS.get() ==
E->getLHS() &&
13040 RHS.get() ==
E->getRHS())
13043 return getDerived().RebuildChooseExpr(
E->getBuiltinLoc(),
13044 Cond.get(), LHS.get(), RHS.get(),
13045 E->getRParenLoc());
13048template<
typename Derived>
13050TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *
E) {
13054template<
typename Derived>
13056TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *
E) {
13057 switch (
E->getOperator()) {
13061 case OO_Array_Delete:
13062 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
13067 assert(
E->getNumArgs() >= 1 &&
"Object call is missing arguments");
13076 static_cast<Expr *
>(
Object.get())->getEndLoc());
13080 if (getDerived().TransformExprs(
E->getArgs() + 1,
E->getNumArgs() - 1,
true,
13084 if (
E->getOperator() == OO_Subscript)
13085 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
13088 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
13092#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
13096#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
13097#include "clang/Basic/OperatorKinds.def"
13099 case OO_Conditional:
13100 llvm_unreachable(
"conditional operator is not actually overloadable");
13104 llvm_unreachable(
"not an overloaded operator?");
13108 if (
E->getNumArgs() == 1 &&
E->getOperator() == OO_Amp)
13109 First = getDerived().TransformAddressOfOperand(
E->getArg(0));
13111 First = getDerived().TransformExpr(
E->getArg(0));
13112 if (
First.isInvalid())
13116 if (
E->getNumArgs() == 2) {
13118 getDerived().TransformInitializer(
E->getArg(1),
false);
13119 if (Second.isInvalid())
13123 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13124 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13125 getSema().CurFPFeatures =
13126 NewOverrides.applyOverrides(getSema().getLangOpts());
13127 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13129 Expr *
Callee =
E->getCallee();
13130 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
13131 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
13133 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
13136 return getDerived().RebuildCXXOperatorCallExpr(
13137 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13138 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
13141 UnresolvedSet<1> Functions;
13142 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
13143 Callee = ICE->getSubExprAsWritten();
13144 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
13145 ValueDecl *VD = cast_or_null<ValueDecl>(
13146 getDerived().TransformDecl(DR->getLocation(), DR));
13150 if (!isa<CXXMethodDecl>(VD))
13151 Functions.addDecl(VD);
13153 return getDerived().RebuildCXXOperatorCallExpr(
13154 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13155 false, Functions,
First.get(), Second.get());
13158template<
typename Derived>
13160TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *
E) {
13161 return getDerived().TransformCallExpr(
E);
13164template <
typename Derived>
13165ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *
E) {
13167 getSema().CurContext !=
E->getParentContext();
13169 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
13172 return getDerived().RebuildSourceLocExpr(
E->getIdentKind(),
E->
getType(),
13174 getSema().CurContext);
13177template <
typename Derived>
13178ExprResult TreeTransform<Derived>::TransformEmbedExpr(EmbedExpr *
E) {
13182template<
typename Derived>
13184TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *
E) {
13191 ExprResult EC = getDerived().TransformCallExpr(
E->getConfig());
13192 if (EC.isInvalid())
13196 bool ArgChanged =
false;
13198 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13202 if (!getDerived().AlwaysRebuild() &&
13203 Callee.get() ==
E->getCallee() &&
13208 SourceLocation FakeLParenLoc
13210 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13212 E->getRParenLoc(), EC.get());
13215template<
typename Derived>
13223 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13227 if (!getDerived().AlwaysRebuild() &&
13228 Type ==
E->getTypeInfoAsWritten() &&
13229 SubExpr.
get() ==
E->getSubExpr())
13231 return getDerived().RebuildCXXNamedCastExpr(
13232 E->getOperatorLoc(),
E->
getStmtClass(),
E->getAngleBrackets().getBegin(),
13233 Type,
E->getAngleBrackets().getEnd(),
13235 E->getAngleBrackets().getEnd(), SubExpr.
get(),
E->getRParenLoc());
13238template<
typename Derived>
13247 if (Sub.isInvalid())
13250 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
13254template<
typename Derived>
13256TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *
E) {
13257 return getDerived().TransformCXXNamedCastExpr(
E);
13260template<
typename Derived>
13262TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *
E) {
13263 return getDerived().TransformCXXNamedCastExpr(
E);
13266template<
typename Derived>
13268TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
13269 CXXReinterpretCastExpr *
E) {
13270 return getDerived().TransformCXXNamedCastExpr(
E);
13273template<
typename Derived>
13275TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *
E) {
13276 return getDerived().TransformCXXNamedCastExpr(
E);
13279template<
typename Derived>
13281TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *
E) {
13282 return getDerived().TransformCXXNamedCastExpr(
E);
13285template<
typename Derived>
13287TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
13288 CXXFunctionalCastExpr *
E) {
13289 TypeSourceInfo *
Type =
13290 getDerived().TransformTypeWithDeducedTST(
E->getTypeInfoAsWritten());
13295 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13296 if (SubExpr.isInvalid())
13299 if (!getDerived().AlwaysRebuild() &&
13300 Type ==
E->getTypeInfoAsWritten() &&
13301 SubExpr.get() ==
E->getSubExpr())
13304 return getDerived().RebuildCXXFunctionalCastExpr(Type,
13308 E->isListInitialization());
13311template<
typename Derived>
13313TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *
E) {
13314 if (
E->isTypeOperand()) {
13315 TypeSourceInfo *TInfo
13316 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
13320 if (!getDerived().AlwaysRebuild() &&
13321 TInfo ==
E->getTypeOperandSourceInfo())
13331 Expr *Op =
E->getExprOperand();
13334 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
13335 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
13338 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
13341 ExprResult SubExpr = getDerived().TransformExpr(Op);
13342 if (SubExpr.isInvalid())
13345 if (!getDerived().AlwaysRebuild() &&
13346 SubExpr.get() ==
E->getExprOperand())
13353template<
typename Derived>
13355TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *
E) {
13356 if (
E->isTypeOperand()) {
13357 TypeSourceInfo *TInfo
13358 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
13362 if (!getDerived().AlwaysRebuild() &&
13363 TInfo ==
E->getTypeOperandSourceInfo())
13373 ExprResult SubExpr = getDerived().TransformExpr(
E->getExprOperand());
13374 if (SubExpr.isInvalid())
13377 if (!getDerived().AlwaysRebuild() &&
13378 SubExpr.get() ==
E->getExprOperand())
13385template<
typename Derived>
13387TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *
E) {
13391template<
typename Derived>
13393TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
13394 CXXNullPtrLiteralExpr *
E) {
13398template<
typename Derived>
13400TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *
E) {
13411 QualType
T = [&]() {
13412 auto &S = getSema();
13413 if (
E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
13416 return getDerived().TransformType(
E->
getType());
13420 if (!getDerived().AlwaysRebuild() &&
T ==
E->
getType()) {
13423 getSema().MarkThisReferenced(
E);
13427 return getDerived().RebuildCXXThisExpr(
E->
getBeginLoc(),
T,
E->isImplicit());
13430template<
typename Derived>
13432TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *
E) {
13433 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
13434 if (SubExpr.isInvalid())
13437 if (!getDerived().AlwaysRebuild() &&
13438 SubExpr.get() ==
E->getSubExpr())
13441 return getDerived().RebuildCXXThrowExpr(
E->getThrowLoc(), SubExpr.get(),
13442 E->isThrownVariableInScope());
13445template<
typename Derived>
13447TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *
E) {
13448 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
13449 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getParam()));
13454 if (
E->hasRewrittenInit()) {
13455 InitRes = getDerived().TransformExpr(
E->getRewrittenExpr());
13456 if (InitRes.isInvalid())
13460 if (!getDerived().AlwaysRebuild() && Param ==
E->getParam() &&
13462 InitRes.get() ==
E->getRewrittenExpr())
13465 return getDerived().RebuildCXXDefaultArgExpr(
E->getUsedLocation(), Param,
13469template<
typename Derived>
13471TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *
E) {
13472 FieldDecl *
Field = cast_or_null<FieldDecl>(
13473 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getField()));
13477 if (!getDerived().AlwaysRebuild() && Field ==
E->getField() &&
13481 return getDerived().RebuildCXXDefaultInitExpr(
E->
getExprLoc(), Field);
13484template<
typename Derived>
13486TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
13487 CXXScalarValueInitExpr *
E) {
13488 TypeSourceInfo *
T = getDerived().TransformType(
E->getTypeSourceInfo());
13492 if (!getDerived().AlwaysRebuild() &&
13493 T ==
E->getTypeSourceInfo())
13496 return getDerived().RebuildCXXScalarValueInitExpr(
T,
13497 T->getTypeLoc().getEndLoc(),
13498 E->getRParenLoc());
13501template<
typename Derived>
13503TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *
E) {
13505 TypeSourceInfo *AllocTypeInfo =
13506 getDerived().TransformTypeWithDeducedTST(
E->getAllocatedTypeSourceInfo());
13507 if (!AllocTypeInfo)
13511 std::optional<Expr *> ArraySize;
13512 if (
E->isArray()) {
13514 if (std::optional<Expr *> OldArraySize =
E->getArraySize()) {
13515 NewArraySize = getDerived().TransformExpr(*OldArraySize);
13516 if (NewArraySize.isInvalid())
13519 ArraySize = NewArraySize.get();
13523 bool ArgumentChanged =
false;
13525 if (getDerived().TransformExprs(
E->getPlacementArgs(),
13526 E->getNumPlacementArgs(),
true,
13527 PlacementArgs, &ArgumentChanged))
13531 Expr *OldInit =
E->getInitializer();
13534 NewInit = getDerived().TransformInitializer(OldInit,
true);
13535 if (NewInit.isInvalid())
13539 FunctionDecl *OperatorNew =
nullptr;
13540 if (
E->getOperatorNew()) {
13541 OperatorNew = cast_or_null<FunctionDecl>(
13542 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorNew()));
13547 FunctionDecl *OperatorDelete =
nullptr;
13548 if (
E->getOperatorDelete()) {
13549 OperatorDelete = cast_or_null<FunctionDecl>(
13550 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
13551 if (!OperatorDelete)
13555 if (!getDerived().AlwaysRebuild() &&
13556 AllocTypeInfo ==
E->getAllocatedTypeSourceInfo() &&
13557 ArraySize ==
E->getArraySize() &&
13558 NewInit.get() == OldInit &&
13559 OperatorNew ==
E->getOperatorNew() &&
13560 OperatorDelete ==
E->getOperatorDelete() &&
13561 !ArgumentChanged) {
13566 if (OperatorDelete)
13569 if (
E->isArray() && !
E->getAllocatedType()->isDependentType()) {
13570 QualType ElementType
13572 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
13573 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
13583 QualType AllocType = AllocTypeInfo->
getType();
13593 }
else if (
const ConstantArrayType *ConsArrayT
13594 = dyn_cast<ConstantArrayType>(ArrayT)) {
13598 AllocType = ConsArrayT->getElementType();
13599 }
else if (
const DependentSizedArrayType *DepArrayT
13600 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
13601 if (DepArrayT->getSizeExpr()) {
13602 ArraySize = DepArrayT->getSizeExpr();
13603 AllocType = DepArrayT->getElementType();
13608 return getDerived().RebuildCXXNewExpr(
13612 AllocTypeInfo, ArraySize,
E->getDirectInitRange(), NewInit.get());
13615template<
typename Derived>
13617TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *
E) {
13623 FunctionDecl *OperatorDelete =
nullptr;
13624 if (
E->getOperatorDelete()) {
13625 OperatorDelete = cast_or_null<FunctionDecl>(
13626 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
13627 if (!OperatorDelete)
13631 if (!getDerived().AlwaysRebuild() &&
13632 Operand.get() ==
E->getArgument() &&
13633 OperatorDelete ==
E->getOperatorDelete()) {
13636 if (OperatorDelete)
13641 E->getDestroyedType());
13642 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
13643 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
13652 return getDerived().RebuildCXXDeleteExpr(
13656template<
typename Derived>
13658TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
13659 CXXPseudoDestructorExpr *
E) {
13661 if (
Base.isInvalid())
13665 bool MayBePseudoDestructor =
false;
13667 E->getOperatorLoc(),
13668 E->isArrow()? tok::arrow : tok::period,
13670 MayBePseudoDestructor);
13671 if (
Base.isInvalid())
13674 QualType ObjectType = ObjectTypePtr.get();
13675 NestedNameSpecifierLoc QualifierLoc =
E->getQualifierLoc();
13676 if (QualifierLoc) {
13678 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
13683 SS.Adopt(QualifierLoc);
13685 PseudoDestructorTypeStorage Destroyed;
13686 if (
E->getDestroyedTypeInfo()) {
13687 TypeSourceInfo *DestroyedTypeInfo
13688 = getDerived().TransformTypeInObjectScope(
E->getDestroyedTypeInfo(),
13689 ObjectType,
nullptr, SS);
13690 if (!DestroyedTypeInfo)
13692 Destroyed = DestroyedTypeInfo;
13693 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
13696 Destroyed = PseudoDestructorTypeStorage(
E->getDestroyedTypeIdentifier(),
13697 E->getDestroyedTypeLoc());
13701 *
E->getDestroyedTypeIdentifier(),
E->getDestroyedTypeLoc(),
13702 nullptr, SS, ObjectTypePtr,
false);
13708 E->getDestroyedTypeLoc());
13711 TypeSourceInfo *ScopeTypeInfo =
nullptr;
13712 if (
E->getScopeTypeInfo()) {
13713 CXXScopeSpec EmptySS;
13714 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
13715 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
13716 if (!ScopeTypeInfo)
13720 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
13721 E->getOperatorLoc(),
13725 E->getColonColonLoc(),
13730template <
typename Derived>
13735 bool AllEmptyPacks =
true;
13736 for (
auto *OldD : Old->
decls()) {
13737 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
13741 if (isa<UsingShadowDecl>(OldD))
13750 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
13752 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
13753 Decls = UPD->expansions();
13756 for (
auto *
D : Decls) {
13757 if (
auto *UD = dyn_cast<UsingDecl>(
D)) {
13758 for (
auto *SD : UD->shadows())
13765 AllEmptyPacks &= Decls.empty();
13774 if (AllEmptyPacks && !RequiresADL) {
13775 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
13776 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
13786 getSema().FilterAcceptableTemplateNames(R,
13793 diag::err_template_kw_refers_to_non_template)
13797 diag::note_template_kw_refers_to_non_template)
13806template <
typename Derived>
13809 return TransformUnresolvedLookupExpr(Old,
false);
13812template <
typename Derived>
13815 bool IsAddressOfOperand) {
13820 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
13827 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
13831 SS.
Adopt(QualifierLoc);
13835 CXXRecordDecl *NamingClass
13836 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
13839 if (!NamingClass) {
13844 R.setNamingClass(NamingClass);
13865 SS, TemplateKWLoc, R,
13872 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
13875 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
13879template<
typename Derived>
13881TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *
E) {
13882 bool ArgChanged =
false;
13884 for (
unsigned I = 0, N =
E->getNumArgs(); I != N; ++I) {
13885 TypeSourceInfo *From =
E->getArg(I);
13886 TypeLoc FromTL = From->getTypeLoc();
13887 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
13888 TypeLocBuilder TLB;
13889 TLB.reserve(FromTL.getFullDataSize());
13890 QualType To = getDerived().TransformType(TLB, FromTL);
13894 if (To == From->getType())
13895 Args.push_back(From);
13897 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13906 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
13907 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
13913 bool Expand =
true;
13914 bool RetainExpansion =
false;
13915 std::optional<unsigned> OrigNumExpansions =
13916 ExpansionTL.getTypePtr()->getNumExpansions();
13917 std::optional<unsigned> NumExpansions = OrigNumExpansions;
13918 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
13919 PatternTL.getSourceRange(),
13921 Expand, RetainExpansion,
13929 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
13931 TypeLocBuilder TLB;
13932 TLB.reserve(From->getTypeLoc().getFullDataSize());
13934 QualType To = getDerived().TransformType(TLB, PatternTL);
13938 To = getDerived().RebuildPackExpansionType(To,
13939 PatternTL.getSourceRange(),
13940 ExpansionTL.getEllipsisLoc(),
13945 PackExpansionTypeLoc ToExpansionTL
13946 = TLB.push<PackExpansionTypeLoc>(To);
13947 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13948 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13954 for (
unsigned I = 0; I != *NumExpansions; ++I) {
13955 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
13956 TypeLocBuilder TLB;
13957 TLB.reserve(PatternTL.getFullDataSize());
13958 QualType To = getDerived().TransformType(TLB, PatternTL);
13962 if (To->containsUnexpandedParameterPack()) {
13963 To = getDerived().RebuildPackExpansionType(To,
13964 PatternTL.getSourceRange(),
13965 ExpansionTL.getEllipsisLoc(),
13970 PackExpansionTypeLoc ToExpansionTL
13971 = TLB.push<PackExpansionTypeLoc>(To);
13972 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13975 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13978 if (!RetainExpansion)
13983 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
13985 TypeLocBuilder TLB;
13986 TLB.reserve(From->getTypeLoc().getFullDataSize());
13988 QualType To = getDerived().TransformType(TLB, PatternTL);
13992 To = getDerived().RebuildPackExpansionType(To,
13993 PatternTL.getSourceRange(),
13994 ExpansionTL.getEllipsisLoc(),
13999 PackExpansionTypeLoc ToExpansionTL
14000 = TLB.push<PackExpansionTypeLoc>(To);
14001 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14002 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14005 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14008 return getDerived().RebuildTypeTrait(
E->getTrait(),
E->
getBeginLoc(), Args,
14012template<
typename Derived>
14014TreeTransform<Derived>::TransformConceptSpecializationExpr(
14015 ConceptSpecializationExpr *
E) {
14016 const ASTTemplateArgumentListInfo *Old =
E->getTemplateArgsAsWritten();
14017 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
14018 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14019 Old->NumTemplateArgs, TransArgs))
14022 return getDerived().RebuildConceptSpecializationExpr(
14023 E->getNestedNameSpecifierLoc(),
E->getTemplateKWLoc(),
14024 E->getConceptNameInfo(),
E->getFoundDecl(),
E->getNamedConcept(),
14028template<
typename Derived>
14030TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *
E) {
14033 Sema::ExtParameterInfoBuilder ExtParamInfos;
14037 EnterExpressionEvaluationContext Ctx(
14042 getSema().Context, getSema().CurContext,
14045 Sema::ContextRAII SavedContext(getSema(), Body,
false);
14047 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
14048 E->getRequiresKWLoc(),
E->getRBraceLoc(),
E, Body,
14049 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
14051 for (ParmVarDecl *Param : TransParams)
14053 Param->setDeclContext(Body);
14059 if (!TypeParamResult.isUnset())
14060 return TypeParamResult;
14063 if (getDerived().TransformRequiresExprRequirements(
E->getRequirements(),
14067 for (concepts::Requirement *Req : TransReqs) {
14068 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
14069 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
14070 ER->getReturnTypeRequirement()
14071 .getTypeConstraintTemplateParameterList()->getParam(0)
14072 ->setDeclContext(Body);
14077 return getDerived().RebuildRequiresExpr(
14078 E->getRequiresKWLoc(), Body,
E->getLParenLoc(), TransParams,
14079 E->getRParenLoc(), TransReqs,
E->getRBraceLoc());
14082template<
typename Derived>
14088 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
14089 TransReq = getDerived().TransformTypeRequirement(TypeReq);
14090 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
14091 TransReq = getDerived().TransformExprRequirement(ExprReq);
14093 TransReq = getDerived().TransformNestedRequirement(
14094 cast<concepts::NestedRequirement>(Req));
14097 Transformed.push_back(TransReq);
14102template<
typename Derived>
14107 if (getDerived().AlwaysRebuild())
14108 return getDerived().RebuildTypeRequirement(
14115 return getDerived().RebuildTypeRequirement(TransType);
14118template<
typename Derived>
14121 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
14130 TransExpr = TransExprRes.
get();
14133 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
14135 if (RetReq.isEmpty())
14136 TransRetReq.emplace();
14137 else if (RetReq.isSubstitutionFailure())
14138 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
14139 else if (RetReq.isTypeConstraint()) {
14141 RetReq.getTypeConstraintTemplateParameterList();
14143 getDerived().TransformTemplateParameterList(OrigTPL);
14146 TransRetReq.emplace(TPL);
14148 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
14149 if (
Expr *
E = TransExpr.dyn_cast<
Expr *>())
14150 return getDerived().RebuildExprRequirement(
E, Req->
isSimple(),
14152 std::move(*TransRetReq));
14153 return getDerived().RebuildExprRequirement(
14158template<
typename Derived>
14163 if (getDerived().AlwaysRebuild())
14164 return getDerived().RebuildNestedRequirement(
14172 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
14175template<
typename Derived>
14178 TypeSourceInfo *
T = getDerived().TransformType(
E->getQueriedTypeSourceInfo());
14182 if (!getDerived().AlwaysRebuild() &&
14183 T ==
E->getQueriedTypeSourceInfo())
14190 SubExpr = getDerived().TransformExpr(
E->getDimensionExpression());
14194 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getDimensionExpression())
14198 return getDerived().RebuildArrayTypeTrait(
E->getTrait(),
E->
getBeginLoc(),
T,
14202template<
typename Derived>
14204TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *
E) {
14209 SubExpr = getDerived().TransformExpr(
E->getQueriedExpression());
14210 if (SubExpr.isInvalid())
14213 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getQueriedExpression())
14217 return getDerived().RebuildExpressionTrait(
E->getTrait(),
E->
getBeginLoc(),
14221template <
typename Derived>
14225 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
14226 DRE, AddrTaken, RecoveryTSI);
14233 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
14235 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
14239template <
typename Derived>
14242 return TransformDependentScopeDeclRefExpr(
E,
false,
14246template <
typename Derived>
14250 assert(
E->getQualifierLoc());
14252 getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
14262 getDerived().TransformDeclarationNameInfo(
E->getNameInfo());
14266 if (!
E->hasExplicitTemplateArgs()) {
14267 if (!getDerived().AlwaysRebuild() && QualifierLoc ==
E->getQualifierLoc() &&
14270 NameInfo.
getName() ==
E->getDeclName())
14273 return getDerived().RebuildDependentScopeDeclRefExpr(
14274 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
14275 IsAddressOfOperand, RecoveryTSI);
14278 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
14279 if (getDerived().TransformTemplateArguments(
14280 E->getTemplateArgs(),
E->getNumTemplateArgs(), TransArgs))
14283 return getDerived().RebuildDependentScopeDeclRefExpr(
14284 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
14288template<
typename Derived>
14290TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *
E) {
14294 if (getDerived().AllowSkippingCXXConstructExpr() &&
14295 ((
E->getNumArgs() == 1 ||
14296 (
E->getNumArgs() > 1 && getDerived().DropCallArgument(
E->getArg(1)))) &&
14297 (!getDerived().DropCallArgument(
E->getArg(0))) &&
14298 !
E->isListInitialization()))
14299 return getDerived().TransformInitializer(
E->getArg(0),
14302 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
14304 QualType
T = getDerived().TransformType(
E->
getType());
14308 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14309 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14313 bool ArgumentChanged =
false;
14316 EnterExpressionEvaluationContext Context(
14318 E->isListInitialization());
14319 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14324 if (!getDerived().AlwaysRebuild() &&
14326 Constructor ==
E->getConstructor() &&
14327 !ArgumentChanged) {
14334 return getDerived().RebuildCXXConstructExpr(
14336 E->hadMultipleCandidates(),
E->isListInitialization(),
14337 E->isStdInitListInitialization(),
E->requiresZeroInitialization(),
14338 E->getConstructionKind(),
E->getParenOrBraceRange());
14341template<
typename Derived>
14342ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
14343 CXXInheritedCtorInitExpr *
E) {
14344 QualType
T = getDerived().TransformType(
E->
getType());
14348 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14349 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14353 if (!getDerived().AlwaysRebuild() &&
14355 Constructor ==
E->getConstructor()) {
14362 return getDerived().RebuildCXXInheritedCtorInitExpr(
14363 T,
E->getLocation(), Constructor,
14364 E->constructsVBase(),
E->inheritedFromVBase());
14371template<
typename Derived>
14373TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *
E) {
14374 if (
auto *Dtor =
E->getTemporary()->getDestructor())
14376 const_cast<CXXDestructorDecl *
>(Dtor));
14377 return getDerived().TransformExpr(
E->getSubExpr());
14385template<
typename Derived>
14387TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *
E) {
14388 return getDerived().TransformExpr(
E->getSubExpr());
14391template<
typename Derived>
14393TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
14394 CXXTemporaryObjectExpr *
E) {
14395 TypeSourceInfo *
T =
14396 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
14400 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14401 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14405 bool ArgumentChanged =
false;
14407 Args.reserve(
E->getNumArgs());
14409 EnterExpressionEvaluationContext Context(
14411 E->isListInitialization());
14412 if (TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14417 if (!getDerived().AlwaysRebuild() &&
14418 T ==
E->getTypeSourceInfo() &&
14419 Constructor ==
E->getConstructor() &&
14420 !ArgumentChanged) {
14428 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
14429 return getDerived().RebuildCXXTemporaryObjectExpr(
14434template<
typename Derived>
14436TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *
E) {
14439 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
14440 struct TransformedInitCapture {
14442 SourceLocation EllipsisLoc;
14447 InitCaptures.resize(
E->explicit_capture_end() -
E->explicit_capture_begin());
14449 CEnd =
E->capture_end();
14451 if (!
E->isInitCapture(
C))
14454 TransformedInitCapture &
Result = InitCaptures[
C -
E->capture_begin()];
14455 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
14457 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
14458 std::optional<unsigned> NumExpansions) {
14459 ExprResult NewExprInitResult = getDerived().TransformInitializer(
14462 if (NewExprInitResult.isInvalid()) {
14463 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
14466 Expr *NewExprInit = NewExprInitResult.get();
14468 QualType NewInitCaptureType =
14469 getSema().buildLambdaInitCaptureInitialization(
14470 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
14471 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
14472 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
14475 Result.Expansions.push_back(
14476 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
14480 if (OldVD->isParameterPack()) {
14481 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
14483 .castAs<PackExpansionTypeLoc>();
14489 bool Expand =
true;
14490 bool RetainExpansion =
false;
14491 std::optional<unsigned> OrigNumExpansions =
14492 ExpansionTL.getTypePtr()->getNumExpansions();
14493 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14494 if (getDerived().TryExpandParameterPacks(
14495 ExpansionTL.getEllipsisLoc(),
14496 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
14497 RetainExpansion, NumExpansions))
14499 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
14500 "capture since it cannot be extended");
14502 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14503 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14504 SubstInitCapture(SourceLocation(), std::nullopt);
14507 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
14508 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
14511 SubstInitCapture(SourceLocation(), std::nullopt);
14515 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
14516 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
14527 DeclContext *DC = getSema().CurContext;
14545 while (DC->isRequiresExprBody())
14546 DC = DC->getParent();
14547 if ((getSema().isUnevaluatedContext() ||
14548 getSema().isConstantEvaluatedContext()) &&
14549 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
14552 CXXRecordDecl *OldClass =
E->getLambdaClass();
14553 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
14554 E->getIntroducerRange(),
nullptr, DependencyKind,
14555 E->getCaptureDefault());
14556 getDerived().transformedLocalDecl(OldClass, {
Class});
14558 CXXMethodDecl *NewCallOperator =
14559 getSema().CreateLambdaCallOperator(
E->getIntroducerRange(),
Class);
14562 getSema().buildLambdaScope(LSI, NewCallOperator,
E->getIntroducerRange(),
14563 E->getCaptureDefault(),
E->getCaptureDefaultLoc(),
14564 E->hasExplicitParameters(),
E->isMutable());
14567 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
14574 CEnd =
E->capture_end();
14578 if (
C->isImplicit())
14582 if (
C->capturesThis()) {
14588 Sema::CXXThisScopeRAII ThisScope(
14590 dyn_cast_if_present<CXXRecordDecl>(
14591 getSema().getFunctionLevelDeclContext()),
14593 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
14600 if (
C->capturesVLAType())
14604 if (
E->isInitCapture(
C)) {
14605 TransformedInitCapture &NewC = InitCaptures[
C -
E->capture_begin()];
14607 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
14610 for (InitCaptureInfoTy &Info : NewC.Expansions) {
14612 QualType InitQualType = Info.second;
14613 if (
Init.isInvalid() || InitQualType.isNull()) {
14617 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
14618 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
14619 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
14620 getSema().CurContext);
14625 NewVDs.push_back(NewVD);
14626 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
14631 if (NewC.EllipsisLoc.isInvalid())
14632 LSI->ContainsUnexpandedParameterPack |=
14633 Init.get()->containsUnexpandedParameterPack();
14639 getDerived().transformedLocalDecl(OldVD, NewVDs);
14643 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
14651 SourceLocation EllipsisLoc;
14652 if (
C->isPackExpansion()) {
14654 bool ShouldExpand =
false;
14655 bool RetainExpansion =
false;
14656 std::optional<unsigned> NumExpansions;
14657 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
14660 ShouldExpand, RetainExpansion,
14666 if (ShouldExpand) {
14670 auto *Pack = cast<VarDecl>(
C->getCapturedVar());
14671 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14672 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14673 VarDecl *CapturedVar
14674 = cast_or_null<VarDecl>(getDerived().TransformDecl(
C->getLocation(),
14676 if (!CapturedVar) {
14682 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
14690 EllipsisLoc =
C->getEllipsisLoc();
14694 auto *CapturedVar = cast_or_null<ValueDecl>(
14695 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
14696 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
14703 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
14704 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
14707 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
14710 getSema().finishLambdaExplicitCaptures(LSI);
14714 auto TPL = getDerived().TransformTemplateParameterList(
14715 E->getTemplateParameterList());
14716 LSI->GLTemplateParameterList = TPL;
14718 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
14720 LSI->ContainsUnexpandedParameterPack |=
14721 TPL->containsUnexpandedParameterPack();
14728 TypeSourceInfo *NewCallOpTSI =
nullptr;
14730 auto OldCallOpTypeLoc =
14731 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
14733 auto TransformFunctionProtoTypeLoc =
14734 [
this](TypeLocBuilder &TLB, FunctionProtoTypeLoc FPTL) -> QualType {
14736 return this->TransformFunctionProtoType(
14737 TLB, FPTL,
nullptr, Qualifiers(),
14738 [&](FunctionProtoType::ExceptionSpecInfo &ESI,
bool &Changed) {
14739 return TransformExceptionSpec(FPTL.getBeginLoc(), ESI,
14740 ExceptionStorage, Changed);
14744 QualType NewCallOpType;
14745 TypeLocBuilder NewCallOpTLBuilder;
14747 if (
auto ATL = OldCallOpTypeLoc.getAs<AttributedTypeLoc>()) {
14748 NewCallOpType = this->TransformAttributedType(
14749 NewCallOpTLBuilder, ATL,
14750 [&](TypeLocBuilder &TLB, TypeLoc TL) -> QualType {
14751 return TransformFunctionProtoTypeLoc(
14752 TLB, TL.castAs<FunctionProtoTypeLoc>());
14755 auto FPTL = OldCallOpTypeLoc.castAs<FunctionProtoTypeLoc>();
14756 NewCallOpType = TransformFunctionProtoTypeLoc(NewCallOpTLBuilder, FPTL);
14759 if (NewCallOpType.isNull())
14761 LSI->ContainsUnexpandedParameterPack |=
14762 NewCallOpType->containsUnexpandedParameterPack();
14764 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
14768 if (
auto ATL = NewCallOpTSI->getTypeLoc().getAs<AttributedTypeLoc>()) {
14769 Params = ATL.getModifiedLoc().castAs<FunctionProtoTypeLoc>().getParams();
14771 auto FPTL = NewCallOpTSI->getTypeLoc().castAs<FunctionProtoTypeLoc>();
14772 Params = FPTL.getParams();
14775 getSema().CompleteLambdaCallOperator(
14776 NewCallOperator,
E->getCallOperator()->getLocation(),
14777 E->getCallOperator()->getInnerLocStart(),
14778 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
14779 E->getCallOperator()->getConstexprKind(),
14780 E->getCallOperator()->getStorageClass(), Params,
14781 E->hasExplicitResultType());
14783 getDerived().transformAttrs(
E->getCallOperator(), NewCallOperator);
14784 getDerived().transformedLocalDecl(
E->getCallOperator(), {NewCallOperator});
14788 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
14790 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
14791 if (getDerived().ReplacingOriginal()) {
14792 Numbering = OldClass->getLambdaNumbering();
14795 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
14800 getSema().PushExpressionEvaluationContext(
14801 E->getCallOperator()->isConsteval() ?
14804 getSema().currentEvaluationContext().InImmediateEscalatingFunctionContext =
14805 getSema().getLangOpts().CPlusPlus20 &&
14806 E->getCallOperator()->isImmediateEscalating();
14808 Sema::CodeSynthesisContext
C;
14811 getSema().pushCodeSynthesisContext(
C);
14817 getSema().popCodeSynthesisContext();
14820 FuncScopeCleanup.disable();
14822 if (Body.isInvalid()) {
14823 SavedContext.pop();
14832 auto LSICopy = *LSI;
14833 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
14835 SavedContext.pop();
14870 DependencyKind = getDerived().ComputeLambdaDependency(&LSICopy);
14871 Class->setLambdaDependencyKind(DependencyKind);
14874 Class->setTypeForDecl(
nullptr);
14875 getSema().Context.getTypeDeclType(
Class);
14877 return getDerived().RebuildLambdaExpr(
E->
getBeginLoc(),
14878 Body.get()->getEndLoc(), &LSICopy);
14881template<
typename Derived>
14884 return TransformStmt(S);
14887template<
typename Derived>
14892 CEnd =
E->capture_end();
14896 if (!
C->isImplicit())
14900 if (
C->capturesThis()) {
14901 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
14908 if (
C->capturesVLAType())
14911 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
14912 assert(!
E->isInitCapture(
C) &&
"implicit init-capture?");
14915 VarDecl *CapturedVar = cast_or_null<VarDecl>(
14916 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
14921 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
14927template<
typename Derived>
14932 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
14936 bool ArgumentChanged =
false;
14938 Args.reserve(
E->getNumArgs());
14942 E->isListInitialization());
14943 if (getDerived().TransformExprs(
E->arg_begin(),
E->getNumArgs(),
true, Args,
14948 if (!getDerived().AlwaysRebuild() &&
14949 T ==
E->getTypeSourceInfo() &&
14954 return getDerived().RebuildCXXUnresolvedConstructExpr(
14955 T,
E->getLParenLoc(), Args,
E->getRParenLoc(),
E->isListInitialization());
14958template<
typename Derived>
14960TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
14961 CXXDependentScopeMemberExpr *
E) {
14966 QualType ObjectType;
14967 if (!
E->isImplicitAccess()) {
14968 OldBase =
E->getBase();
14969 Base = getDerived().TransformExpr(OldBase);
14970 if (
Base.isInvalid())
14975 bool MayBePseudoDestructor =
false;
14977 E->getOperatorLoc(),
14978 E->isArrow()? tok::arrow : tok::period,
14980 MayBePseudoDestructor);
14981 if (
Base.isInvalid())
14984 ObjectType = ObjectTy.get();
14985 BaseType = ((Expr*)
Base.get())->getType();
14988 BaseType = getDerived().TransformType(
E->getBaseType());
14994 NamedDecl *FirstQualifierInScope
14995 = getDerived().TransformFirstQualifierInScope(
14996 E->getFirstQualifierFoundInScope(),
14999 NestedNameSpecifierLoc QualifierLoc;
15000 if (
E->getQualifier()) {
15002 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc(),
15004 FirstQualifierInScope);
15009 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
15015 DeclarationNameInfo NameInfo
15016 = getDerived().TransformDeclarationNameInfo(
E->getMemberNameInfo());
15017 if (!NameInfo.getName())
15020 if (!
E->hasExplicitTemplateArgs()) {
15023 if (!getDerived().AlwaysRebuild() &&
15024 Base.get() == OldBase &&
15025 BaseType ==
E->getBaseType() &&
15026 QualifierLoc ==
E->getQualifierLoc() &&
15027 NameInfo.getName() ==
E->getMember() &&
15028 FirstQualifierInScope ==
E->getFirstQualifierFoundInScope())
15031 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15034 E->getOperatorLoc(),
15037 FirstQualifierInScope,
15042 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15043 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
15044 E->getNumTemplateArgs(),
15048 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15051 E->getOperatorLoc(),
15054 FirstQualifierInScope,
15059template <
typename Derived>
15060ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
15061 UnresolvedMemberExpr *Old) {
15065 if (!Old->isImplicitAccess()) {
15066 Base = getDerived().TransformExpr(Old->getBase());
15067 if (
Base.isInvalid())
15070 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
15071 if (
Base.isInvalid())
15073 BaseType =
Base.get()->getType();
15075 BaseType = getDerived().TransformType(Old->getBaseType());
15078 NestedNameSpecifierLoc QualifierLoc;
15079 if (Old->getQualifierLoc()) {
15081 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
15086 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
15091 if (TransformOverloadExprDecls(Old,
false, R))
15095 if (Old->getNamingClass()) {
15096 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
15097 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
15101 R.setNamingClass(NamingClass);
15104 TemplateArgumentListInfo TransArgs;
15105 if (Old->hasExplicitTemplateArgs()) {
15106 TransArgs.setLAngleLoc(Old->getLAngleLoc());
15107 TransArgs.setRAngleLoc(Old->getRAngleLoc());
15108 if (getDerived().TransformTemplateArguments(
15109 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
15117 NamedDecl *FirstQualifierInScope =
nullptr;
15119 return getDerived().RebuildUnresolvedMemberExpr(
15120 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
15121 TemplateKWLoc, FirstQualifierInScope, R,
15122 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
15125template<
typename Derived>
15127TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *
E) {
15130 ExprResult SubExpr = getDerived().TransformExpr(
E->getOperand());
15131 if (SubExpr.isInvalid())
15134 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getOperand())
15137 return getDerived().RebuildCXXNoexceptExpr(
E->
getSourceRange(),SubExpr.get());
15140template<
typename Derived>
15142TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *
E) {
15143 ExprResult Pattern = getDerived().TransformExpr(
E->getPattern());
15144 if (Pattern.isInvalid())
15147 if (!getDerived().AlwaysRebuild() && Pattern.get() ==
E->getPattern())
15150 return getDerived().RebuildPackExpansion(Pattern.get(),
E->getEllipsisLoc(),
15151 E->getNumExpansions());
15154template<
typename Derived>
15156TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *
E) {
15166 TemplateArgument ArgStorage;
15169 if (
E->isPartiallySubstituted()) {
15170 PackArgs =
E->getPartialArguments();
15173 bool ShouldExpand =
false;
15174 bool RetainExpansion =
false;
15175 std::optional<unsigned> NumExpansions;
15176 if (getDerived().TryExpandParameterPacks(
E->getOperatorLoc(),
E->getPackLoc(),
15178 ShouldExpand, RetainExpansion,
15184 if (ShouldExpand) {
15185 auto *Pack =
E->getPack();
15186 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
15187 ArgStorage = getSema().Context.getPackExpansionType(
15189 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
15190 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
15192 auto *VD = cast<ValueDecl>(Pack);
15193 ExprResult DRE = getSema().BuildDeclRefExpr(
15194 VD, VD->getType().getNonLValueExprType(getSema().Context),
15197 if (DRE.isInvalid())
15199 ArgStorage =
new (getSema().Context)
15200 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
15201 E->getPackLoc(), std::nullopt);
15203 PackArgs = ArgStorage;
15208 if (!PackArgs.size()) {
15209 auto *Pack = cast_or_null<NamedDecl>(
15210 getDerived().TransformDecl(
E->getPackLoc(),
E->getPack()));
15213 return getDerived().RebuildSizeOfPackExpr(
15214 E->getOperatorLoc(), Pack,
E->getPackLoc(),
E->getRParenLoc(),
15215 std::nullopt, std::nullopt);
15219 std::optional<unsigned>
Result = 0;
15220 for (
const TemplateArgument &Arg : PackArgs) {
15221 if (!Arg.isPackExpansion()) {
15226 TemplateArgumentLoc ArgLoc;
15227 InventTemplateArgumentLoc(Arg, ArgLoc);
15230 SourceLocation Ellipsis;
15231 std::optional<unsigned> OrigNumExpansions;
15232 TemplateArgumentLoc Pattern =
15233 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
15234 OrigNumExpansions);
15237 TemplateArgumentLoc OutPattern;
15238 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15239 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
15244 std::optional<unsigned> NumExpansions =
15245 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
15246 if (!NumExpansions) {
15259 return getDerived().RebuildSizeOfPackExpr(
15260 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
15263 TemplateArgumentListInfo TransformedPackArgs(
E->getPackLoc(),
15266 TemporaryBase Rebase(*
this,
E->getPackLoc(), getBaseEntity());
15267 typedef TemplateArgumentLocInventIterator<
15268 Derived,
const TemplateArgument*> PackLocIterator;
15269 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
15270 PackLocIterator(*
this, PackArgs.end()),
15271 TransformedPackArgs,
true))
15278 bool PartialSubstitution =
false;
15279 for (
auto &
Loc : TransformedPackArgs.arguments()) {
15280 Args.push_back(
Loc.getArgument());
15281 if (
Loc.getArgument().isPackExpansion())
15282 PartialSubstitution =
true;
15285 if (PartialSubstitution)
15286 return getDerived().RebuildSizeOfPackExpr(
15287 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
15288 std::nullopt, Args);
15290 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
15291 E->getPackLoc(),
E->getRParenLoc(),
15292 Args.size(), std::nullopt);
15295template <
typename Derived>
15297TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *
E) {
15302 ExprResult IndexExpr = getDerived().TransformExpr(
E->getIndexExpr());
15303 if (IndexExpr.isInvalid())
15307 if (!
E->expandsToEmptyPack() &&
E->getExpressions().empty()) {
15308 Expr *Pattern =
E->getPackIdExpression();
15310 getSema().collectUnexpandedParameterPacks(
E->getPackIdExpression(),
15312 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15316 bool ShouldExpand =
true;
15317 bool RetainExpansion =
false;
15318 std::optional<unsigned> OrigNumExpansions;
15319 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15320 if (getDerived().TryExpandParameterPacks(
15322 ShouldExpand, RetainExpansion, NumExpansions))
15324 if (!ShouldExpand) {
15325 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15326 ExprResult Pack = getDerived().TransformExpr(Pattern);
15327 if (Pack.isInvalid())
15329 return getDerived().RebuildPackIndexingExpr(
15330 E->getEllipsisLoc(),
E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
15333 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15334 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15335 ExprResult Out = getDerived().TransformExpr(Pattern);
15336 if (Out.isInvalid())
15338 if (Out.get()->containsUnexpandedParameterPack()) {
15339 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
15340 OrigNumExpansions);
15341 if (Out.isInvalid())
15344 ExpandedExprs.push_back(Out.get());
15348 if (RetainExpansion) {
15349 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15351 ExprResult Out = getDerived().TransformExpr(Pattern);
15352 if (Out.isInvalid())
15355 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
15356 OrigNumExpansions);
15357 if (Out.isInvalid())
15359 ExpandedExprs.push_back(Out.get());
15361 }
else if (!
E->expandsToEmptyPack()) {
15362 if (getDerived().TransformExprs(
E->getExpressions().data(),
15363 E->getExpressions().size(),
false,
15368 return getDerived().RebuildPackIndexingExpr(
15369 E->getEllipsisLoc(),
E->getRSquareLoc(),
E->getPackIdExpression(),
15370 IndexExpr.get(), ExpandedExprs,
15371 ExpandedExprs.size() == 0);
15374template<
typename Derived>
15376TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
15377 SubstNonTypeTemplateParmPackExpr *
E) {
15382template<
typename Derived>
15384TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
15385 SubstNonTypeTemplateParmExpr *
E) {
15390template<
typename Derived>
15392TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *
E) {
15397template<
typename Derived>
15399TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
15400 MaterializeTemporaryExpr *
E) {
15401 return getDerived().TransformExpr(
E->getSubExpr());
15404template<
typename Derived>
15406TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *
E) {
15407 UnresolvedLookupExpr *
Callee =
nullptr;
15408 if (Expr *OldCallee =
E->getCallee()) {
15409 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
15410 if (CalleeResult.isInvalid())
15412 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
15415 Expr *Pattern =
E->getPattern();
15418 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
15419 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15423 bool Expand =
true;
15424 bool RetainExpansion =
false;
15425 std::optional<unsigned> OrigNumExpansions =
E->getNumExpansions(),
15426 NumExpansions = OrigNumExpansions;
15427 if (getDerived().TryExpandParameterPacks(
E->getEllipsisLoc(),
15430 Expand, RetainExpansion,
15437 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15440 E->getLHS() ? getDerived().TransformExpr(
E->getLHS()) :
ExprResult();
15441 if (LHS.isInvalid())
15445 E->getRHS() ? getDerived().TransformExpr(
E->getRHS()) :
ExprResult();
15446 if (RHS.isInvalid())
15449 if (!getDerived().AlwaysRebuild() &&
15450 LHS.get() ==
E->getLHS() && RHS.get() ==
E->getRHS())
15453 return getDerived().RebuildCXXFoldExpr(
15455 E->getEllipsisLoc(), RHS.get(),
E->
getEndLoc(), NumExpansions);
15461 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
15462 SemaRef.
Diag(
E->getEllipsisLoc(),
15463 clang::diag::err_fold_expression_limit_exceeded)
15464 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
15466 SemaRef.
Diag(
E->getEllipsisLoc(), diag::note_bracket_depth);
15475 bool LeftFold =
E->isLeftFold();
15479 if (!LeftFold && RetainExpansion) {
15480 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15482 ExprResult Out = getDerived().TransformExpr(Pattern);
15483 if (Out.isInvalid())
15486 Result = getDerived().RebuildCXXFoldExpr(
15493 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15494 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
15495 getSema(), LeftFold ? I : *NumExpansions - I - 1);
15496 ExprResult Out = getDerived().TransformExpr(Pattern);
15497 if (Out.isInvalid())
15500 if (Out.get()->containsUnexpandedParameterPack()) {
15502 Result = getDerived().RebuildCXXFoldExpr(
15504 E->getOperator(),
E->getEllipsisLoc(),
15506 OrigNumExpansions);
15507 }
else if (
Result.isUsable()) {
15509 Expr *LHS = LeftFold ?
Result.get() : Out.get();
15510 Expr *RHS = LeftFold ? Out.get() :
Result.get();
15512 UnresolvedSet<16> Functions;
15513 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
15514 Result = getDerived().RebuildCXXOperatorCallExpr(
15516 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
15517 Functions, LHS, RHS);
15519 Result = getDerived().RebuildBinaryOperator(
E->getEllipsisLoc(),
15520 E->getOperator(), LHS, RHS);
15531 if (LeftFold && RetainExpansion) {
15532 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15534 ExprResult Out = getDerived().TransformExpr(Pattern);
15535 if (Out.isInvalid())
15538 Result = getDerived().RebuildCXXFoldExpr(
15540 E->getEllipsisLoc(), Out.get(),
E->
getEndLoc(), OrigNumExpansions);
15548 return getDerived().RebuildEmptyCXXFoldExpr(
E->getEllipsisLoc(),
15554template <
typename Derived>
15556TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *
E) {
15559 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
15563 return getDerived().RebuildParenListExpr(
E->
getBeginLoc(), TransformedInits,
15567template<
typename Derived>
15569TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
15570 CXXStdInitializerListExpr *
E) {
15571 return getDerived().TransformExpr(
E->getSubExpr());
15574template<
typename Derived>
15576TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *
E) {
15580template<
typename Derived>
15582TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *
E) {
15586template<
typename Derived>
15588TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *
E) {
15589 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
15590 if (SubExpr.isInvalid())
15593 if (!getDerived().AlwaysRebuild() &&
15594 SubExpr.get() ==
E->getSubExpr())
15597 return getDerived().RebuildObjCBoxedExpr(
E->
getSourceRange(), SubExpr.get());
15600template<
typename Derived>
15602TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *
E) {
15605 bool ArgChanged =
false;
15606 if (getDerived().TransformExprs(
E->getElements(),
E->getNumElements(),
15607 false, Elements, &ArgChanged))
15610 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15618template<
typename Derived>
15620TreeTransform<Derived>::TransformObjCDictionaryLiteral(
15621 ObjCDictionaryLiteral *
E) {
15624 bool ArgChanged =
false;
15625 for (
unsigned I = 0, N =
E->getNumElements(); I != N; ++I) {
15626 ObjCDictionaryElement OrigElement =
E->getKeyValueElement(I);
15628 if (OrigElement.isPackExpansion()) {
15631 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
15632 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
15633 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15637 bool Expand =
true;
15638 bool RetainExpansion =
false;
15639 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
15640 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15641 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
15642 OrigElement.Value->getEndLoc());
15643 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
15644 PatternRange, Unexpanded, Expand,
15645 RetainExpansion, NumExpansions))
15652 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15653 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15654 if (Key.isInvalid())
15657 if (Key.get() != OrigElement.Key)
15661 if (
Value.isInvalid())
15664 if (
Value.get() != OrigElement.Value)
15667 ObjCDictionaryElement Expansion = {
15668 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
15670 Elements.push_back(Expansion);
15680 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15681 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15682 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15683 if (Key.isInvalid())
15687 if (
Value.isInvalid())
15690 ObjCDictionaryElement Element = {
15691 Key.get(),
Value.get(), SourceLocation(), NumExpansions
15697 if (Key.get()->containsUnexpandedParameterPack() ||
15698 Value.get()->containsUnexpandedParameterPack())
15699 Element.EllipsisLoc = OrigElement.EllipsisLoc;
15701 Elements.push_back(Element);
15711 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15712 if (Key.isInvalid())
15715 if (Key.get() != OrigElement.Key)
15720 = getDerived().TransformExpr(OrigElement.Value);
15721 if (
Value.isInvalid())
15724 if (
Value.get() != OrigElement.Value)
15727 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
15729 Elements.push_back(Element);
15732 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15735 return getDerived().RebuildObjCDictionaryLiteral(
E->
getSourceRange(),
15739template<
typename Derived>
15741TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *
E) {
15742 TypeSourceInfo *EncodedTypeInfo
15743 = getDerived().TransformType(
E->getEncodedTypeSourceInfo());
15744 if (!EncodedTypeInfo)
15747 if (!getDerived().AlwaysRebuild() &&
15748 EncodedTypeInfo ==
E->getEncodedTypeSourceInfo())
15751 return getDerived().RebuildObjCEncodeExpr(
E->getAtLoc(),
15753 E->getRParenLoc());
15756template<
typename Derived>
15758TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *
E) {
15763 return getDerived().TransformExpr(
E->getSubExpr());
15766template<
typename Derived>
15768TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *
E) {
15769 TypeSourceInfo *TSInfo
15770 = getDerived().TransformType(
E->getTypeInfoAsWritten());
15778 if (!getDerived().AlwaysRebuild() &&
15779 TSInfo ==
E->getTypeInfoAsWritten() &&
15780 Result.get() ==
E->getSubExpr())
15784 E->getLParenLoc(),
E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
15788template <
typename Derived>
15789ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
15790 ObjCAvailabilityCheckExpr *
E) {
15794template<
typename Derived>
15796TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *
E) {
15798 bool ArgChanged =
false;
15800 Args.reserve(
E->getNumArgs());
15801 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
false, Args,
15807 TypeSourceInfo *ReceiverTypeInfo
15808 = getDerived().TransformType(
E->getClassReceiverTypeInfo());
15809 if (!ReceiverTypeInfo)
15813 if (!getDerived().AlwaysRebuild() &&
15814 ReceiverTypeInfo ==
E->getClassReceiverTypeInfo() && !ArgChanged)
15819 E->getSelectorLocs(SelLocs);
15820 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
15823 E->getMethodDecl(),
15830 if (!
E->getMethodDecl())
15835 E->getSelectorLocs(SelLocs);
15836 return getDerived().RebuildObjCMessageExpr(
E->getSuperLoc(),
15839 E->getReceiverType(),
15840 E->getMethodDecl(),
15848 "Only class and instance messages may be instantiated");
15850 = getDerived().TransformExpr(
E->getInstanceReceiver());
15851 if (Receiver.isInvalid())
15855 if (!getDerived().AlwaysRebuild() &&
15856 Receiver.get() ==
E->getInstanceReceiver() && !ArgChanged)
15861 E->getSelectorLocs(SelLocs);
15862 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
15865 E->getMethodDecl(),
15871template<
typename Derived>
15873TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *
E) {
15877template<
typename Derived>
15879TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *
E) {
15883template<
typename Derived>
15885TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *
E) {
15888 if (
Base.isInvalid())
15894 if (!getDerived().AlwaysRebuild() &&
15895 Base.get() ==
E->getBase())
15898 return getDerived().RebuildObjCIvarRefExpr(
Base.get(),
E->getDecl(),
15900 E->isArrow(),
E->isFreeIvar());
15903template<
typename Derived>
15905TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *
E) {
15908 if (!
E->isObjectReceiver())
15913 if (
Base.isInvalid())
15919 if (!getDerived().AlwaysRebuild() &&
15920 Base.get() ==
E->getBase())
15923 if (
E->isExplicitProperty())
15924 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
15925 E->getExplicitProperty(),
15928 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
15930 E->getImplicitPropertyGetter(),
15931 E->getImplicitPropertySetter(),
15935template<
typename Derived>
15937TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *
E) {
15940 if (
Base.isInvalid())
15944 ExprResult Key = getDerived().TransformExpr(
E->getKeyExpr());
15945 if (Key.isInvalid())
15949 if (!getDerived().AlwaysRebuild() &&
15950 Key.get() ==
E->getKeyExpr() &&
Base.get() ==
E->getBaseExpr())
15953 return getDerived().RebuildObjCSubscriptRefExpr(
E->getRBracket(),
15954 Base.get(), Key.get(),
15955 E->getAtIndexMethodDecl(),
15956 E->setAtIndexMethodDecl());
15959template<
typename Derived>
15961TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *
E) {
15964 if (
Base.isInvalid())
15968 if (!getDerived().AlwaysRebuild() &&
15969 Base.get() ==
E->getBase())
15972 return getDerived().RebuildObjCIsaExpr(
Base.get(),
E->getIsaMemberLoc(),
15977template<
typename Derived>
15979TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *
E) {
15980 bool ArgumentChanged =
false;
15982 SubExprs.reserve(
E->getNumSubExprs());
15983 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
15984 SubExprs, &ArgumentChanged))
15987 if (!getDerived().AlwaysRebuild() &&
15991 return getDerived().RebuildShuffleVectorExpr(
E->getBuiltinLoc(),
15993 E->getRParenLoc());
15996template<
typename Derived>
15998TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *
E) {
15999 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16000 if (SrcExpr.isInvalid())
16003 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
16007 if (!getDerived().AlwaysRebuild() &&
16008 Type ==
E->getTypeSourceInfo() &&
16009 SrcExpr.get() ==
E->getSrcExpr())
16012 return getDerived().RebuildConvertVectorExpr(
E->getBuiltinLoc(),
16013 SrcExpr.get(), Type,
16014 E->getRParenLoc());
16017template<
typename Derived>
16019TreeTransform<Derived>::TransformBlockExpr(BlockExpr *
E) {
16020 BlockDecl *oldBlock =
E->getBlockDecl();
16023 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
16026 blockScope->TheDecl->setBlockMissingReturnType(
16027 oldBlock->blockMissingReturnType());
16032 const FunctionProtoType *exprFunctionType =
E->getFunctionType();
16035 Sema::ExtParameterInfoBuilder extParamInfos;
16036 if (getDerived().TransformFunctionTypeParams(
16037 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
16038 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
16040 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16044 QualType exprResultType =
16045 getDerived().TransformType(exprFunctionType->getReturnType());
16047 auto epi = exprFunctionType->getExtProtoInfo();
16048 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
16051 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
16055 if (!params.empty())
16056 blockScope->TheDecl->setParams(params);
16058 if (!oldBlock->blockMissingReturnType()) {
16059 blockScope->HasImplicitReturnType =
false;
16060 blockScope->ReturnType = exprResultType;
16064 StmtResult body = getDerived().TransformStmt(
E->getBody());
16065 if (body.isInvalid()) {
16066 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16074 for (
const auto &I : oldBlock->captures()) {
16075 VarDecl *oldCapture = I.getVariable();
16078 if (oldCapture->isParameterPack())
16081 VarDecl *newCapture =
16082 cast<VarDecl>(getDerived().TransformDecl(
E->getCaretLocation(),
16084 assert(blockScope->CaptureMap.count(newCapture));
16090 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
16091 "this pointer isn't captured in the old block");
16099template<
typename Derived>
16101TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *
E) {
16102 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16103 if (SrcExpr.isInvalid())
16106 QualType
Type = getDerived().TransformType(
E->
getType());
16109 E->getRParenLoc());
16112template<
typename Derived>
16114TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *
E) {
16115 bool ArgumentChanged =
false;
16117 SubExprs.reserve(
E->getNumSubExprs());
16118 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16119 SubExprs, &ArgumentChanged))
16122 if (!getDerived().AlwaysRebuild() &&
16126 return getDerived().RebuildAtomicExpr(
E->getBuiltinLoc(), SubExprs,
16127 E->getOp(),
E->getRParenLoc());
16134template<
typename Derived>
16138 getDerived().getBaseEntity());
16141template<
typename Derived>
16145 getDerived().getBaseEntity());
16148template<
typename Derived>
16151 bool WrittenAsLValue,
16154 Sigil, getDerived().getBaseEntity());
16157template<
typename Derived>
16163 getDerived().getBaseEntity());
16166template<
typename Derived>
16174 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16178template<
typename Derived>
16190 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
16191 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16196template<
typename Derived>
16203template <
typename Derived>
16206 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16207 if (SizeExpr || !Size)
16209 IndexTypeQuals, BracketsRange,
16210 getDerived().getBaseEntity());
16218 for (
const auto &
T : Types)
16230 IndexTypeQuals, BracketsRange,
16231 getDerived().getBaseEntity());
16234template <
typename Derived>
16237 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16238 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
16239 IndexTypeQuals, BracketsRange);
16242template <
typename Derived>
16246 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
16247 IndexTypeQuals, BracketsRange);
16250template <
typename Derived>
16253 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16254 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
16256 IndexTypeQuals, BracketsRange);
16259template <
typename Derived>
16262 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16263 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
16265 IndexTypeQuals, BracketsRange);
16268template <
typename Derived>
16275template <
typename Derived>
16277 unsigned NumElements,
16283template <
typename Derived>
16290template<
typename Derived>
16292 unsigned NumElements,
16295 NumElements,
true);
16302template<
typename Derived>
16310template <
typename Derived>
16312 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
16317template <
typename Derived>
16325template<
typename Derived>
16331 getDerived().getBaseLocation(),
16332 getDerived().getBaseEntity(),
16336template<
typename Derived>
16341template<
typename Derived>
16344 assert(
D &&
"no decl found");
16348 if (
auto *UPD = dyn_cast<UsingPackDecl>(
D)) {
16352 if (UPD->expansions().empty()) {
16353 getSema().Diag(
Loc, diag::err_using_pack_expansion_empty)
16354 << UPD->isCXXClassMember() << UPD;
16363 for (
auto *
E : UPD->expansions()) {
16369 else if (
T.isNull())
16373 "mismatched resolved types in using pack expansion");
16375 return T.isNull() ? FallbackT :
T;
16376 }
else if (
auto *Using = dyn_cast<UsingDecl>(
D)) {
16377 assert(Using->hasTypename() &&
16378 "UnresolvedUsingTypenameDecl transformed to non-typename using");
16381 assert(++Using->shadow_begin() == Using->shadow_end());
16390 assert(isa<UnresolvedUsingTypenameDecl>(
D) &&
16391 "UnresolvedUsingTypenameDecl transformed to non-using decl");
16393 cast<UnresolvedUsingTypenameDecl>(
D));
16397template <
typename Derived>
16403template<
typename Derived>
16409template <
typename Derived>
16414template <
typename Derived>
16420 FullySubstituted, Expansions);
16423template<
typename Derived>
16430template<
typename Derived>
16438template<
typename Derived>
16444template<
typename Derived>
16452template <
typename Derived>
16463template <
typename Derived>
16469template<
typename Derived>
16478template<
typename Derived>
16486 bool AllowInjectedClassName) {
16490 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
16493 AllowInjectedClassName);
16494 return Template.
get();
16497template<
typename Derived>
16504 bool AllowInjectedClassName) {
16507 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
16508 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
16510 getSema().ActOnTemplateName(
16512 false, Template, AllowInjectedClassName);
16513 return Template.
get();
16516template <
typename Derived>
16521 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
16527 Opc,
First, Second);
16542 if (Op == OO_Subscript) {
16543 if (!
First->getType()->isOverloadableType() &&
16545 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
16547 }
else if (Op == OO_Arrow) {
16550 if (
First->getType()->isDependentType())
16554 }
else if (Second ==
nullptr || isPostIncDec) {
16555 if (!
First->getType()->isOverloadableType() ||
16556 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
16563 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
16567 !
First->getType()->isOverloadableType() &&
16582 if (!Second || isPostIncDec) {
16592 First, Second, RequiresADL);
16599template<
typename Derived>
16614 ->template getAs<RecordType>())){
16617 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
16618 CCLoc, TildeLoc, Destroyed);
16630 if (!ScopeType->getType()->getAs<
TagType>()) {
16631 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
16632 diag::err_expected_class_or_namespace)
16633 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
16641 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
16642 OperatorLoc, isArrow,
16650template<
typename Derived>
16658 for (
unsigned I = 0; I < NumParams; ++I) {
16659 if (I != ContextParamPos) {
16665 Params.push_back(std::make_pair(StringRef(), QualType()));
16668 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
16669 S->getCapturedRegionKind(), Params);
16672 Sema::CompoundScopeRAII CompoundScope(getSema());
16673 Body = getDerived().TransformStmt(S->getCapturedStmt());
16676 if (Body.isInvalid()) {
16677 getSema().ActOnCapturedRegionError();
16681 return getSema().ActOnCapturedRegionEnd(Body.get());
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Target Target
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
static QualType getPointeeType(const MemRegion *R)
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
DeclarationNameTable DeclarationNames
QualType 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.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true)
Form a pack expansion type with the given pattern.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CanQualType PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
CanQualType UnsignedInt128Ty
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getRParenLoc() const
TypeLoc getValueLoc() const
SourceLocation getKWLoc() const
SourceLocation getLParenLoc() const
Attr - This represents one attribute.
attr::Kind getKind() const
SourceLocation getLocation() const
Represents an attribute applied to a statement.
Type source information for an attributed type.
const Attr * getAttr() const
The type attribute.
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
TypeLoc getEquivalentTypeLoc() const
void setAttr(const Attr *A)
attr::Kind getAttrKind() const
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
std::optional< NullabilityKind > getImmediateNullability() const
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
void setIsVariadic(bool value)
TypeLoc getInnerLoc() const
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 a value-initialized rvalue of type T, which is a non-class type.
Represents a C++ nested-name-specifier or a global scope specifier.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
SourceLocation getBegin() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
Expr * getCountExpr() const
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
bool isCountInBytes() const
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
The name of a declaration.
@ CXXConversionFunctionName
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a dependent template name that cannot be resolved prior to template instantiation.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
SourceLocation getTemplateNameLoc() const
SourceLocation getLAngleLoc() const
void setTemplateKeywordLoc(SourceLocation Loc)
SourceLocation getTemplateKeywordLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
SourceLocation getRAngleLoc() const
SourceLocation getElaboratedKeywordLoc() const
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
Represents a template specialization type whose template cannot be resolved, e.g.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
TypeLoc getNamedTypeLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
RAII object that enters a new expression evaluation context.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
QualType getCallResultType() const
Determine the type of an expression that calls this function.
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present,...
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
QualType getReturnType() const
AssociationTy< false > Association
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
const TypeClass * getTypePtr() const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This represents clauses with a list of expressions that are mappable.
ObjCIvarDecl - Represents an ObjC instance variable.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
bool isInstanceMethod() const
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents the declaration of an Objective-C type parameter.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Wrapper for void* pointer.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, 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 OpenACCFirstPrivateClause * 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 OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static 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)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
Represents a pack expansion of types.
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
SourceLocation getEndLoc() const
void setLParenLoc(SourceLocation EndLoc)
void setConditionDetails(Expr *ConditionExpr)
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
void setDefaultDetails(OpenACCDefaultClauseKind DefKind)
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
void setWaitDetails(Expr *DevNum, SourceLocation QueuesLoc, llvm::SmallVector< Expr * > &&IntExprs)
void setEndLoc(SourceLocation EndLoc)
void setIntExprDetails(ArrayRef< Expr * > IntExprs)
OpenACCDefaultClauseKind getDefaultClauseKind() const
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
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 * 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 * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'reduction' 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 * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' 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)
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'to' clause.
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 * 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 * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' 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 * 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=std::nullopt)
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
ExprResult checkAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
QualType BuildParenType(QualType T)
Build a paren type including T.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
static std::enable_if_t< std::is_base_of_v< Attr, AttrInfo >, SourceLocation > getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
@ IER_DoesNotExist
The symbol does not exist.
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ IER_Error
An error occurred.
@ IER_Exists
The symbol exists.
void ActOnStartStmtExpr()
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
void ActOnStmtExprError()
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)
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt=std::nullopt)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, const FunctionEffectWithCondition &EC, SourceLocation NewAttrLoc)
Warn and return true if adding an effect to a set would create a conflict.
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
ConvertVectorExpr - Handle __builtin_convertvector.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
DeclContext * getCurLexicalContext() const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool EmptyPack=false)
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
@ TryCapture_ExplicitByVal
@ TryCapture_ExplicitByRef
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
bool CheckRebuiltStmtAttributes(ArrayRef< const Attr * > Attrs)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
ExprResult BuiltinShuffleVector(CallExpr *TheCall)
BuiltinShuffleVector - Handle __builtin_shufflevector.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, std::optional< unsigned > Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs=std::nullopt)
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
A structure for storing an already-substituted template template parameter pack.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
TypeSourceInfo * getTypeSourceInfo() const
SourceRange getSourceRange() const LLVM_READONLY
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getSourceExpression() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
SourceLocation getTemplateNameLoc() const
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
Wrapper for template type parameters.
The top declaration context.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
SourceLocation getTemplateKeywordLoc() const
Get the SourceLocation of the template keyword (if any).
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
ElaboratedTypeKeyword getKeyword() const
The base class of the type hierarchy.
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i....
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isFunctionType() const
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
TypedefNameDecl * getTypedefNameDecl() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
A set of unresolved declarations.
void addDecl(NamedDecl *D)
A set of unresolved declarations.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
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.
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
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 the lambda contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
bool Inc(InterpState &S, CodePtr OpPC)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
The JSON file list parser is used to communicate input to InstallAPI.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
ArrayTypeTrait
Names for the array type traits.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
ActionResult< Expr * > ExprResult
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
ActionResult< Stmt * > StmtResult
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
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
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
MutableArrayRef< Expr * > MultiExprArg
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
This structure contains most locations needed for by an OMPVarListClause.
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.