13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
48#include "llvm/ADT/ArrayRef.h"
49#include "llvm/Support/ErrorHandling.h"
53using namespace llvm::omp;
109template<
typename Derived>
114 class ForgetPartiallySubstitutedPackRAII {
122 ForgetPartiallySubstitutedPackRAII(Derived &Self)
123 : Self(Self), ResetPackSubstIndex(Self.getSema(), -1) {
124 Old = Self.ForgetPartiallySubstitutedPack();
127 ~ForgetPartiallySubstitutedPackRAII() {
128 Self.RememberPartiallySubstitutedPack(Old);
145 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
149 return static_cast<const Derived&
>(*this);
214 OldLocation = Self.getDerived().getBaseLocation();
215 OldEntity = Self.getDerived().getBaseEntity();
218 Self.getDerived().setBase(Location, Entity);
222 Self.getDerived().setBase(OldLocation, OldEntity);
252 return E->isDefaultArgument();
295 bool &ShouldExpand,
bool &RetainExpansion,
296 std::optional<unsigned> &NumExpansions) {
297 ShouldExpand =
false;
412 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
413#include "clang/Basic/AttrList.inc"
423 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
424 const X##Attr *A) { \
425 return getDerived().Transform##X##Attr(A); \
427#include "clang/Basic/AttrList.inc"
473 bool *ArgChanged =
nullptr);
482 llvm::DenseMap<Decl *, Decl *>::iterator Known
485 return Known->second;
513 assert(New.size() == 1 &&
514 "must override transformedLocalDecl if performing pack expansion");
552 NamedDecl *FirstQualifierInScope =
nullptr);
597 NamedDecl *FirstQualifierInScope =
nullptr,
598 bool AllowInjectedClassName =
false);
610 bool Uneval =
false);
633 bool Uneval =
false) {
652 template<
typename InputIterator>
656 bool Uneval =
false);
668#define ABSTRACT_TYPELOC(CLASS, PARENT)
669#define TYPELOC(CLASS, PARENT) \
670 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
671#include "clang/AST/TypeLocNodes.def"
675 bool SuppressObjCLifetime);
679 bool SuppressObjCLifetime);
681 template<
typename Fn>
734 return getDerived().TransformFunctionTypeParams(
735 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
753 KWLoc, Params,
nullptr,
754 nullptr, PTypes, &TransParams, PInfos))
767 std::optional<unsigned> NumExpansions,
768 bool ExpectParameterPack);
795 bool IsAddressOfOperand,
803 bool IsAddressOfOperand);
811#define STMT(Node, Parent) \
812 LLVM_ATTRIBUTE_NOINLINE \
813 StmtResult Transform##Node(Node *S);
814#define VALUESTMT(Node, Parent) \
815 LLVM_ATTRIBUTE_NOINLINE \
816 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
817#define EXPR(Node, Parent) \
818 LLVM_ATTRIBUTE_NOINLINE \
819 ExprResult Transform##Node(Node *E);
820#define ABSTRACT_STMT(Stmt)
821#include "clang/AST/StmtNodes.inc"
823#define GEN_CLANG_CLAUSE_CLASS
824#define CLAUSE_CLASS(Enum, Str, Class) \
825 LLVM_ATTRIBUTE_NOINLINE \
826 OMPClause *Transform##Class(Class *S);
827#include "llvm/Frontend/OpenMP/OMP.inc"
904 const llvm::APInt *Size,
Expr *SizeExpr,
905 unsigned IndexTypeQuals,
SourceRange BracketsRange);
914 const llvm::APInt &Size,
Expr *SizeExpr,
915 unsigned IndexTypeQuals,
925 unsigned IndexTypeQuals,
935 unsigned IndexTypeQuals,
946 unsigned IndexTypeQuals,
984 unsigned NumColumns);
1001 Expr *AddrSpaceExpr,
1071 bool FullySubstituted,
1085 TypeConstraintConcept,
1086 TypeConstraintArgs);
1094 Template, Deduced,
false);
1140 bool AllowInjectedClassName) {
1144 SS.
Adopt(QualifierLoc);
1146 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1147 AllowInjectedClassName);
1161 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1178 bool DeducedTSTContext) {
1180 SS.
Adopt(QualifierLoc);
1193 *
Id, IdLoc, DeducedTSTContext);
1211 switch (
Result.getResultKind()) {
1222 llvm_unreachable(
"Tag lookup cannot find non-tags");
1234 switch (
Result.getResultKind()) {
1240 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1241 << SomeDecl << NTK << llvm::to_underlying(Kind);
1247 << llvm::to_underlying(Kind) <<
Id << DC
1256 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1257 SemaRef.
Diag(Tag->getLocation(), diag::note_previous_use);
1274 std::optional<unsigned> NumExpansions) {
1319 bool AllowInjectedClassName);
1332 bool AllowInjectedClassName);
1342 Decl *AssociatedDecl,
unsigned Index,
1345 ArgPack, AssociatedDecl, Index, Final);
1423 Then, ElseLoc, Else);
1477 Inc, RParenLoc, Body);
1522 bool IsVolatile,
unsigned NumOutputs,
1529 NumInputs, Names, Constraints, Exprs,
1530 AsmString, Clobbers, NumLabels, RParenLoc);
1539 StringRef AsmString,
1540 unsigned NumOutputs,
unsigned NumInputs,
1546 NumOutputs, NumInputs,
1547 Constraints, Clobbers, Exprs, EndLoc);
1576 CoawaitLoc, Operand, OpCoawaitLookup);
1580 Suspend.
get(),
true);
1681 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1693 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1707 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1818 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1831 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1844 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1895 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1922 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1923 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1937 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1938 ReductionId, UnresolvedReductions);
1953 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1954 ReductionId, UnresolvedReductions);
1967 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1968 StepModifierLoc, EndLoc);
1981 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2041 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2054 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2069 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2070 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2071 ColonLoc, VarList, Locs,
2072 false, UnresolvedMappers);
2089 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2090 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2138 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2151 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2186 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2201 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2202 ColonLoc, VarList, Locs, UnresolvedMappers);
2217 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2218 ColonLoc, VarList, Locs, UnresolvedMappers);
2269 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2316 StartLoc, LParenLoc, EndLoc,
Data);
2329 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2341 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2354 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2365 LParenLoc, VarLoc, EndLoc);
2377 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2516 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2564 ForLoc, Element, Collection, RParenLoc);
2582 StartLoc, IdLoc,
Id);
2620 if (RangeStmt->isSingleDecl()) {
2621 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2622 if (RangeVar->isInvalidDecl())
2625 Expr *RangeExpr = RangeVar->getInit();
2632 diag::err_objc_for_range_init_stmt)
2633 <<
Init->getSourceRange();
2636 ForLoc, LoopVar, RangeExpr, RParenLoc);
2643 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2657 QualifierLoc, NameInfo, Nested);
2719 SS.
Adopt(QualifierLoc);
2831 if (IsOMPArraySection)
2833 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2834 Stride, RBracketLoc);
2836 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2837 "Stride/second colon not allowed for OpenACC");
2840 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2852 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2864 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2874 Expr *ExecConfig =
nullptr) {
2876 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2883 nullptr, Callee, LParenLoc, Args, RParenLoc);
2901 if (!
Member->getDeclName()) {
2905 assert(
Member->getType()->isRecordType() &&
2906 "unnamed member not of record type?");
2919 if (!isArrow &&
Base->isPRValue()) {
2928 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2934 SS.
Adopt(QualifierLoc);
2937 if (
Base->containsErrors())
2951 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2952 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2953 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2956 ->getAsCXXRecordDecl()) {
2957 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2960 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2968 FirstQualifierInScope,
2969 R, ExplicitTemplateArgs,
3147 Expr *ControllingExpr,
3152 ControllingExpr, Types, Exprs);
3167 ControllingType, Types, Exprs);
3200 case Stmt::CXXStaticCastExprClass:
3201 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3202 RAngleLoc, LParenLoc,
3203 SubExpr, RParenLoc);
3205 case Stmt::CXXDynamicCastExprClass:
3206 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3207 RAngleLoc, LParenLoc,
3208 SubExpr, RParenLoc);
3210 case Stmt::CXXReinterpretCastExprClass:
3211 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3212 RAngleLoc, LParenLoc,
3216 case Stmt::CXXConstCastExprClass:
3217 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3218 RAngleLoc, LParenLoc,
3219 SubExpr, RParenLoc);
3221 case Stmt::CXXAddrspaceCastExprClass:
3222 return getDerived().RebuildCXXAddrspaceCastExpr(
3223 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3226 llvm_unreachable(
"Invalid C++ named cast");
3304 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3316 bool ListInitialization) {
3320 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3322 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3323 RParenLoc, ListInitialization);
3326 ListInitialization);
3390 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3400 bool IsThrownVariableInScope) {
3410 Expr *RewrittenExpr) {
3412 RewrittenExpr,
getSema().CurContext);
3446 std::optional<Expr *> ArraySize,
3465 bool IsGlobalDelete,
3516 bool IsAddressOfOperand,
3519 SS.
Adopt(QualifierLoc);
3521 if (TemplateArgs || TemplateKWLoc.
isValid())
3523 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3526 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3548 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3549 bool ListInitialization,
bool StdInitListInitialization,
3555 if (Constructor->isInheritingConstructor())
3556 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3559 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3566 HadMultipleCandidates,
3568 StdInitListInitialization,
3569 RequiresZeroInit, ConstructKind,
3577 bool ConstructsVBase,
3578 bool InheritedFromVBase) {
3580 Loc,
T, Constructor, ConstructsVBase, InheritedFromVBase);
3591 bool ListInitialization) {
3593 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3604 bool ListInitialization) {
3606 RParenLoc, ListInitialization);
3623 SS.
Adopt(QualifierLoc);
3626 OperatorLoc, IsArrow,
3628 FirstQualifierInScope,
3630 TemplateArgs,
nullptr);
3646 SS.
Adopt(QualifierLoc);
3649 OperatorLoc, IsArrow,
3651 FirstQualifierInScope,
3652 R, TemplateArgs,
nullptr);
3667 std::optional<unsigned> Length,
3670 RParenLoc, Length, PartialArgs);
3675 Expr *PackIdExpression,
Expr *IndexExpr,
3677 bool FullySubstituted =
false) {
3679 IndexExpr, RSquareLoc, ExpandedExprs,
3716 NamedConcept, TALI);
3734 LocalParameters, RParenLoc, Requirements,
3788 Expr **Elements,
unsigned NumElements) {
3798 RB,
Base, Key, getterMethod, setterMethod);
3830 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3845 Sel, Method, LBracLoc,
3846 SelectorLocs, RBracLoc, Args);
3860 nullptr, SuperType, SuperLoc, Sel, Method, LBracLoc,
3861 SelectorLocs, RBracLoc, Args)
3863 Sel, Method, LBracLoc,
3864 SelectorLocs, RBracLoc, Args);
3873 bool IsArrow,
bool IsFreeIvar) {
3882 if (IsFreeIvar &&
Result.isUsable())
3883 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3919 PropertyLoc,
Base));
3951 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3960 CK_BuiltinFnToFnPtr).
get();
3986 std::optional<unsigned> NumExpansions) {
3991 EllipsisLoc, NumExpansions);
4013 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4034 std::optional<unsigned> NumExpansions) {
4047 std::optional<unsigned> NumExpansions) {
4049 EllipsisLoc, RHS, RParenLoc,
4058 Init->containsUnexpandedParameterPack();
4059 else if (PVD->hasUninstantiatedDefaultArg())
4061 PVD->getUninstantiatedDefaultArg()
4062 ->containsUnexpandedParameterPack();
4207 Exprs.push_back(DevNumExpr);
4208 Exprs.insert(Exprs.end(), QueueIdExprs.begin(), QueueIdExprs.end());
4211 Exprs, RParenLoc, EndLoc, Clauses, {});
4246 bool DeducibleTSTContext);
4258template <
typename Derived>
4263 switch (S->getStmtClass()) {
4268#define STMT(Node, Parent) \
4269 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4270#define VALUESTMT(Node, Parent) \
4271 case Stmt::Node##Class: \
4272 return getDerived().Transform##Node(cast<Node>(S), SDK);
4273#define ABSTRACT_STMT(Node)
4274#define EXPR(Node, Parent)
4275#include "clang/AST/StmtNodes.inc"
4278#define STMT(Node, Parent)
4279#define ABSTRACT_STMT(Stmt)
4280#define EXPR(Node, Parent) case Stmt::Node##Class:
4281#include "clang/AST/StmtNodes.inc"
4283 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4285 if (SDK == SDK_StmtExprResult)
4286 E = getSema().ActOnStmtExprResult(
E);
4287 return getSema().ActOnExprStmt(
E, SDK == SDK_Discarded);
4294template<
typename Derived>
4299 switch (S->getClauseKind()) {
4302#define GEN_CLANG_CLAUSE_CLASS
4303#define CLAUSE_CLASS(Enum, Str, Class) \
4305 return getDerived().Transform##Class(cast<Class>(S));
4306#include "llvm/Frontend/OpenMP/OMP.inc"
4313template<
typename Derived>
4320#define STMT(Node, Parent) case Stmt::Node##Class: break;
4321#define ABSTRACT_STMT(Stmt)
4322#define EXPR(Node, Parent) \
4323 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4324#include "clang/AST/StmtNodes.inc"
4330template<
typename Derived>
4338 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4339 Init = FE->getSubExpr();
4341 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4347 Init = MTE->getSubExpr();
4350 Init = Binder->getSubExpr();
4353 Init = ICE->getSubExprAsWritten();
4356 dyn_cast<CXXStdInitializerListExpr>(
Init))
4357 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4364 return getDerived().TransformExpr(
Init);
4369 return getDerived().RebuildParenListExpr(
Parens.getBegin(), {},
4374 if (isa<ImplicitValueInitExpr>(
Init))
4380 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4381 return getDerived().TransformExpr(
Init);
4386 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4393 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4394 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4395 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4396 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4398 bool ArgChanged =
false;
4400 true, NewArgs, &ArgChanged))
4405 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4410 if (
Parens.isInvalid()) {
4413 assert(NewArgs.empty() &&
4414 "no parens or braces but have direct init with arguments?");
4417 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4421template<
typename Derived>
4427 for (
unsigned I = 0; I != NumInputs; ++I) {
4429 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4437 Expr *Pattern = Expansion->getPattern();
4440 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4441 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4446 bool RetainExpansion =
false;
4447 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4448 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4449 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4452 Expand, RetainExpansion,
4461 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4465 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4466 Expansion->getEllipsisLoc(),
4468 if (Out.isInvalid())
4473 Outputs.push_back(Out.get());
4479 if (ArgChanged) *ArgChanged =
true;
4483 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4485 ExprResult Out = getDerived().TransformExpr(Pattern);
4486 if (Out.isInvalid())
4489 if (Out.get()->containsUnexpandedParameterPack()) {
4490 Out = getDerived().RebuildPackExpansion(
4491 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4492 if (Out.isInvalid())
4496 Outputs.push_back(Out.get());
4501 if (RetainExpansion) {
4502 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4504 ExprResult Out = getDerived().TransformExpr(Pattern);
4505 if (Out.isInvalid())
4508 Out = getDerived().RebuildPackExpansion(
4509 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4510 if (Out.isInvalid())
4513 Outputs.push_back(Out.get());
4520 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4521 : getDerived().TransformExpr(Inputs[I]);
4525 if (
Result.get() != Inputs[I] && ArgChanged)
4528 Outputs.push_back(
Result.get());
4534template <
typename Derived>
4538 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4539 getDerived().TransformDefinition(Var->
getLocation(), Var));
4544 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4553 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4560template <
typename Derived>
4568 Qualifier = Qualifier.getPrefix())
4584 SS, FirstQualifierInScope,
false))
4591 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4599 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4614 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4623 FirstQualifierInScope, SS);
4633 diag::warn_cxx98_compat_enum_nested_name_spec);
4636 SS.
Adopt(ETL.getQualifierLoc());
4637 TL = ETL.getNamedTypeLoc();
4656 FirstQualifierInScope =
nullptr;
4662 !getDerived().AlwaysRebuild())
4675template<
typename Derived>
4683 switch (Name.getNameKind()) {
4694 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4695 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4696 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4712 NewTInfo = getDerived().TransformType(OldTInfo);
4720 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4736 llvm_unreachable(
"Unknown name kind.");
4739template<
typename Derived>
4746 bool AllowInjectedClassName) {
4748 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4749 assert(Template &&
"qualified template name must refer to a template");
4752 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4757 if (!getDerived().AlwaysRebuild() &&
4759 TransTemplate == Template)
4762 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4770 FirstQualifierInScope =
nullptr;
4773 if (!getDerived().AlwaysRebuild() &&
4781 if (DTN->isIdentifier()) {
4782 return getDerived().RebuildTemplateName(SS,
4784 *DTN->getIdentifier(),
4787 FirstQualifierInScope,
4788 AllowInjectedClassName);
4791 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4792 DTN->getOperator(), NameLoc,
4793 ObjectType, AllowInjectedClassName);
4797 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4799 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4804 return getDerived().RebuildTemplateName(SS,
false,
4809 = Name.getAsSubstTemplateTemplateParmPack()) {
4810 return getDerived().RebuildTemplateName(
4811 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4812 SubstPack->getIndex(), SubstPack->getFinal());
4816 llvm_unreachable(
"overloaded function decl survived to here");
4819template<
typename Derived>
4823 Output = getSema().getTrivialTemplateArgumentLoc(
4824 Arg,
QualType(), getDerived().getBaseLocation());
4827template <
typename Derived>
4835 llvm_unreachable(
"Unexpected TemplateArgument");
4845 QualType NewT = getDerived().TransformType(
T);
4852 ValueDecl *NewD =
D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4853 getDerived().getBaseLocation(),
D))
4858 if (NewT ==
T &&
D == NewD)
4875 llvm_unreachable(
"unexpected template argument kind");
4885 DI = getDerived().TransformType(DI);
4896 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4902 SS.
Adopt(QualifierLoc);
4903 TemplateName Template = getDerived().TransformTemplateName(
4914 llvm_unreachable(
"Caller should expand pack expansions");
4929 ExprResult E = getDerived().TransformExpr(InputExpr);
4944template<
typename Derived,
typename InputIterator>
4952 typedef typename std::iterator_traits<InputIterator>::difference_type
4982 Self.InventTemplateArgumentLoc(*
Iter,
Result);
4990 return X.Iter == Y.Iter;
4995 return X.Iter != Y.Iter;
4999template<
typename Derived>
5000template<
typename InputIterator>
5017 if (TransformTemplateArguments(PackLocIterator(*
this,
5018 In.getArgument().pack_begin()),
5019 PackLocIterator(*
this,
5020 In.getArgument().pack_end()),
5027 if (In.getArgument().isPackExpansion()) {
5031 std::optional<unsigned> OrigNumExpansions;
5033 = getSema().getTemplateArgumentPackExpansionPattern(
5034 In, Ellipsis, OrigNumExpansions);
5037 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5038 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5043 bool RetainExpansion =
false;
5044 std::optional<unsigned> NumExpansions = OrigNumExpansions;
5045 if (getDerived().TryExpandParameterPacks(Ellipsis,
5059 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
5062 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
5064 if (Out.getArgument().isNull())
5073 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5076 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
5079 if (Out.getArgument().containsUnexpandedParameterPack()) {
5080 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
5082 if (Out.getArgument().isNull())
5091 if (RetainExpansion) {
5092 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5094 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
5097 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
5099 if (Out.getArgument().isNull())
5109 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
5123template<
typename Derived>
5125 if (getDerived().AlreadyTransformed(
T))
5131 getDerived().getBaseLocation());
5141template<
typename Derived>
5145 getDerived().getBaseEntity());
5146 if (getDerived().AlreadyTransformed(DI->
getType()))
5161template<
typename Derived>
5164 switch (
T.getTypeLocClass()) {
5165#define ABSTRACT_TYPELOC(CLASS, PARENT)
5166#define TYPELOC(CLASS, PARENT) \
5167 case TypeLoc::CLASS: \
5168 return getDerived().Transform##CLASS##Type(TLB, \
5169 T.castAs<CLASS##TypeLoc>());
5170#include "clang/AST/TypeLocNodes.def"
5173 llvm_unreachable(
"unhandled type loc!");
5176template<
typename Derived>
5178 if (!isa<DependentNameType>(
T))
5179 return TransformType(
T);
5181 if (getDerived().AlreadyTransformed(
T))
5184 getDerived().getBaseLocation());
5185 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5189template<
typename Derived>
5192 if (!isa<DependentNameType>(DI->
getType()))
5193 return TransformType(DI);
5197 getDerived().getBaseEntity());
5198 if (getDerived().AlreadyTransformed(DI->
getType()))
5218 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5227template<
typename Derived>
5232 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5233 auto SuppressObjCLifetime =
5234 T.getType().getLocalQualifiers().hasObjCLifetime();
5236 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5237 SuppressObjCLifetime);
5238 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5239 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5240 TLB, STTP, SuppressObjCLifetime);
5242 Result = getDerived().TransformType(TLB, UnqualTL);
5261template <
typename Derived>
5271 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5302 else if (
T.getObjCLifetime()) {
5307 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5323 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5332template<
typename Derived>
5338 if (getDerived().AlreadyTransformed(TL.
getType()))
5342 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5348template<
typename Derived>
5350TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5351 QualType ObjectType,
5352 NamedDecl *UnqualLookup,
5354 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5357 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5361template <
typename Derived>
5362TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5363 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5365 QualType
T = TL.getType();
5366 assert(!getDerived().AlreadyTransformed(
T));
5371 if (isa<TemplateSpecializationType>(
T)) {
5372 TemplateSpecializationTypeLoc SpecTL =
5373 TL.castAs<TemplateSpecializationTypeLoc>();
5375 TemplateName Template = getDerived().TransformTemplateName(
5376 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5377 ObjectType, UnqualLookup,
true);
5378 if (Template.isNull())
5381 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5383 }
else if (isa<DependentTemplateSpecializationType>(
T)) {
5384 DependentTemplateSpecializationTypeLoc SpecTL =
5385 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5387 TemplateName Template
5388 = getDerived().RebuildTemplateName(SS,
5389 SpecTL.getTemplateKeywordLoc(),
5390 *SpecTL.getTypePtr()->getIdentifier(),
5391 SpecTL.getTemplateNameLoc(),
5392 ObjectType, UnqualLookup,
5394 if (Template.isNull())
5397 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5403 Result = getDerived().TransformType(TLB, TL);
5412template <
class TyLoc>
static inline
5414 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5415 NewT.setNameLoc(
T.getNameLoc());
5419template<
typename Derived>
5420QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5422 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5423 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5424 if (
T.needsExtraLocalData())
5425 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5429template<
typename Derived>
5430QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5436template <
typename Derived>
5437QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5438 AdjustedTypeLoc TL) {
5440 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5443template<
typename Derived>
5444QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5445 DecayedTypeLoc TL) {
5446 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5447 if (OriginalType.isNull())
5450 QualType
Result = TL.getType();
5451 if (getDerived().AlwaysRebuild() ||
5452 OriginalType != TL.getOriginalLoc().getType())
5454 TLB.push<DecayedTypeLoc>(
Result);
5459template <
typename Derived>
5461TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5462 ArrayParameterTypeLoc TL) {
5463 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5464 if (OriginalType.isNull())
5467 QualType
Result = TL.getType();
5468 if (getDerived().AlwaysRebuild() ||
5469 OriginalType != TL.getElementLoc().getType())
5471 TLB.push<ArrayParameterTypeLoc>(
Result);
5476template<
typename Derived>
5477QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5478 PointerTypeLoc TL) {
5479 QualType PointeeType
5480 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5481 if (PointeeType.isNull())
5484 QualType
Result = TL.getType();
5485 if (PointeeType->getAs<ObjCObjectType>()) {
5492 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5493 NewT.setStarLoc(TL.getStarLoc());
5497 if (getDerived().AlwaysRebuild() ||
5498 PointeeType != TL.getPointeeLoc().getType()) {
5499 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5506 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5508 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5509 NewT.setSigilLoc(TL.getSigilLoc());
5513template<
typename Derived>
5515TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5516 BlockPointerTypeLoc TL) {
5517 QualType PointeeType
5518 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5519 if (PointeeType.isNull())
5522 QualType
Result = TL.getType();
5523 if (getDerived().AlwaysRebuild() ||
5524 PointeeType != TL.getPointeeLoc().getType()) {
5525 Result = getDerived().RebuildBlockPointerType(PointeeType,
5531 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5532 NewT.setSigilLoc(TL.getSigilLoc());
5540template<
typename Derived>
5548 if (PointeeType.
isNull())
5552 if (getDerived().AlwaysRebuild() ||
5553 PointeeType !=
T->getPointeeTypeAsWritten()) {
5554 Result = getDerived().RebuildReferenceType(PointeeType,
5555 T->isSpelledAsLValue(),
5568 if (isa<LValueReferenceType>(
Result))
5577template<
typename Derived>
5581 return TransformReferenceType(TLB, TL);
5584template<
typename Derived>
5586TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5587 RValueReferenceTypeLoc TL) {
5588 return TransformReferenceType(TLB, TL);
5591template<
typename Derived>
5593TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5594 MemberPointerTypeLoc TL) {
5595 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5596 if (PointeeType.isNull())
5599 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5600 TypeSourceInfo *NewClsTInfo =
nullptr;
5602 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5607 const MemberPointerType *
T = TL.getTypePtr();
5608 QualType OldClsType = QualType(
T->getClass(), 0);
5609 QualType NewClsType;
5611 NewClsType = NewClsTInfo->getType();
5613 NewClsType = getDerived().TransformType(OldClsType);
5614 if (NewClsType.isNull())
5618 QualType
Result = TL.getType();
5619 if (getDerived().AlwaysRebuild() ||
5621 NewClsType != OldClsType) {
5622 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5630 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5631 if (MPT && PointeeType != MPT->getPointeeType()) {
5632 assert(isa<AdjustedType>(MPT->getPointeeType()));
5633 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5636 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5637 NewTL.setSigilLoc(TL.getSigilLoc());
5638 NewTL.setClassTInfo(NewClsTInfo);
5643template<
typename Derived>
5645TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5646 ConstantArrayTypeLoc TL) {
5647 const ConstantArrayType *
T = TL.getTypePtr();
5648 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5649 if (ElementType.isNull())
5653 Expr *
OldSize = TL.getSizeExpr();
5655 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5656 Expr *NewSize =
nullptr;
5660 NewSize = getDerived().TransformExpr(
OldSize).template getAs<Expr>();
5664 QualType
Result = TL.getType();
5665 if (getDerived().AlwaysRebuild() ||
5666 ElementType !=
T->getElementType() ||
5667 (
T->getSizeExpr() && NewSize !=
OldSize)) {
5668 Result = getDerived().RebuildConstantArrayType(ElementType,
5669 T->getSizeModifier(),
5670 T->getSize(), NewSize,
5671 T->getIndexTypeCVRQualifiers(),
5672 TL.getBracketsRange());
5681 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5682 NewTL.setLBracketLoc(TL.getLBracketLoc());
5683 NewTL.setRBracketLoc(TL.getRBracketLoc());
5684 NewTL.setSizeExpr(NewSize);
5689template<
typename Derived>
5690QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5691 TypeLocBuilder &TLB,
5692 IncompleteArrayTypeLoc TL) {
5693 const IncompleteArrayType *
T = TL.getTypePtr();
5694 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5695 if (ElementType.isNull())
5698 QualType
Result = TL.getType();
5699 if (getDerived().AlwaysRebuild() ||
5700 ElementType !=
T->getElementType()) {
5701 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5702 T->getSizeModifier(),
5703 T->getIndexTypeCVRQualifiers(),
5704 TL.getBracketsRange());
5709 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5710 NewTL.setLBracketLoc(TL.getLBracketLoc());
5711 NewTL.setRBracketLoc(TL.getRBracketLoc());
5712 NewTL.setSizeExpr(
nullptr);
5717template<
typename Derived>
5719TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5720 VariableArrayTypeLoc TL) {
5721 const VariableArrayType *
T = TL.getTypePtr();
5722 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5723 if (ElementType.isNull())
5728 EnterExpressionEvaluationContext Context(
5730 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5732 if (SizeResult.isInvalid())
5736 if (SizeResult.isInvalid())
5739 Expr *
Size = SizeResult.get();
5741 QualType
Result = TL.getType();
5742 if (getDerived().AlwaysRebuild() ||
5743 ElementType !=
T->getElementType() ||
5744 Size !=
T->getSizeExpr()) {
5745 Result = getDerived().RebuildVariableArrayType(ElementType,
5746 T->getSizeModifier(),
5748 T->getIndexTypeCVRQualifiers(),
5749 TL.getBracketsRange());
5756 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5757 NewTL.setLBracketLoc(TL.getLBracketLoc());
5758 NewTL.setRBracketLoc(TL.getRBracketLoc());
5759 NewTL.setSizeExpr(Size);
5764template<
typename Derived>
5766TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5767 DependentSizedArrayTypeLoc TL) {
5768 const DependentSizedArrayType *
T = TL.getTypePtr();
5769 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5770 if (ElementType.isNull())
5778 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5781 Expr *origSize = TL.getSizeExpr();
5782 if (!origSize) origSize =
T->getSizeExpr();
5785 = getDerived().TransformExpr(origSize);
5787 if (sizeResult.isInvalid())
5790 Expr *size = sizeResult.get();
5792 QualType
Result = TL.getType();
5793 if (getDerived().AlwaysRebuild() ||
5794 ElementType !=
T->getElementType() ||
5796 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5797 T->getSizeModifier(),
5799 T->getIndexTypeCVRQualifiers(),
5800 TL.getBracketsRange());
5807 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5808 NewTL.setLBracketLoc(TL.getLBracketLoc());
5809 NewTL.setRBracketLoc(TL.getRBracketLoc());
5810 NewTL.setSizeExpr(size);
5815template <
typename Derived>
5816QualType TreeTransform<Derived>::TransformDependentVectorType(
5817 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5818 const DependentVectorType *
T = TL.getTypePtr();
5819 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5820 if (ElementType.isNull())
5828 if (
Size.isInvalid())
5831 QualType
Result = TL.getType();
5832 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5833 Size.get() !=
T->getSizeExpr()) {
5834 Result = getDerived().RebuildDependentVectorType(
5835 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5841 if (isa<DependentVectorType>(
Result)) {
5842 DependentVectorTypeLoc NewTL =
5843 TLB.push<DependentVectorTypeLoc>(
Result);
5844 NewTL.setNameLoc(TL.getNameLoc());
5846 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5847 NewTL.setNameLoc(TL.getNameLoc());
5853template<
typename Derived>
5854QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5855 TypeLocBuilder &TLB,
5856 DependentSizedExtVectorTypeLoc TL) {
5857 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5860 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5861 if (ElementType.isNull())
5870 if (
Size.isInvalid())
5873 QualType
Result = TL.getType();
5874 if (getDerived().AlwaysRebuild() ||
5875 ElementType !=
T->getElementType() ||
5876 Size.get() !=
T->getSizeExpr()) {
5877 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5879 T->getAttributeLoc());
5885 if (isa<DependentSizedExtVectorType>(
Result)) {
5886 DependentSizedExtVectorTypeLoc NewTL
5887 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5888 NewTL.setNameLoc(TL.getNameLoc());
5890 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5891 NewTL.setNameLoc(TL.getNameLoc());
5897template <
typename Derived>
5899TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5900 ConstantMatrixTypeLoc TL) {
5901 const ConstantMatrixType *
T = TL.getTypePtr();
5902 QualType ElementType = getDerived().TransformType(
T->getElementType());
5903 if (ElementType.isNull())
5906 QualType
Result = TL.getType();
5907 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
5908 Result = getDerived().RebuildConstantMatrixType(
5909 ElementType,
T->getNumRows(),
T->getNumColumns());
5914 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5915 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5916 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5917 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5918 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5923template <
typename Derived>
5924QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5925 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5926 const DependentSizedMatrixType *
T = TL.getTypePtr();
5928 QualType ElementType = getDerived().TransformType(
T->getElementType());
5929 if (ElementType.isNull()) {
5937 Expr *origRows = TL.getAttrRowOperand();
5939 origRows =
T->getRowExpr();
5940 Expr *origColumns = TL.getAttrColumnOperand();
5942 origColumns =
T->getColumnExpr();
5944 ExprResult rowResult = getDerived().TransformExpr(origRows);
5946 if (rowResult.isInvalid())
5949 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5951 if (columnResult.isInvalid())
5954 Expr *rows = rowResult.get();
5955 Expr *columns = columnResult.get();
5957 QualType
Result = TL.getType();
5958 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5959 rows != origRows || columns != origColumns) {
5960 Result = getDerived().RebuildDependentSizedMatrixType(
5961 ElementType, rows, columns,
T->getAttributeLoc());
5969 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5970 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5971 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5972 NewTL.setAttrRowOperand(rows);
5973 NewTL.setAttrColumnOperand(columns);
5977template <
typename Derived>
5978QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5979 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5980 const DependentAddressSpaceType *
T = TL.getTypePtr();
5982 QualType pointeeType =
5983 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
5985 if (pointeeType.isNull())
5992 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
5994 if (AddrSpace.isInvalid())
5997 QualType
Result = TL.getType();
5998 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
5999 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6000 Result = getDerived().RebuildDependentAddressSpaceType(
6001 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6007 if (isa<DependentAddressSpaceType>(
Result)) {
6008 DependentAddressSpaceTypeLoc NewTL =
6009 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
6011 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6012 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6013 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6016 TLB.TypeWasModifiedSafely(
Result);
6022template <
typename Derived>
6023QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
6025 const VectorType *
T = TL.getTypePtr();
6026 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6027 if (ElementType.isNull())
6030 QualType
Result = TL.getType();
6031 if (getDerived().AlwaysRebuild() ||
6032 ElementType !=
T->getElementType()) {
6033 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6034 T->getVectorKind());
6039 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
6040 NewTL.setNameLoc(TL.getNameLoc());
6045template<
typename Derived>
6046QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
6047 ExtVectorTypeLoc TL) {
6048 const VectorType *
T = TL.getTypePtr();
6049 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6050 if (ElementType.isNull())
6053 QualType
Result = TL.getType();
6054 if (getDerived().AlwaysRebuild() ||
6055 ElementType !=
T->getElementType()) {
6056 Result = getDerived().RebuildExtVectorType(ElementType,
6057 T->getNumElements(),
6063 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
6064 NewTL.setNameLoc(TL.getNameLoc());
6069template <
typename Derived>
6072 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
6076 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
6103 NewDI = getDerived().TransformType(OldDI);
6107 if (NewDI == OldDI && indexAdjustment == 0)
6121 transformedLocalDecl(OldParm, {newParm});
6125template <
typename Derived>
6133 unsigned *LastParamTransformed) {
6134 int indexAdjustment = 0;
6136 unsigned NumParams = Params.size();
6137 for (
unsigned i = 0; i != NumParams; ++i) {
6138 if (LastParamTransformed)
6139 *LastParamTransformed = i;
6141 assert(OldParm->getFunctionScopeIndex() == i);
6143 std::optional<unsigned> NumExpansions;
6145 if (OldParm->isParameterPack()) {
6150 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6156 bool ShouldExpand =
false;
6157 bool RetainExpansion =
false;
6158 std::optional<unsigned> OrigNumExpansions;
6159 if (Unexpanded.size() > 0) {
6161 NumExpansions = OrigNumExpansions;
6162 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
6163 Pattern.getSourceRange(),
6175 "Could not find parameter packs or undeduced auto type!");
6182 getDerived().ExpandingFunctionParameterPack(OldParm);
6183 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6186 = getDerived().TransformFunctionTypeParam(OldParm,
6194 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6195 OutParamTypes.push_back(NewParm->
getType());
6197 PVars->push_back(NewParm);
6202 if (RetainExpansion) {
6203 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6205 = getDerived().TransformFunctionTypeParam(OldParm,
6213 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6214 OutParamTypes.push_back(NewParm->
getType());
6216 PVars->push_back(NewParm);
6232 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6237 "Parameter pack no longer a parameter pack after "
6240 NewParm = getDerived().TransformFunctionTypeParam(
6241 OldParm, indexAdjustment, std::nullopt,
6249 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6250 OutParamTypes.push_back(NewParm->
getType());
6252 PVars->push_back(NewParm);
6260 bool IsPackExpansion =
false;
6261 std::optional<unsigned> NumExpansions;
6264 = dyn_cast<PackExpansionType>(OldType)) {
6266 QualType Pattern = Expansion->getPattern();
6268 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6271 bool ShouldExpand =
false;
6272 bool RetainExpansion =
false;
6284 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6286 QualType NewType = getDerived().TransformType(Pattern);
6291 NewType = getSema().getASTContext().getPackExpansionType(
6292 NewType, std::nullopt);
6299 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6300 OutParamTypes.push_back(NewType);
6302 PVars->push_back(
nullptr);
6311 if (RetainExpansion) {
6312 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6313 QualType NewType = getDerived().TransformType(Pattern);
6318 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6319 OutParamTypes.push_back(NewType);
6321 PVars->push_back(
nullptr);
6326 OldType = Expansion->getPattern();
6327 IsPackExpansion =
true;
6329 NewType = getDerived().TransformType(OldType);
6331 NewType = getDerived().TransformType(OldType);
6337 if (IsPackExpansion)
6338 NewType = getSema().Context.getPackExpansionType(NewType,
6342 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6343 OutParamTypes.push_back(NewType);
6345 PVars->push_back(
nullptr);
6350 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6352 assert(parm->getFunctionScopeIndex() == i);
6359template<
typename Derived>
6364 return getDerived().TransformFunctionProtoType(
6367 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6368 ExceptionStorage, Changed);
6372template<
typename Derived>
template<
typename Fn>
6375 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6392 if (getDerived().TransformFunctionTypeParams(
6396 ParamTypes, &ParamDecls, ExtParamInfos))
6408 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6410 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6416 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6420 if (getDerived().TransformFunctionTypeParams(
6424 ParamTypes, &ParamDecls, ExtParamInfos))
6430 bool EPIChanged =
false;
6435 if (
auto NewExtParamInfos =
6451 std::optional<FunctionEffectSet> NewFX;
6460 ExprResult NewExpr = getDerived().TransformExpr(CondExpr);
6463 std::optional<FunctionEffectMode> Mode =
6483 "FunctionEffectMode::None shouldn't be possible here");
6489 NewFX->insert(NewEC, Errs);
6490 assert(Errs.empty());
6498 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6500 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6511 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6517template<
typename Derived>
6527 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6529 SemaRef, Method ? Method->getParent() :
nullptr,
6530 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6540 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6563 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6568 bool Expand =
false;
6569 bool RetainExpansion =
false;
6570 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6573 if (getDerived().TryExpandParameterPacks(
6575 RetainExpansion, NumExpansions))
6583 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6588 Exceptions.push_back(
U);
6594 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6597 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6601 Exceptions.push_back(
U);
6610 Exceptions.push_back(
U);
6620template<
typename Derived>
6630 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6631 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6642template <
typename Derived>
6643QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6644 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6645 const UnresolvedUsingType *
T = TL.getTypePtr();
6646 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6650 QualType
Result = TL.getType();
6651 if (getDerived().AlwaysRebuild() ||
D !=
T->getDecl()) {
6652 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(),
D);
6659 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6660 NewTL.setNameLoc(TL.getNameLoc());
6665template <
typename Derived>
6666QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6668 const UsingType *
T = TL.getTypePtr();
6670 auto *
Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6671 TL.getLocalSourceRange().getBegin(),
T->getFoundDecl()));
6675 QualType Underlying = getDerived().TransformType(
T->
desugar());
6676 if (Underlying.isNull())
6679 QualType
Result = TL.getType();
6680 if (getDerived().AlwaysRebuild() ||
Found !=
T->getFoundDecl() ||
6681 Underlying !=
T->getUnderlyingType()) {
6682 Result = getDerived().RebuildUsingType(
Found, Underlying);
6687 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6691template<
typename Derived>
6692QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6693 TypedefTypeLoc TL) {
6694 const TypedefType *
T = TL.getTypePtr();
6695 TypedefNameDecl *Typedef
6696 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6701 QualType
Result = TL.getType();
6702 if (getDerived().AlwaysRebuild() ||
6703 Typedef !=
T->getDecl()) {
6704 Result = getDerived().RebuildTypedefType(Typedef);
6709 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6710 NewTL.setNameLoc(TL.getNameLoc());
6715template<
typename Derived>
6716QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6717 TypeOfExprTypeLoc TL) {
6723 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6731 QualType
Result = TL.getType();
6733 if (getDerived().AlwaysRebuild() ||
E.get() != TL.getUnderlyingExpr()) {
6735 getDerived().RebuildTypeOfExprType(
E.get(), TL.getTypeofLoc(), Kind);
6740 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6741 NewTL.setTypeofLoc(TL.getTypeofLoc());
6742 NewTL.setLParenLoc(TL.getLParenLoc());
6743 NewTL.setRParenLoc(TL.getRParenLoc());
6748template<
typename Derived>
6749QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6751 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6752 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6756 QualType
Result = TL.getType();
6758 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6759 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6764 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6765 NewTL.setTypeofLoc(TL.getTypeofLoc());
6766 NewTL.setLParenLoc(TL.getLParenLoc());
6767 NewTL.setRParenLoc(TL.getRParenLoc());
6768 NewTL.setUnmodifiedTInfo(New_Under_TI);
6773template<
typename Derived>
6774QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6775 DecltypeTypeLoc TL) {
6776 const DecltypeType *
T = TL.getTypePtr();
6783 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6787 E = getSema().ActOnDecltypeExpression(
E.get());
6791 QualType
Result = TL.getType();
6792 if (getDerived().AlwaysRebuild() ||
6793 E.get() !=
T->getUnderlyingExpr()) {
6794 Result = getDerived().RebuildDecltypeType(
E.get(), TL.getDecltypeLoc());
6800 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6801 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6802 NewTL.setRParenLoc(TL.getRParenLoc());
6806template <
typename Derived>
6808TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6809 PackIndexingTypeLoc TL) {
6813 EnterExpressionEvaluationContext ConstantContext(
6816 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6817 if (IndexExpr.isInvalid())
6820 QualType Pattern = TL.getPattern();
6822 const PackIndexingType *PIT = TL.getTypePtr();
6826 bool NotYetExpanded = Types.empty();
6827 bool FullySubstituted =
true;
6829 if (Types.empty() && !PIT->expandsToEmptyPack())
6832 for (QualType
T : Types) {
6834 QualType Transformed = getDerived().TransformType(
T);
6835 if (Transformed.isNull())
6837 SubtitutedTypes.push_back(Transformed);
6842 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
6843 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6846 bool ShouldExpand =
true;
6847 bool RetainExpansion =
false;
6848 std::optional<unsigned> OrigNumExpansions;
6849 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6850 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6851 Unexpanded, ShouldExpand,
6852 RetainExpansion, NumExpansions))
6854 if (!ShouldExpand) {
6855 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6858 TypeSourceInfo *TI =
6860 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6863 if (NotYetExpanded) {
6864 FullySubstituted =
false;
6865 QualType Out = getDerived().RebuildPackIndexingType(
6866 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6871 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6872 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6875 SubtitutedTypes.push_back(Pack);
6878 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6879 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6880 QualType Out = getDerived().TransformType(
T);
6883 SubtitutedTypes.push_back(Out);
6884 FullySubstituted &= !Out->containsUnexpandedParameterPack();
6888 if (RetainExpansion) {
6889 FullySubstituted =
false;
6890 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6891 QualType Out = getDerived().TransformType(
T);
6894 SubtitutedTypes.push_back(Out);
6901 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6902 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6904 QualType Out = getDerived().RebuildPackIndexingType(
6905 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6906 FullySubstituted, SubtitutedTypes);
6910 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6911 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6915template<
typename Derived>
6916QualType TreeTransform<Derived>::TransformUnaryTransformType(
6917 TypeLocBuilder &TLB,
6918 UnaryTransformTypeLoc TL) {
6919 QualType
Result = TL.getType();
6920 if (
Result->isDependentType()) {
6921 const UnaryTransformType *
T = TL.getTypePtr();
6923 TypeSourceInfo *NewBaseTSI =
6924 getDerived().TransformType(TL.getUnderlyingTInfo());
6927 QualType NewBase = NewBaseTSI->getType();
6929 Result = getDerived().RebuildUnaryTransformType(NewBase,
6936 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6937 NewTL.setKWLoc(TL.getKWLoc());
6938 NewTL.setParensRange(TL.getParensRange());
6939 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6943template<
typename Derived>
6944QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6945 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6946 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
6949 TemplateName TemplateName = getDerived().TransformTemplateName(
6950 SS,
T->getTemplateName(), TL.getTemplateNameLoc());
6951 if (TemplateName.isNull())
6954 QualType OldDeduced =
T->getDeducedType();
6955 QualType NewDeduced;
6956 if (!OldDeduced.isNull()) {
6957 NewDeduced = getDerived().TransformType(OldDeduced);
6958 if (NewDeduced.isNull())
6962 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6963 TemplateName, NewDeduced);
6967 DeducedTemplateSpecializationTypeLoc NewTL =
6968 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6969 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6974template<
typename Derived>
6975QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6977 const RecordType *
T = TL.getTypePtr();
6979 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6984 QualType
Result = TL.getType();
6985 if (getDerived().AlwaysRebuild() ||
6992 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6993 NewTL.setNameLoc(TL.getNameLoc());
6998template<
typename Derived>
6999QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
7001 const EnumType *
T = TL.getTypePtr();
7003 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
7008 QualType
Result = TL.getType();
7009 if (getDerived().AlwaysRebuild() ||
7010 Enum !=
T->getDecl()) {
7016 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
7017 NewTL.setNameLoc(TL.getNameLoc());
7022template<
typename Derived>
7023QualType TreeTransform<Derived>::TransformInjectedClassNameType(
7024 TypeLocBuilder &TLB,
7025 InjectedClassNameTypeLoc TL) {
7026 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
7027 TL.getTypePtr()->getDecl());
7028 if (!
D)
return QualType();
7031 TLB.pushTypeSpec(
T).setNameLoc(TL.getNameLoc());
7035template<
typename Derived>
7039 return getDerived().TransformTemplateTypeParmType(
7044template <
typename Derived>
7050template<
typename Derived>
7051QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7052 TypeLocBuilder &TLB,
7053 SubstTemplateTypeParmTypeLoc TL) {
7054 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
7057 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
7062 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7063 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
7064 if (Replacement.isNull())
7068 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex());
7071 SubstTemplateTypeParmTypeLoc NewTL
7072 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7073 NewTL.setNameLoc(TL.getNameLoc());
7078template<
typename Derived>
7082 return getDerived().TransformSubstTemplateTypeParmPackType(
7086template <
typename Derived>
7092template<
typename Derived>
7102 = getDerived().TransformTemplateName(SS,
T->getTemplateName(),
7107 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
7110template<
typename Derived>
7118 if (getDerived().AlwaysRebuild() ||
7120 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
7125 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
7133template <
typename Derived>
7134QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
7136 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7137 if (ValueType.isNull())
7140 QualType
Result = TL.getType();
7141 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7142 const PipeType *PT =
Result->castAs<PipeType>();
7143 bool isReadPipe = PT->isReadOnly();
7144 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7149 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
7150 NewTL.setKWLoc(TL.getKWLoc());
7155template <
typename Derived>
7156QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
7158 const BitIntType *EIT = TL.getTypePtr();
7159 QualType
Result = TL.getType();
7161 if (getDerived().AlwaysRebuild()) {
7162 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7163 EIT->getNumBits(), TL.getNameLoc());
7168 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7169 NewTL.setNameLoc(TL.getNameLoc());
7173template <
typename Derived>
7174QualType TreeTransform<Derived>::TransformDependentBitIntType(
7175 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
7176 const DependentBitIntType *EIT = TL.getTypePtr();
7180 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7183 if (BitsExpr.isInvalid())
7186 QualType
Result = TL.getType();
7188 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7189 Result = getDerived().RebuildDependentBitIntType(
7190 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7196 if (isa<DependentBitIntType>(
Result)) {
7197 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
7198 NewTL.setNameLoc(TL.getNameLoc());
7200 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7201 NewTL.setNameLoc(TL.getNameLoc());
7211 template<
typename ArgLocContainer>
7213 ArgLocContainer *Container;
7238 : Container(&Container), Index(Index) { }
7252 return Container->getArgLoc(Index);
7256 return pointer(Container->getArgLoc(Index));
7261 return X.Container == Y.Container &&
X.Index == Y.Index;
7270template<
typename Derived>
7271QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7273 const AutoType *
T = TL.getTypePtr();
7274 QualType OldDeduced =
T->getDeducedType();
7275 QualType NewDeduced;
7276 if (!OldDeduced.isNull()) {
7277 NewDeduced = getDerived().TransformType(OldDeduced);
7278 if (NewDeduced.isNull())
7282 ConceptDecl *NewCD =
nullptr;
7283 TemplateArgumentListInfo NewTemplateArgs;
7284 NestedNameSpecifierLoc NewNestedNameSpec;
7285 if (
T->isConstrained()) {
7286 assert(TL.getConceptReference());
7287 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7288 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7290 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7291 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7292 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7293 if (getDerived().TransformTemplateArguments(
7294 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7298 if (TL.getNestedNameSpecifierLoc()) {
7300 = getDerived().TransformNestedNameSpecifierLoc(
7301 TL.getNestedNameSpecifierLoc());
7302 if (!NewNestedNameSpec)
7307 QualType
Result = TL.getType();
7308 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7312 NewArgList.reserve(NewTemplateArgs.size());
7313 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7314 NewArgList.push_back(ArgLoc.getArgument());
7315 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7321 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7322 NewTL.setNameLoc(TL.getNameLoc());
7323 NewTL.setRParenLoc(TL.getRParenLoc());
7324 NewTL.setConceptReference(
nullptr);
7326 if (
T->isConstrained()) {
7327 DeclarationNameInfo DNI = DeclarationNameInfo(
7328 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7329 TL.getConceptNameLoc(),
7330 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7332 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7333 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7335 NewTL.setConceptReference(CR);
7341template <
typename Derived>
7343 TypeLocBuilder &TLB,
7344 TemplateSpecializationTypeLoc TL,
7345 TemplateName Template) {
7346 TemplateArgumentListInfo NewTemplateArgs;
7347 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7348 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7349 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7351 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7352 ArgIterator(TL, TL.getNumArgs()),
7361 getDerived().RebuildTemplateSpecializationType(Template,
7362 TL.getTemplateNameLoc(),
7370 if (isa<DependentTemplateSpecializationType>(
Result)) {
7371 DependentTemplateSpecializationTypeLoc NewTL
7372 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7373 NewTL.setElaboratedKeywordLoc(SourceLocation());
7374 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7375 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7376 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7377 NewTL.setLAngleLoc(TL.getLAngleLoc());
7378 NewTL.setRAngleLoc(TL.getRAngleLoc());
7379 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7380 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7384 TemplateSpecializationTypeLoc NewTL
7385 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7386 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7387 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7388 NewTL.setLAngleLoc(TL.getLAngleLoc());
7389 NewTL.setRAngleLoc(TL.getRAngleLoc());
7390 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7391 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7397template <
typename Derived>
7408 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7416 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7418 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7428 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7434 = getDerived().RebuildTemplateSpecializationType(Template,
7446 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7453template<
typename Derived>
7468 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7469 if (NamedT.isNull())
7478 if (
const TemplateSpecializationType *TST =
7479 NamedT->getAs<TemplateSpecializationType>()) {
7480 TemplateName Template = TST->getTemplateName();
7481 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7482 Template.getAsTemplateDecl())) {
7484 diag::err_tag_reference_non_tag)
7486 << llvm::to_underlying(
7488 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7494 if (getDerived().AlwaysRebuild() ||
7496 NamedT !=
T->getNamedType()) {
7499 QualifierLoc, NamedT);
7504 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7506 NewTL.setQualifierLoc(QualifierLoc);
7510template <
typename Derived>
7511QualType TreeTransform<Derived>::TransformAttributedType(TypeLocBuilder &TLB,
7512 AttributedTypeLoc TL) {
7514 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7515 if (modifiedType.isNull())
7519 const Attr *oldAttr = TL.getAttr();
7520 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7521 if (oldAttr && !newAttr)
7524 QualType result = TL.getType();
7527 if (getDerived().AlwaysRebuild() ||
7528 modifiedType != oldType->getModifiedType()) {
7541 QualType equivalentType = modifiedType;
7542 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7543 TypeLocBuilder AuxiliaryTLB;
7544 AuxiliaryTLB.reserve(TL.getFullDataSize());
7546 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7547 if (equivalentType.isNull())
7553 if (
auto nullability = oldType->getImmediateNullability()) {
7554 if (!modifiedType->canHaveNullability()) {
7555 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7556 : TL.getModifiedLoc().getBeginLoc()),
7557 diag::err_nullability_nonpointer)
7569 AttributedTypeLoc newTL = TLB.push<AttributedTypeLoc>(result);
7570 newTL.setAttr(newAttr);
7574template <
typename Derived>
7575QualType TreeTransform<Derived>::TransformCountAttributedType(
7576 TypeLocBuilder &TLB, CountAttributedTypeLoc TL) {
7577 const CountAttributedType *OldTy = TL.
getTypePtr();
7578 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7579 if (InnerTy.isNull())
7582 Expr *OldCount = TL.getCountExpr();
7583 Expr *NewCount =
nullptr;
7585 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7586 if (CountResult.isInvalid())
7588 NewCount = CountResult.get();
7591 QualType
Result = TL.getType();
7592 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7593 OldCount != NewCount) {
7596 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7599 TLB.push<CountAttributedTypeLoc>(
Result);
7603template <
typename Derived>
7604QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7605 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7607 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7610template <
typename Derived>
7611QualType TreeTransform<Derived>::TransformHLSLAttributedResourceType(
7612 TypeLocBuilder &TLB, HLSLAttributedResourceTypeLoc TL) {
7614 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7616 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7617 if (WrappedTy.isNull())
7620 QualType ContainedTy = QualType();
7621 QualType OldContainedTy = oldType->getContainedType();
7622 if (!OldContainedTy.isNull()) {
7623 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7624 if (!oldContainedTSI)
7625 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7626 OldContainedTy, SourceLocation());
7627 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7630 ContainedTy = ContainedTSI->getType();
7633 QualType
Result = TL.getType();
7634 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7635 ContainedTy != oldType->getContainedType()) {
7637 WrappedTy, ContainedTy, oldType->getAttrs());
7640 TLB.push<HLSLAttributedResourceTypeLoc>(
Result);
7644template<
typename Derived>
7646TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7648 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7652 QualType
Result = TL.getType();
7653 if (getDerived().AlwaysRebuild() ||
7654 Inner != TL.getInnerLoc().getType()) {
7655 Result = getDerived().RebuildParenType(Inner);
7660 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7661 NewTL.setLParenLoc(TL.getLParenLoc());
7662 NewTL.setRParenLoc(TL.getRParenLoc());
7666template <
typename Derived>
7668TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7669 MacroQualifiedTypeLoc TL) {
7670 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7674 QualType
Result = TL.getType();
7675 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7677 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7682 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7683 NewTL.setExpansionLoc(TL.getExpansionLoc());
7687template<
typename Derived>
7688QualType TreeTransform<Derived>::TransformDependentNameType(
7689 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7690 return TransformDependentNameType(TLB, TL,
false);
7693template<
typename Derived>
7694QualType TreeTransform<Derived>::TransformDependentNameType(
7695 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7696 const DependentNameType *
T = TL.getTypePtr();
7698 NestedNameSpecifierLoc QualifierLoc
7699 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7704 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7705 TL.getElaboratedKeywordLoc(),
7713 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7714 QualType NamedT = ElabT->getNamedType();
7715 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7717 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7718 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7719 NewTL.setQualifierLoc(QualifierLoc);
7721 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7722 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7723 NewTL.setQualifierLoc(QualifierLoc);
7724 NewTL.setNameLoc(TL.getNameLoc());
7729template<
typename Derived>
7732 DependentTemplateSpecializationTypeLoc TL) {
7733 NestedNameSpecifierLoc QualifierLoc;
7734 if (TL.getQualifierLoc()) {
7736 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7742 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7745template<
typename Derived>
7758 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7763 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7771 QualType NamedT = ElabT->getNamedType();
7780 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7787 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7796 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7805 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7811template<
typename Derived>
7820 if (getDerived().AlwaysRebuild() ||
7822 Result = getDerived().RebuildPackExpansionType(Pattern,
7830 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7835template<
typename Derived>
7837TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7838 ObjCInterfaceTypeLoc TL) {
7840 TLB.pushFullCopy(TL);
7841 return TL.getType();
7844template<
typename Derived>
7846TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7847 ObjCTypeParamTypeLoc TL) {
7848 const ObjCTypeParamType *
T = TL.getTypePtr();
7849 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7850 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7854 QualType
Result = TL.getType();
7855 if (getDerived().AlwaysRebuild() ||
7856 OTP !=
T->getDecl()) {
7857 Result = getDerived().RebuildObjCTypeParamType(
7858 OTP, TL.getProtocolLAngleLoc(),
7859 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7860 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7865 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7866 if (TL.getNumProtocols()) {
7867 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7868 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7869 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7870 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7875template<
typename Derived>
7877TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7878 ObjCObjectTypeLoc TL) {
7880 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7881 if (BaseType.isNull())
7884 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7888 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7889 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7890 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7891 QualType TypeArg = TypeArgInfo->getType();
7892 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7896 const auto *PackExpansion = PackExpansionLoc.getType()
7897 ->castAs<PackExpansionType>();
7901 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7905 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7906 bool Expand =
false;
7907 bool RetainExpansion =
false;
7908 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7909 if (getDerived().TryExpandParameterPacks(
7910 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7911 Unexpanded, Expand, RetainExpansion, NumExpansions))
7918 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7920 TypeLocBuilder TypeArgBuilder;
7921 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7922 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7924 if (NewPatternType.isNull())
7928 NewPatternType, NumExpansions);
7929 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7930 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7931 NewTypeArgInfos.push_back(
7932 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7938 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7939 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7941 TypeLocBuilder TypeArgBuilder;
7942 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7944 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7946 if (NewTypeArg.isNull())
7949 NewTypeArgInfos.push_back(
7950 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7956 TypeLocBuilder TypeArgBuilder;
7957 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7958 QualType NewTypeArg =
7959 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7960 if (NewTypeArg.isNull())
7964 if (NewTypeArg == TypeArg) {
7965 NewTypeArgInfos.push_back(TypeArgInfo);
7969 NewTypeArgInfos.push_back(
7970 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7974 QualType
Result = TL.getType();
7975 if (getDerived().AlwaysRebuild() || AnyChanged) {
7977 Result = getDerived().RebuildObjCObjectType(
7978 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7979 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7980 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7981 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7987 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7988 NewT.setHasBaseTypeAsWritten(
true);
7989 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7990 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7991 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7992 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7993 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7994 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7995 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7996 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8000template<
typename Derived>
8002TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
8003 ObjCObjectPointerTypeLoc TL) {
8004 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8005 if (PointeeType.isNull())
8008 QualType
Result = TL.getType();
8009 if (getDerived().AlwaysRebuild() ||
8010 PointeeType != TL.getPointeeLoc().getType()) {
8011 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8017 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
8018 NewT.setStarLoc(TL.getStarLoc());
8025template<
typename Derived>
8027TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
8031template<
typename Derived>
8034 return getDerived().TransformCompoundStmt(S,
false);
8037template<
typename Derived>
8043 if (S->hasStoredFPFeatures())
8044 getSema().resetFPOptions(
8045 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
8048 bool SubStmtInvalid =
false;
8049 bool SubStmtChanged =
false;
8051 for (
auto *B : S->body()) {
8053 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
8055 if (
Result.isInvalid()) {
8058 if (isa<DeclStmt>(B))
8062 SubStmtInvalid =
true;
8066 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8067 Statements.push_back(
Result.getAs<Stmt>());
8073 if (!getDerived().AlwaysRebuild() &&
8077 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
8083template<
typename Derived>
8085TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
8092 LHS = getDerived().TransformExpr(S->getLHS());
8094 if (LHS.isInvalid())
8098 RHS = getDerived().TransformExpr(S->getRHS());
8100 if (RHS.isInvalid())
8107 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8109 S->getEllipsisLoc(),
8112 if (Case.isInvalid())
8117 getDerived().TransformStmt(S->getSubStmt());
8118 if (SubStmt.isInvalid())
8122 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8125template <
typename Derived>
8126StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
8129 getDerived().TransformStmt(S->getSubStmt());
8130 if (SubStmt.isInvalid())
8134 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8138template<
typename Derived>
8140TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
8141 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8142 if (SubStmt.isInvalid())
8145 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8153 if (LD == S->getDecl())
8154 S->getDecl()->setStmt(
nullptr);
8157 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8158 cast<LabelDecl>(LD), SourceLocation(),
8162template <
typename Derived>
8171 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8172#include "clang/Basic/AttrList.inc"
8177template <
typename Derived>
8188 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8189#include "clang/Basic/AttrList.inc"
8191 return TransformAttr(R);
8194template <
typename Derived>
8197 StmtDiscardKind SDK) {
8198 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8202 bool AttrsChanged =
false;
8206 for (
const auto *I : S->getAttrs()) {
8208 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
8209 AttrsChanged |= (I != R);
8214 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
8222 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8226template<
typename Derived>
8228TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
8231 if (
Init.isInvalid())
8234 Sema::ConditionResult Cond;
8235 if (!S->isConsteval()) {
8237 Cond = getDerived().TransformCondition(
8238 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8241 if (Cond.isInvalid())
8246 std::optional<bool> ConstexprConditionValue;
8247 if (S->isConstexpr())
8248 ConstexprConditionValue = Cond.getKnownValue();
8252 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8253 EnterExpressionEvaluationContext Ctx(
8256 S->isNonNegatedConsteval());
8258 Then = getDerived().TransformStmt(S->getThen());
8259 if (Then.isInvalid())
8265 Then =
new (getSema().Context)
8266 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8271 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8272 EnterExpressionEvaluationContext Ctx(
8275 S->isNegatedConsteval());
8277 Else = getDerived().TransformStmt(S->getElse());
8278 if (Else.isInvalid())
8280 }
else if (S->getElse() && ConstexprConditionValue &&
8281 *ConstexprConditionValue) {
8285 Else =
new (getSema().Context)
8286 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8289 if (!getDerived().AlwaysRebuild() &&
8290 Init.get() == S->getInit() &&
8291 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8292 Then.get() == S->getThen() &&
8293 Else.get() == S->getElse())
8296 return getDerived().RebuildIfStmt(
8297 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8298 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8301template<
typename Derived>
8303TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8306 if (
Init.isInvalid())
8310 Sema::ConditionResult Cond = getDerived().TransformCondition(
8311 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8313 if (Cond.isInvalid())
8318 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8319 Init.get(), Cond, S->getRParenLoc());
8324 StmtResult Body = getDerived().TransformStmt(S->getBody());
8325 if (Body.isInvalid())
8329 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8333template<
typename Derived>
8335TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8337 Sema::ConditionResult Cond = getDerived().TransformCondition(
8338 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8340 if (Cond.isInvalid())
8345 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8349 StmtResult Body = getDerived().TransformStmt(S->getBody());
8350 if (Body.isInvalid())
8353 if (!getDerived().AlwaysRebuild() &&
8354 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8355 Body.get() == S->getBody())
8358 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8359 Cond, S->getRParenLoc(), Body.get());
8362template<
typename Derived>
8364TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8367 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8371 StmtResult Body = getDerived().TransformStmt(S->getBody());
8372 if (Body.isInvalid())
8376 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8377 if (Cond.isInvalid())
8380 if (!getDerived().AlwaysRebuild() &&
8381 Cond.get() == S->getCond() &&
8382 Body.get() == S->getBody())
8385 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8386 S->getWhileLoc(), Cond.get(),
8390template<
typename Derived>
8392TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8393 if (getSema().getLangOpts().OpenMP)
8394 getSema().OpenMP().startOpenMPLoop();
8398 if (
Init.isInvalid())
8403 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8404 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8408 Sema::ConditionResult Cond = getDerived().TransformCondition(
8409 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8411 if (Cond.isInvalid())
8416 if (
Inc.isInvalid())
8419 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8420 if (S->getInc() && !FullInc.get())
8425 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8427 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8428 Cond.get().second, S->getInc(),
Inc.get());
8431 StmtResult Body = getDerived().TransformStmt(S->getBody());
8432 if (Body.isInvalid())
8437 if (!getDerived().AlwaysRebuild() &&
8438 Init.get() == S->getInit() &&
8439 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8440 Inc.get() == S->getInc() &&
8441 Body.get() == S->getBody())
8444 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8445 Init.get(), Cond, FullInc,
8446 S->getRParenLoc(), Body.get());
8449template<
typename Derived>
8451TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8452 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8458 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8459 cast<LabelDecl>(LD));
8462template<
typename Derived>
8464TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8470 if (!getDerived().AlwaysRebuild() &&
8471 Target.get() == S->getTarget())
8474 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8478template<
typename Derived>
8480TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8484template<
typename Derived>
8486TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8490template<
typename Derived>
8492TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8500 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8503template<
typename Derived>
8505TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8506 bool DeclChanged =
false;
8508 LambdaScopeInfo *LSI = getSema().getCurLambda();
8509 for (
auto *
D : S->decls()) {
8514 if (Transformed !=
D)
8518 if (
auto *TD = dyn_cast<TypeDecl>(Transformed))
8519 LSI->ContainsUnexpandedParameterPack |=
8522 .getTypeDeclType(TD)
8523 .getSingleStepDesugaredType(getSema().getASTContext())
8524 ->containsUnexpandedParameterPack();
8526 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8527 LSI->ContainsUnexpandedParameterPack |=
8528 VD->getType()->containsUnexpandedParameterPack();
8531 Decls.push_back(Transformed);
8534 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8537 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8540template<
typename Derived>
8542TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8551 bool ExprsChanged =
false;
8554 for (
unsigned I = 0,
E = S->getNumOutputs(); I !=
E; ++I) {
8555 Names.push_back(S->getOutputIdentifier(I));
8558 Constraints.push_back(S->getOutputConstraintLiteral(I));
8561 Expr *OutputExpr = S->getOutputExpr(I);
8566 ExprsChanged |=
Result.get() != OutputExpr;
8568 Exprs.push_back(
Result.get());
8572 for (
unsigned I = 0,
E = S->getNumInputs(); I !=
E; ++I) {
8573 Names.push_back(S->getInputIdentifier(I));
8576 Constraints.push_back(S->getInputConstraintLiteral(I));
8579 Expr *InputExpr = S->getInputExpr(I);
8584 ExprsChanged |=
Result.get() != InputExpr;
8586 Exprs.push_back(
Result.get());
8590 for (
unsigned I = 0,
E = S->getNumLabels(); I !=
E; ++I) {
8591 Names.push_back(S->getLabelIdentifier(I));
8596 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8597 Exprs.push_back(
Result.get());
8599 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8603 for (
unsigned I = 0,
E = S->getNumClobbers(); I !=
E; ++I)
8604 Clobbers.push_back(S->getClobberStringLiteral(I));
8607 AsmString = S->getAsmString();
8608 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8609 S->isVolatile(), S->getNumOutputs(),
8610 S->getNumInputs(), Names.data(),
8611 Constraints, Exprs, AsmString.get(),
8612 Clobbers, S->getNumLabels(),
8616template<
typename Derived>
8618TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8621 bool HadError =
false, HadChange =
false;
8625 TransformedExprs.reserve(SrcExprs.size());
8626 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8628 if (!
Result.isUsable()) {
8631 HadChange |= (
Result.get() != SrcExprs[i]);
8632 TransformedExprs.push_back(
Result.get());
8637 if (!HadChange && !getDerived().AlwaysRebuild())
8640 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8641 AsmToks, S->getAsmString(),
8642 S->getNumOutputs(), S->getNumInputs(),
8643 S->getAllConstraints(), S->getClobbers(),
8644 TransformedExprs, S->getEndLoc());
8648template<
typename Derived>
8650TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8652 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8653 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8654 ScopeInfo->NeedsCoroutineSuspends &&
8655 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8656 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8657 "expected clean scope info");
8661 ScopeInfo->setNeedsCoroutineSuspends(
false);
8674 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8675 ScopeInfo->CoroutinePromise = Promise;
8680 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8681 if (InitSuspend.isInvalid())
8684 getDerived().TransformStmt(S->getFinalSuspendStmt());
8685 if (FinalSuspend.isInvalid() ||
8688 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8689 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8691 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8692 if (BodyRes.isInvalid())
8695 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8696 if (Builder.isInvalid())
8699 Expr *ReturnObject = S->getReturnValueInit();
8700 assert(ReturnObject &&
"the return object is expected to be valid");
8701 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8703 if (Res.isInvalid())
8705 Builder.ReturnValue = Res.get();
8710 if (S->hasDependentPromiseType()) {
8713 if (!Promise->getType()->isDependentType()) {
8714 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8715 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8716 "these nodes should not have been built yet");
8717 if (!Builder.buildDependentStatements())
8721 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8722 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8723 if (Res.isInvalid())
8725 Builder.OnFallthrough = Res.get();
8728 if (
auto *OnException = S->getExceptionHandler()) {
8729 StmtResult Res = getDerived().TransformStmt(OnException);
8730 if (Res.isInvalid())
8732 Builder.OnException = Res.get();
8735 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8736 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8737 if (Res.isInvalid())
8739 Builder.ReturnStmtOnAllocFailure = Res.get();
8743 assert(S->getAllocate() && S->getDeallocate() &&
8744 "allocation and deallocation calls must already be built");
8745 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8746 if (AllocRes.isInvalid())
8748 Builder.Allocate = AllocRes.get();
8750 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8751 if (DeallocRes.isInvalid())
8753 Builder.Deallocate = DeallocRes.get();
8755 if (
auto *ResultDecl = S->getResultDecl()) {
8756 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8757 if (Res.isInvalid())
8759 Builder.ResultDecl = Res.get();
8762 if (
auto *ReturnStmt = S->getReturnStmt()) {
8763 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8764 if (Res.isInvalid())
8766 Builder.ReturnStmt = Res.get();
8770 return getDerived().RebuildCoroutineBodyStmt(Builder);
8773template<
typename Derived>
8775TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8783 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8787template <
typename Derived>
8788ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *
E) {
8800 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8801 getSema().getCurScope(),
E->getKeywordLoc());
8805 return getDerived().RebuildCoawaitExpr(
8807 cast<UnresolvedLookupExpr>(Lookup.get()),
E->isImplicit());
8810template <
typename Derived>
8812TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *
E) {
8813 ExprResult OperandResult = getDerived().TransformInitializer(
E->getOperand(),
8815 if (OperandResult.isInvalid())
8818 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8819 E->getOperatorCoawaitLookup());
8821 if (LookupResult.isInvalid())
8826 return getDerived().RebuildDependentCoawaitExpr(
8827 E->getKeywordLoc(), OperandResult.get(),
8828 cast<UnresolvedLookupExpr>(LookupResult.get()));
8831template<
typename Derived>
8833TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *
E) {
8841 return getDerived().RebuildCoyieldExpr(
E->getKeywordLoc(),
Result.get());
8846template<
typename Derived>
8848TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8850 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8851 if (TryBody.isInvalid())
8855 bool AnyCatchChanged =
false;
8857 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8858 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8859 if (Catch.isInvalid())
8861 if (Catch.get() != S->getCatchStmt(I))
8862 AnyCatchChanged =
true;
8863 CatchStmts.push_back(Catch.get());
8868 if (S->getFinallyStmt()) {
8869 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8870 if (Finally.isInvalid())
8875 if (!getDerived().AlwaysRebuild() &&
8876 TryBody.get() == S->getTryBody() &&
8878 Finally.get() == S->getFinallyStmt())
8882 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8883 CatchStmts, Finally.get());
8886template<
typename Derived>
8888TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8890 VarDecl *Var =
nullptr;
8891 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8892 TypeSourceInfo *TSInfo =
nullptr;
8893 if (FromVar->getTypeSourceInfo()) {
8894 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8901 T = TSInfo->getType();
8903 T = getDerived().TransformType(FromVar->getType());
8908 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8913 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8914 if (Body.isInvalid())
8917 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8922template<
typename Derived>
8924TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8926 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8927 if (Body.isInvalid())
8931 if (!getDerived().AlwaysRebuild() &&
8932 Body.get() == S->getFinallyBody())
8936 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8940template<
typename Derived>
8942TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8944 if (S->getThrowExpr()) {
8945 Operand = getDerived().TransformExpr(S->getThrowExpr());
8950 if (!getDerived().AlwaysRebuild() &&
8951 Operand.get() == S->getThrowExpr())
8954 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8957template<
typename Derived>
8959TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8960 ObjCAtSynchronizedStmt *S) {
8966 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8972 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8973 if (Body.isInvalid())
8977 if (!getDerived().AlwaysRebuild() &&
8978 Object.get() == S->getSynchExpr() &&
8979 Body.get() == S->getSynchBody())
8983 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8984 Object.get(), Body.get());
8987template<
typename Derived>
8989TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8990 ObjCAutoreleasePoolStmt *S) {
8992 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8993 if (Body.isInvalid())
8997 if (!getDerived().AlwaysRebuild() &&
8998 Body.get() == S->getSubStmt())
9002 return getDerived().RebuildObjCAutoreleasePoolStmt(
9003 S->getAtLoc(), Body.get());
9006template<
typename Derived>
9008TreeTransform<Derived>::TransformObjCForCollectionStmt(
9009 ObjCForCollectionStmt *S) {
9012 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
9013 if (Element.isInvalid())
9017 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9018 if (Collection.isInvalid())
9022 StmtResult Body = getDerived().TransformStmt(S->getBody());
9023 if (Body.isInvalid())
9027 if (!getDerived().AlwaysRebuild() &&
9028 Element.get() == S->getElement() &&
9029 Collection.get() == S->getCollection() &&
9030 Body.get() == S->getBody())
9034 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9041template <
typename Derived>
9042StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
9044 VarDecl *Var =
nullptr;
9045 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9047 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9051 Var = getDerived().RebuildExceptionDecl(
9052 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9053 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9054 if (!Var || Var->isInvalidDecl())
9059 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9060 if (Handler.isInvalid())
9063 if (!getDerived().AlwaysRebuild() && !Var &&
9064 Handler.get() == S->getHandlerBlock())
9067 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9070template <
typename Derived>
9071StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
9073 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9074 if (TryBlock.isInvalid())
9078 bool HandlerChanged =
false;
9080 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9081 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9082 if (Handler.isInvalid())
9085 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9086 Handlers.push_back(Handler.getAs<Stmt>());
9089 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9093 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9097template<
typename Derived>
9099TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
9100 EnterExpressionEvaluationContext ForRangeInitContext(
9108 auto &LastRecord = getSema().currentEvaluationContext();
9109 LastRecord.InLifetimeExtendingContext =
true;
9110 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9113 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9114 if (
Init.isInvalid())
9123 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9124 auto ForRangeLifetimeExtendTemps =
9125 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9130 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9131 if (End.isInvalid())
9134 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9135 if (Cond.isInvalid())
9139 if (Cond.isInvalid())
9145 if (
Inc.isInvalid())
9150 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9151 if (LoopVar.isInvalid())
9155 if (getDerived().AlwaysRebuild() ||
9156 Init.get() != S->getInit() ||
9157 Range.get() != S->getRangeStmt() ||
9158 Begin.get() != S->getBeginStmt() ||
9159 End.get() != S->getEndStmt() ||
9160 Cond.get() != S->getCond() ||
9161 Inc.get() != S->getInc() ||
9162 LoopVar.get() != S->getLoopVarStmt()) {
9163 NewStmt = getDerived().RebuildCXXForRangeStmt(
9164 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9166 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9167 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9170 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
9177 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
9180 StmtResult Body = getDerived().TransformStmt(S->getBody());
9181 if (Body.isInvalid())
9188 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9189 NewStmt = getDerived().RebuildCXXForRangeStmt(
9190 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9192 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9193 if (NewStmt.isInvalid())
9197 if (NewStmt.get() == S)
9200 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9203template<
typename Derived>
9205TreeTransform<Derived>::TransformMSDependentExistsStmt(
9206 MSDependentExistsStmt *S) {
9208 NestedNameSpecifierLoc QualifierLoc;
9209 if (S->getQualifierLoc()) {
9211 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9217 DeclarationNameInfo NameInfo = S->getNameInfo();
9218 if (NameInfo.getName()) {
9219 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9220 if (!NameInfo.getName())
9225 if (!getDerived().AlwaysRebuild() &&
9226 QualifierLoc == S->getQualifierLoc() &&
9227 NameInfo.getName() == S->getNameInfo().getName())
9232 SS.Adopt(QualifierLoc);
9234 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9236 if (S->isIfExists())
9239 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9242 if (S->isIfNotExists())
9245 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9256 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9257 if (SubStmt.isInvalid())
9265 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9272template<
typename Derived>
9274TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *
E) {
9275 NestedNameSpecifierLoc QualifierLoc;
9276 if (
E->getQualifierLoc()) {
9278 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
9283 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
9284 getDerived().TransformDecl(
E->getMemberLoc(),
E->getPropertyDecl()));
9289 if (
Base.isInvalid())
9293 MSPropertyRefExpr(
Base.get(), PD,
E->isArrow(),
9295 QualifierLoc,
E->getMemberLoc());
9298template <
typename Derived>
9299ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
9300 MSPropertySubscriptExpr *
E) {
9301 auto BaseRes = getDerived().TransformExpr(
E->getBase());
9302 if (BaseRes.isInvalid())
9304 auto IdxRes = getDerived().TransformExpr(
E->getIdx());
9305 if (IdxRes.isInvalid())
9308 if (!getDerived().AlwaysRebuild() &&
9309 BaseRes.get() ==
E->getBase() &&
9310 IdxRes.get() ==
E->getIdx())
9313 return getDerived().RebuildArraySubscriptExpr(
9314 BaseRes.get(), SourceLocation(), IdxRes.get(),
E->getRBracketLoc());
9317template <
typename Derived>
9318StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
9319 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9320 if (TryBlock.isInvalid())
9323 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9324 if (Handler.isInvalid())
9327 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9328 Handler.get() == S->getHandler())
9331 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9332 TryBlock.get(), Handler.get());
9335template <
typename Derived>
9336StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9338 if (
Block.isInvalid())
9341 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9344template <
typename Derived>
9345StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9346 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9347 if (FilterExpr.isInvalid())
9351 if (
Block.isInvalid())
9354 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9358template <
typename Derived>
9360 if (isa<SEHFinallyStmt>(Handler))
9361 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9363 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9366template<
typename Derived>
9376template <
typename Derived>
9378TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9382 return getDerived().TransformStmt(L->getLoopStmt());
9385template <
typename Derived>
9392 TClauses.reserve(Clauses.size());
9396 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9397 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9398 getDerived().getSema().OpenMP().EndOpenMPClause();
9400 TClauses.push_back(Clause);
9402 TClauses.push_back(
nullptr);
9406 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9407 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9408 D->getDirectiveKind(),
9414 if (
D->getDirectiveKind() == OMPD_atomic ||
9415 D->getDirectiveKind() == OMPD_critical ||
9416 D->getDirectiveKind() == OMPD_section ||
9417 D->getDirectiveKind() == OMPD_master)
9418 CS =
D->getAssociatedStmt();
9420 CS =
D->getRawStmt();
9421 Body = getDerived().TransformStmt(CS);
9423 getSema().getLangOpts().OpenMPIRBuilder)
9424 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9427 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9432 if (TClauses.size() != Clauses.size()) {
9438 if (
D->getDirectiveKind() == OMPD_critical) {
9439 DirName = cast<OMPCriticalDirective>(
D)->getDirectiveName();
9440 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9443 if (
D->getDirectiveKind() == OMPD_cancellation_point) {
9444 CancelRegion = cast<OMPCancellationPointDirective>(
D)->getCancelRegion();
9445 }
else if (
D->getDirectiveKind() == OMPD_cancel) {
9446 CancelRegion = cast<OMPCancelDirective>(
D)->getCancelRegion();
9449 return getDerived().RebuildOMPExecutableDirective(
9450 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9459template <
typename Derived>
9466 TClauses.reserve(Clauses.size());
9469 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9470 OMPClause *Clause = getDerived().TransformOMPClause(
C);
9471 getDerived().getSema().OpenMP().EndOpenMPClause();
9473 TClauses.push_back(Clause);
9475 TClauses.push_back(
nullptr);
9479 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9480 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9481 D->getDirectiveKind(),
9486 assert(
D->getDirectiveKind() == OMPD_assume &&
9487 "Unexpected informational directive");
9488 Stmt *CS =
D->getAssociatedStmt();
9489 Body = getDerived().TransformStmt(CS);
9492 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9496 if (TClauses.size() != Clauses.size())
9501 return getDerived().RebuildOMPInformationalDirective(
9502 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9506template <
typename Derived>
9511 << getOpenMPDirectiveName(
D->getDirectiveKind());
9515template <
typename Derived>
9517TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *
D) {
9518 DeclarationNameInfo DirName;
9519 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9521 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9522 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9526template <
typename Derived>
9528TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *
D) {
9529 DeclarationNameInfo DirName;
9530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9532 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9537template <
typename Derived>
9539TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *
D) {
9540 DeclarationNameInfo DirName;
9541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9543 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9548template <
typename Derived>
9550TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *
D) {
9551 DeclarationNameInfo DirName;
9552 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9554 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9555 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9559template <
typename Derived>
9561TreeTransform<Derived>::TransformOMPReverseDirective(OMPReverseDirective *
D) {
9562 DeclarationNameInfo DirName;
9563 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9565 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9566 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9570template <
typename Derived>
9571StmtResult TreeTransform<Derived>::TransformOMPInterchangeDirective(
9572 OMPInterchangeDirective *
D) {
9573 DeclarationNameInfo DirName;
9574 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9576 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9577 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9581template <
typename Derived>
9583TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *
D) {
9584 DeclarationNameInfo DirName;
9585 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9587 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9588 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9592template <
typename Derived>
9594TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *
D) {
9595 DeclarationNameInfo DirName;
9596 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9598 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9599 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9603template <
typename Derived>
9605TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *
D) {
9606 DeclarationNameInfo DirName;
9607 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9609 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9610 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9614template <
typename Derived>
9616TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *
D) {
9617 DeclarationNameInfo DirName;
9618 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9620 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9621 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9625template <
typename Derived>
9627TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *
D) {
9628 DeclarationNameInfo DirName;
9629 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9631 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9632 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9636template <
typename Derived>
9638TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *
D) {
9639 DeclarationNameInfo DirName;
9640 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9642 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9643 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9647template <
typename Derived>
9649TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *
D) {
9650 DeclarationNameInfo DirName;
9651 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9653 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9654 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9658template <
typename Derived>
9660TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *
D) {
9661 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9662 OMPD_critical,
D->getDirectiveName(),
nullptr,
D->
getBeginLoc());
9663 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9664 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9668template <
typename Derived>
9669StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9670 OMPParallelForDirective *
D) {
9671 DeclarationNameInfo DirName;
9672 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9673 OMPD_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9674 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9675 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9679template <
typename Derived>
9680StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9681 OMPParallelForSimdDirective *
D) {
9682 DeclarationNameInfo DirName;
9683 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9684 OMPD_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9685 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9686 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9690template <
typename Derived>
9691StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9692 OMPParallelMasterDirective *
D) {
9693 DeclarationNameInfo DirName;
9694 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9695 OMPD_parallel_master, DirName,
nullptr,
D->
getBeginLoc());
9696 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9697 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9701template <
typename Derived>
9702StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9703 OMPParallelMaskedDirective *
D) {
9704 DeclarationNameInfo DirName;
9705 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9706 OMPD_parallel_masked, DirName,
nullptr,
D->
getBeginLoc());
9707 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9708 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9712template <
typename Derived>
9713StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9714 OMPParallelSectionsDirective *
D) {
9715 DeclarationNameInfo DirName;
9716 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9717 OMPD_parallel_sections, DirName,
nullptr,
D->
getBeginLoc());
9718 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9719 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9723template <
typename Derived>
9725TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *
D) {
9726 DeclarationNameInfo DirName;
9727 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9729 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9730 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9734template <
typename Derived>
9735StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9736 OMPTaskyieldDirective *
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>::TransformOMPBarrierDirective(OMPBarrierDirective *
D) {
9748 DeclarationNameInfo DirName;
9749 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9751 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9752 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9756template <
typename Derived>
9758TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *
D) {
9759 DeclarationNameInfo DirName;
9760 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9762 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9763 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9767template <
typename Derived>
9769TreeTransform<Derived>::TransformOMPAssumeDirective(OMPAssumeDirective *
D) {
9770 DeclarationNameInfo DirName;
9771 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9773 StmtResult Res = getDerived().TransformOMPInformationalDirective(
D);
9774 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9778template <
typename Derived>
9780TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *
D) {
9781 DeclarationNameInfo DirName;
9782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9784 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9789template <
typename Derived>
9790StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9791 OMPTaskgroupDirective *
D) {
9792 DeclarationNameInfo DirName;
9793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9795 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9796 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9800template <
typename Derived>
9802TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *
D) {
9803 DeclarationNameInfo DirName;
9804 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9806 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9807 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9811template <
typename Derived>
9813TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *
D) {
9814 DeclarationNameInfo DirName;
9815 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9817 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9818 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9822template <
typename Derived>
9824TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *
D) {
9825 DeclarationNameInfo DirName;
9826 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9828 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9829 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9833template <
typename Derived>
9835TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *
D) {
9836 DeclarationNameInfo DirName;
9837 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9839 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9840 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9844template <
typename Derived>
9846TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *
D) {
9847 DeclarationNameInfo DirName;
9848 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9850 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9851 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9855template <
typename Derived>
9857TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *
D) {
9858 DeclarationNameInfo DirName;
9859 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9861 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9862 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9866template <
typename Derived>
9867StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9868 OMPTargetDataDirective *
D) {
9869 DeclarationNameInfo DirName;
9870 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9872 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9873 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9877template <
typename Derived>
9878StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9879 OMPTargetEnterDataDirective *
D) {
9880 DeclarationNameInfo DirName;
9881 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9882 OMPD_target_enter_data, DirName,
nullptr,
D->
getBeginLoc());
9883 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9884 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9888template <
typename Derived>
9889StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9890 OMPTargetExitDataDirective *
D) {
9891 DeclarationNameInfo DirName;
9892 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9893 OMPD_target_exit_data, DirName,
nullptr,
D->
getBeginLoc());
9894 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9895 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9899template <
typename Derived>
9900StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9901 OMPTargetParallelDirective *
D) {
9902 DeclarationNameInfo DirName;
9903 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9904 OMPD_target_parallel, DirName,
nullptr,
D->
getBeginLoc());
9905 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9906 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9910template <
typename Derived>
9911StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9912 OMPTargetParallelForDirective *
D) {
9913 DeclarationNameInfo DirName;
9914 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9915 OMPD_target_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9916 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9917 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9921template <
typename Derived>
9922StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9923 OMPTargetUpdateDirective *
D) {
9924 DeclarationNameInfo DirName;
9925 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9926 OMPD_target_update, DirName,
nullptr,
D->
getBeginLoc());
9927 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9928 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9932template <
typename Derived>
9934TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *
D) {
9935 DeclarationNameInfo DirName;
9936 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9938 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9939 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9943template <
typename Derived>
9944StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9945 OMPCancellationPointDirective *
D) {
9946 DeclarationNameInfo DirName;
9947 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9948 OMPD_cancellation_point, DirName,
nullptr,
D->
getBeginLoc());
9949 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9950 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9954template <
typename Derived>
9956TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *
D) {
9957 DeclarationNameInfo DirName;
9958 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9960 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9961 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9965template <
typename Derived>
9967TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *
D) {
9968 DeclarationNameInfo DirName;
9969 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9971 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9972 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9976template <
typename Derived>
9977StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9978 OMPTaskLoopSimdDirective *
D) {
9979 DeclarationNameInfo DirName;
9980 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9981 OMPD_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9982 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9983 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9987template <
typename Derived>
9988StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9989 OMPMasterTaskLoopDirective *
D) {
9990 DeclarationNameInfo DirName;
9991 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9992 OMPD_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9993 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9994 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9998template <
typename Derived>
9999StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
10000 OMPMaskedTaskLoopDirective *
D) {
10001 DeclarationNameInfo DirName;
10002 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10003 OMPD_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10004 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10005 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10009template <
typename Derived>
10010StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
10011 OMPMasterTaskLoopSimdDirective *
D) {
10012 DeclarationNameInfo DirName;
10013 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10014 OMPD_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10015 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10016 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10020template <
typename Derived>
10021StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
10022 OMPMaskedTaskLoopSimdDirective *
D) {
10023 DeclarationNameInfo DirName;
10024 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10025 OMPD_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10026 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10027 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10031template <
typename Derived>
10032StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
10033 OMPParallelMasterTaskLoopDirective *
D) {
10034 DeclarationNameInfo DirName;
10035 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10036 OMPD_parallel_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10037 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10038 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10042template <
typename Derived>
10043StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
10044 OMPParallelMaskedTaskLoopDirective *
D) {
10045 DeclarationNameInfo DirName;
10046 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10047 OMPD_parallel_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10048 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10049 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10053template <
typename Derived>
10055TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
10056 OMPParallelMasterTaskLoopSimdDirective *
D) {
10057 DeclarationNameInfo DirName;
10058 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10059 OMPD_parallel_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10060 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10061 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10065template <
typename Derived>
10067TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
10068 OMPParallelMaskedTaskLoopSimdDirective *
D) {
10069 DeclarationNameInfo DirName;
10070 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10071 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10072 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10073 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10077template <
typename Derived>
10078StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
10079 OMPDistributeDirective *
D) {
10080 DeclarationNameInfo DirName;
10081 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10083 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10084 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10088template <
typename Derived>
10089StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
10090 OMPDistributeParallelForDirective *
D) {
10091 DeclarationNameInfo DirName;
10092 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10093 OMPD_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10094 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10095 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10099template <
typename Derived>
10101TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
10102 OMPDistributeParallelForSimdDirective *
D) {
10103 DeclarationNameInfo DirName;
10104 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10105 OMPD_distribute_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10106 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10107 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10111template <
typename Derived>
10112StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
10113 OMPDistributeSimdDirective *
D) {
10114 DeclarationNameInfo DirName;
10115 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10116 OMPD_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10117 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10118 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10122template <
typename Derived>
10123StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
10124 OMPTargetParallelForSimdDirective *
D) {
10125 DeclarationNameInfo DirName;
10126 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10127 OMPD_target_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10128 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10129 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10133template <
typename Derived>
10134StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
10135 OMPTargetSimdDirective *
D) {
10136 DeclarationNameInfo DirName;
10137 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10138 OMPD_target_simd, DirName,
nullptr,
D->
getBeginLoc());
10139 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10140 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10144template <
typename Derived>
10145StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
10146 OMPTeamsDistributeDirective *
D) {
10147 DeclarationNameInfo DirName;
10148 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10149 OMPD_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10150 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10151 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10155template <
typename Derived>
10156StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
10157 OMPTeamsDistributeSimdDirective *
D) {
10158 DeclarationNameInfo DirName;
10159 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10160 OMPD_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10161 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10162 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10166template <
typename Derived>
10167StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
10168 OMPTeamsDistributeParallelForSimdDirective *
D) {
10169 DeclarationNameInfo DirName;
10170 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10171 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10173 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10174 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10178template <
typename Derived>
10179StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
10180 OMPTeamsDistributeParallelForDirective *
D) {
10181 DeclarationNameInfo DirName;
10182 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10183 OMPD_teams_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10184 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10185 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10189template <
typename Derived>
10190StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
10191 OMPTargetTeamsDirective *
D) {
10192 DeclarationNameInfo DirName;
10193 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10194 OMPD_target_teams, DirName,
nullptr,
D->
getBeginLoc());
10195 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10196 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10200template <
typename Derived>
10201StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
10202 OMPTargetTeamsDistributeDirective *
D) {
10203 DeclarationNameInfo DirName;
10204 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10205 OMPD_target_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10206 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10207 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10211template <
typename Derived>
10213TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
10214 OMPTargetTeamsDistributeParallelForDirective *
D) {
10215 DeclarationNameInfo DirName;
10216 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10217 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10219 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10220 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10224template <
typename Derived>
10226 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
10227 OMPTargetTeamsDistributeParallelForSimdDirective *
D) {
10228 DeclarationNameInfo DirName;
10229 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10230 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10232 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10233 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10237template <
typename Derived>
10239TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
10240 OMPTargetTeamsDistributeSimdDirective *
D) {
10241 DeclarationNameInfo DirName;
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10243 OMPD_target_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10244 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10249template <
typename Derived>
10251TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *
D) {
10252 DeclarationNameInfo DirName;
10253 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10255 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10256 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10260template <
typename Derived>
10262TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *
D) {
10263 DeclarationNameInfo DirName;
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10266 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10273TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *
D) {
10274 DeclarationNameInfo DirName;
10275 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10277 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10278 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10282template <
typename Derived>
10283StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
10284 OMPGenericLoopDirective *
D) {
10285 DeclarationNameInfo DirName;
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10294StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
10295 OMPTeamsGenericLoopDirective *
D) {
10296 DeclarationNameInfo DirName;
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10299 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10304template <
typename Derived>
10305StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
10306 OMPTargetTeamsGenericLoopDirective *
D) {
10307 DeclarationNameInfo DirName;
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_target_teams_loop, DirName,
nullptr,
D->
getBeginLoc());
10310 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10316StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
10317 OMPParallelGenericLoopDirective *
D) {
10318 DeclarationNameInfo DirName;
10319 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10320 OMPD_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10321 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10322 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10326template <
typename Derived>
10328TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
10329 OMPTargetParallelGenericLoopDirective *
D) {
10330 DeclarationNameInfo DirName;
10331 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10332 OMPD_target_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10333 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10334 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10341template <
typename Derived>
10342OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
10343 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10344 if (Cond.isInvalid())
10346 return getDerived().RebuildOMPIfClause(
10347 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10348 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10351template <
typename Derived>
10352OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
10353 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10354 if (Cond.isInvalid())
10356 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10357 C->getLParenLoc(),
C->getEndLoc());
10360template <
typename Derived>
10362TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
10363 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10364 if (NumThreads.isInvalid())
10366 return getDerived().RebuildOMPNumThreadsClause(
10367 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10370template <
typename Derived>
10372TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
10373 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10376 return getDerived().RebuildOMPSafelenClause(
10377 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10380template <
typename Derived>
10382TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
10383 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10386 return getDerived().RebuildOMPAllocatorClause(
10387 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10390template <
typename Derived>
10392TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
10393 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10396 return getDerived().RebuildOMPSimdlenClause(
10397 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10400template <
typename Derived>
10401OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
10403 TransformedSizes.reserve(
C->getNumSizes());
10405 for (Expr *
E :
C->getSizesRefs()) {
10407 TransformedSizes.push_back(
nullptr);
10416 TransformedSizes.push_back(
T.get());
10419 if (!Changed && !getDerived().AlwaysRebuild())
10421 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10422 C->getLParenLoc(),
C->getEndLoc());
10425template <
typename Derived>
10427TreeTransform<Derived>::TransformOMPPermutationClause(OMPPermutationClause *
C) {
10429 TransformedArgs.reserve(
C->getNumLoops());
10431 for (Expr *
E :
C->getArgsRefs()) {
10433 TransformedArgs.push_back(
nullptr);
10442 TransformedArgs.push_back(
T.get());
10445 if (!Changed && !getDerived().AlwaysRebuild())
10447 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10448 C->getLParenLoc(),
C->getEndLoc());
10451template <
typename Derived>
10452OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10453 if (!getDerived().AlwaysRebuild())
10455 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10458template <
typename Derived>
10460TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10461 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10464 Expr *Factor =
T.get();
10465 bool Changed = Factor !=
C->getFactor();
10467 if (!Changed && !getDerived().AlwaysRebuild())
10469 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10473template <
typename Derived>
10475TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10476 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10479 return getDerived().RebuildOMPCollapseClause(
10480 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10483template <
typename Derived>
10485TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10486 return getDerived().RebuildOMPDefaultClause(
10487 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10488 C->getLParenLoc(),
C->getEndLoc());
10491template <
typename Derived>
10493TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10494 return getDerived().RebuildOMPProcBindClause(
10495 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10496 C->getLParenLoc(),
C->getEndLoc());
10499template <
typename Derived>
10501TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10502 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10505 return getDerived().RebuildOMPScheduleClause(
10506 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10507 C->getScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10508 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10509 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10512template <
typename Derived>
10514TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10516 if (
auto *
Num =
C->getNumForLoops()) {
10517 E = getDerived().TransformExpr(
Num);
10521 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10522 C->getLParenLoc(),
E.get());
10525template <
typename Derived>
10527TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10529 if (Expr *Evt =
C->getEventHandler()) {
10530 E = getDerived().TransformExpr(Evt);
10534 return getDerived().RebuildOMPDetachClause(
E.get(),
C->getBeginLoc(),
10535 C->getLParenLoc(),
C->getEndLoc());
10538template <
typename Derived>
10540TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10545template <
typename Derived>
10547TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10552template <
typename Derived>
10554TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10559template <
typename Derived>
10560OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10565template <
typename Derived>
10566OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10571template <
typename Derived>
10573TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10578template <
typename Derived>
10580TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10585template <
typename Derived>
10587TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10592template <
typename Derived>
10593OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10598template <
typename Derived>
10600TreeTransform<Derived>::TransformOMPAbsentClause(OMPAbsentClause *
C) {
10604template <
typename Derived>
10605OMPClause *TreeTransform<Derived>::TransformOMPHoldsClause(OMPHoldsClause *
C) {
10606 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10609 return getDerived().RebuildOMPHoldsClause(
E.get(),
C->getBeginLoc(),
10610 C->getLParenLoc(),
C->getEndLoc());
10613template <
typename Derived>
10615TreeTransform<Derived>::TransformOMPContainsClause(OMPContainsClause *
C) {
10619template <
typename Derived>
10621TreeTransform<Derived>::TransformOMPNoOpenMPClause(OMPNoOpenMPClause *
C) {
10624template <
typename Derived>
10625OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPRoutinesClause(
10626 OMPNoOpenMPRoutinesClause *
C) {
10629template <
typename Derived>
10630OMPClause *TreeTransform<Derived>::TransformOMPNoParallelismClause(
10631 OMPNoParallelismClause *
C) {
10635template <
typename Derived>
10637TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10642template <
typename Derived>
10644TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10649template <
typename Derived>
10651TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10656template <
typename Derived>
10658TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10663template <
typename Derived>
10665TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10670template <
typename Derived>
10671OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10676template <
typename Derived>
10678TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10683template <
typename Derived>
10684OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10689template <
typename Derived>
10691TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10696template <
typename Derived>
10697OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10698 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10699 if (IVR.isInvalid())
10702 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10703 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10704 for (Expr *
E : llvm::drop_begin(
C->varlist())) {
10705 ExprResult ER = getDerived().TransformExpr(cast<Expr>(
E));
10706 if (ER.isInvalid())
10708 InteropInfo.PreferTypes.push_back(ER.get());
10710 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10711 C->getBeginLoc(),
C->getLParenLoc(),
10712 C->getVarLoc(),
C->getEndLoc());
10715template <
typename Derived>
10716OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10717 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10718 if (ER.isInvalid())
10720 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10721 C->getLParenLoc(),
C->getVarLoc(),
10725template <
typename Derived>
10727TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10729 if (Expr *IV =
C->getInteropVar()) {
10730 ER = getDerived().TransformExpr(IV);
10731 if (ER.isInvalid())
10734 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10735 C->getLParenLoc(),
C->getVarLoc(),
10739template <
typename Derived>
10741TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10742 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10743 if (Cond.isInvalid())
10745 return getDerived().RebuildOMPNovariantsClause(
10746 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10749template <
typename Derived>
10751TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10752 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10753 if (Cond.isInvalid())
10755 return getDerived().RebuildOMPNocontextClause(
10756 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10759template <
typename Derived>
10761TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10762 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10763 if (ThreadID.isInvalid())
10765 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10766 C->getLParenLoc(),
C->getEndLoc());
10769template <
typename Derived>
10770OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10771 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10774 return getDerived().RebuildOMPAlignClause(
E.get(),
C->getBeginLoc(),
10775 C->getLParenLoc(),
C->getEndLoc());
10778template <
typename Derived>
10779OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10780 OMPUnifiedAddressClause *
C) {
10781 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10784template <
typename Derived>
10785OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10786 OMPUnifiedSharedMemoryClause *
C) {
10788 "unified_shared_memory clause cannot appear in dependent context");
10791template <
typename Derived>
10792OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10793 OMPReverseOffloadClause *
C) {
10794 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10797template <
typename Derived>
10798OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10799 OMPDynamicAllocatorsClause *
C) {
10801 "dynamic_allocators clause cannot appear in dependent context");
10804template <
typename Derived>
10805OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10806 OMPAtomicDefaultMemOrderClause *
C) {
10808 "atomic_default_mem_order clause cannot appear in dependent context");
10811template <
typename Derived>
10812OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10813 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10814 C->getBeginLoc(),
C->getLParenLoc(),
10818template <
typename Derived>
10820TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10821 return getDerived().RebuildOMPSeverityClause(
10822 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10823 C->getLParenLoc(),
C->getEndLoc());
10826template <
typename Derived>
10828TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10829 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10832 return getDerived().RebuildOMPMessageClause(
10833 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10837template <
typename Derived>
10839TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10841 Vars.reserve(
C->varlist_size());
10842 for (
auto *VE :
C->varlist()) {
10843 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10844 if (EVar.isInvalid())
10846 Vars.push_back(EVar.get());
10848 return getDerived().RebuildOMPPrivateClause(
10849 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10852template <
typename Derived>
10853OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10854 OMPFirstprivateClause *
C) {
10856 Vars.reserve(
C->varlist_size());
10857 for (
auto *VE :
C->varlist()) {
10858 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10859 if (EVar.isInvalid())
10861 Vars.push_back(EVar.get());
10863 return getDerived().RebuildOMPFirstprivateClause(
10864 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10867template <
typename Derived>
10869TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10871 Vars.reserve(
C->varlist_size());
10872 for (
auto *VE :
C->varlist()) {
10873 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10874 if (EVar.isInvalid())
10876 Vars.push_back(EVar.get());
10878 return getDerived().RebuildOMPLastprivateClause(
10879 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10880 C->getLParenLoc(),
C->getEndLoc());
10883template <
typename Derived>
10885TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10887 Vars.reserve(
C->varlist_size());
10888 for (
auto *VE :
C->varlist()) {
10889 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10890 if (EVar.isInvalid())
10892 Vars.push_back(EVar.get());
10894 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10895 C->getLParenLoc(),
C->getEndLoc());
10898template <
typename Derived>
10900TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10902 Vars.reserve(
C->varlist_size());
10903 for (
auto *VE :
C->varlist()) {
10904 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10905 if (EVar.isInvalid())
10907 Vars.push_back(EVar.get());
10909 CXXScopeSpec ReductionIdScopeSpec;
10910 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10912 DeclarationNameInfo NameInfo =
C->getNameInfo();
10913 if (NameInfo.getName()) {
10914 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10915 if (!NameInfo.getName())
10921 for (
auto *
E :
C->reduction_ops()) {
10924 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10925 UnresolvedSet<8> Decls;
10926 for (
auto *
D : ULE->decls()) {
10928 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10929 Decls.addDecl(InstD, InstD->getAccess());
10933 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10934 true, Decls.begin(), Decls.end(),
10937 UnresolvedReductions.push_back(
nullptr);
10939 return getDerived().RebuildOMPReductionClause(
10940 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10941 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10942 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10945template <
typename Derived>
10946OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10947 OMPTaskReductionClause *
C) {
10949 Vars.reserve(
C->varlist_size());
10950 for (
auto *VE :
C->varlist()) {
10951 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10952 if (EVar.isInvalid())
10954 Vars.push_back(EVar.get());
10956 CXXScopeSpec ReductionIdScopeSpec;
10957 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10959 DeclarationNameInfo NameInfo =
C->getNameInfo();
10960 if (NameInfo.getName()) {
10961 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10962 if (!NameInfo.getName())
10968 for (
auto *
E :
C->reduction_ops()) {
10971 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10972 UnresolvedSet<8> Decls;
10973 for (
auto *
D : ULE->decls()) {
10975 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10976 Decls.addDecl(InstD, InstD->getAccess());
10980 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10981 true, Decls.begin(), Decls.end(),
10984 UnresolvedReductions.push_back(
nullptr);
10986 return getDerived().RebuildOMPTaskReductionClause(
10987 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10988 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10991template <
typename Derived>
10993TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10995 Vars.reserve(
C->varlist_size());
10996 for (
auto *VE :
C->varlist()) {
10997 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10998 if (EVar.isInvalid())
11000 Vars.push_back(EVar.get());
11002 CXXScopeSpec ReductionIdScopeSpec;
11003 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
11005 DeclarationNameInfo NameInfo =
C->getNameInfo();
11006 if (NameInfo.getName()) {
11007 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11008 if (!NameInfo.getName())
11014 for (
auto *
E :
C->reduction_ops()) {
11017 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11018 UnresolvedSet<8> Decls;
11019 for (
auto *
D : ULE->decls()) {
11021 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
11022 Decls.addDecl(InstD, InstD->getAccess());
11026 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11027 true, Decls.begin(), Decls.end(),
11030 UnresolvedReductions.push_back(
nullptr);
11032 return getDerived().RebuildOMPInReductionClause(
11033 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11034 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11037template <
typename Derived>
11039TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
11041 Vars.reserve(
C->varlist_size());
11042 for (
auto *VE :
C->varlist()) {
11043 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11044 if (EVar.isInvalid())
11046 Vars.push_back(EVar.get());
11048 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11049 if (Step.isInvalid())
11051 return getDerived().RebuildOMPLinearClause(
11052 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11053 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11057template <
typename Derived>
11059TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
11061 Vars.reserve(
C->varlist_size());
11062 for (
auto *VE :
C->varlist()) {
11063 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11064 if (EVar.isInvalid())
11066 Vars.push_back(EVar.get());
11068 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11069 if (Alignment.isInvalid())
11071 return getDerived().RebuildOMPAlignedClause(
11072 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11073 C->getColonLoc(),
C->getEndLoc());
11076template <
typename Derived>
11078TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
11080 Vars.reserve(
C->varlist_size());
11081 for (
auto *VE :
C->varlist()) {
11082 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11083 if (EVar.isInvalid())
11085 Vars.push_back(EVar.get());
11087 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11088 C->getLParenLoc(),
C->getEndLoc());
11091template <
typename Derived>
11093TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
11095 Vars.reserve(
C->varlist_size());
11096 for (
auto *VE :
C->varlist()) {
11097 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11098 if (EVar.isInvalid())
11100 Vars.push_back(EVar.get());
11102 return getDerived().RebuildOMPCopyprivateClause(
11103 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11106template <
typename Derived>
11107OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
11109 Vars.reserve(
C->varlist_size());
11110 for (
auto *VE :
C->varlist()) {
11111 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11112 if (EVar.isInvalid())
11114 Vars.push_back(EVar.get());
11116 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11117 C->getLParenLoc(),
C->getEndLoc());
11120template <
typename Derived>
11122TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
11123 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11126 return getDerived().RebuildOMPDepobjClause(
E.get(),
C->getBeginLoc(),
11127 C->getLParenLoc(),
C->getEndLoc());
11130template <
typename Derived>
11132TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
11134 Expr *DepModifier =
C->getModifier();
11136 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11137 if (DepModRes.isInvalid())
11139 DepModifier = DepModRes.
get();
11141 Vars.reserve(
C->varlist_size());
11142 for (
auto *VE :
C->varlist()) {
11143 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11144 if (EVar.isInvalid())
11146 Vars.push_back(EVar.get());
11148 return getDerived().RebuildOMPDependClause(
11149 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11150 C->getOmpAllMemoryLoc()},
11151 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11154template <
typename Derived>
11156TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
11157 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11160 return getDerived().RebuildOMPDeviceClause(
11161 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11162 C->getModifierLoc(),
C->getEndLoc());
11165template <
typename Derived,
class T>
11172 Vars.reserve(
C->varlist_size());
11173 for (
auto *VE :
C->varlist()) {
11177 Vars.push_back(EVar.
get());
11181 if (
C->getMapperQualifierLoc()) {
11182 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11183 C->getMapperQualifierLoc());
11187 MapperIdScopeSpec.
Adopt(QualifierLoc);
11188 MapperIdInfo =
C->getMapperIdInfo();
11189 if (MapperIdInfo.
getName()) {
11190 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11196 for (
auto *
E :
C->mapperlists()) {
11199 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11201 for (
auto *
D : ULE->decls()) {
11209 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
11212 UnresolvedMappers.push_back(
nullptr);
11218template <
typename Derived>
11219OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11220 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11222 Expr *IteratorModifier =
C->getIteratorModifier();
11223 if (IteratorModifier) {
11224 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11225 if (MapModRes.isInvalid())
11227 IteratorModifier = MapModRes.
get();
11229 CXXScopeSpec MapperIdScopeSpec;
11230 DeclarationNameInfo MapperIdInfo;
11232 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
11233 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11235 return getDerived().RebuildOMPMapClause(
11236 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11237 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11238 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11241template <
typename Derived>
11243TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
11244 Expr *Allocator =
C->getAllocator();
11246 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11247 if (AllocatorRes.isInvalid())
11249 Allocator = AllocatorRes.get();
11251 Expr *Alignment =
C->getAlignment();
11253 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11254 if (AlignmentRes.isInvalid())
11256 Alignment = AlignmentRes.
get();
11259 Vars.reserve(
C->varlist_size());
11260 for (
auto *VE :
C->varlist()) {
11261 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11262 if (EVar.isInvalid())
11264 Vars.push_back(EVar.get());
11266 return getDerived().RebuildOMPAllocateClause(
11267 Allocator, Alignment,
C->getFirstAllocateModifier(),
11268 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11269 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11270 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11273template <
typename Derived>
11275TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
11277 Vars.reserve(
C->varlist_size());
11278 for (
auto *VE :
C->varlist()) {
11279 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11280 if (EVar.isInvalid())
11282 Vars.push_back(EVar.get());
11284 return getDerived().RebuildOMPNumTeamsClause(
11285 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11288template <
typename Derived>
11290TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
11292 Vars.reserve(
C->varlist_size());
11293 for (
auto *VE :
C->varlist()) {
11294 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11295 if (EVar.isInvalid())
11297 Vars.push_back(EVar.get());
11299 return getDerived().RebuildOMPThreadLimitClause(
11300 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11303template <
typename Derived>
11305TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
11306 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11309 return getDerived().RebuildOMPPriorityClause(
11310 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11313template <
typename Derived>
11315TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
11316 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11319 return getDerived().RebuildOMPGrainsizeClause(
11320 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11321 C->getModifierLoc(),
C->getEndLoc());
11324template <
typename Derived>
11326TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
11327 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11330 return getDerived().RebuildOMPNumTasksClause(
11331 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11332 C->getModifierLoc(),
C->getEndLoc());
11335template <
typename Derived>
11336OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
11337 ExprResult E = getDerived().TransformExpr(
C->getHint());
11340 return getDerived().RebuildOMPHintClause(
E.get(),
C->getBeginLoc(),
11341 C->getLParenLoc(),
C->getEndLoc());
11344template <
typename Derived>
11345OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
11346 OMPDistScheduleClause *
C) {
11347 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11350 return getDerived().RebuildOMPDistScheduleClause(
11351 C->getDistScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11352 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11355template <
typename Derived>
11357TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
11360 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
11361 C->getDefaultmapKind(),
11364 C->getDefaultmapModifierLoc(),
11365 C->getDefaultmapKindLoc(),
11369template <
typename Derived>
11370OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
11371 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11373 CXXScopeSpec MapperIdScopeSpec;
11374 DeclarationNameInfo MapperIdInfo;
11376 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
11377 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11379 return getDerived().RebuildOMPToClause(
11380 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11381 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11384template <
typename Derived>
11385OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
11386 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11388 CXXScopeSpec MapperIdScopeSpec;
11389 DeclarationNameInfo MapperIdInfo;
11391 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
11392 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11394 return getDerived().RebuildOMPFromClause(
11395 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11396 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11399template <
typename Derived>
11400OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
11401 OMPUseDevicePtrClause *
C) {
11403 Vars.reserve(
C->varlist_size());
11404 for (
auto *VE :
C->varlist()) {
11405 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11406 if (EVar.isInvalid())
11408 Vars.push_back(EVar.get());
11410 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11411 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11414template <
typename Derived>
11415OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
11416 OMPUseDeviceAddrClause *
C) {
11418 Vars.reserve(
C->varlist_size());
11419 for (
auto *VE :
C->varlist()) {
11420 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11421 if (EVar.isInvalid())
11423 Vars.push_back(EVar.get());
11425 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11426 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11429template <
typename Derived>
11431TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
11433 Vars.reserve(
C->varlist_size());
11434 for (
auto *VE :
C->varlist()) {
11435 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11436 if (EVar.isInvalid())
11438 Vars.push_back(EVar.get());
11440 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11441 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11444template <
typename Derived>
11445OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
11446 OMPHasDeviceAddrClause *
C) {
11448 Vars.reserve(
C->varlist_size());
11449 for (
auto *VE :
C->varlist()) {
11450 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11451 if (EVar.isInvalid())
11453 Vars.push_back(EVar.get());
11455 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11456 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11459template <
typename Derived>
11461TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
11463 Vars.reserve(
C->varlist_size());
11464 for (
auto *VE :
C->varlist()) {
11465 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11466 if (EVar.isInvalid())
11468 Vars.push_back(EVar.get());
11470 return getDerived().RebuildOMPNontemporalClause(
11471 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11474template <
typename Derived>
11476TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
11478 Vars.reserve(
C->varlist_size());
11479 for (
auto *VE :
C->varlist()) {
11480 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11481 if (EVar.isInvalid())
11483 Vars.push_back(EVar.get());
11485 return getDerived().RebuildOMPInclusiveClause(
11486 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11489template <
typename Derived>
11491TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
11493 Vars.reserve(
C->varlist_size());
11494 for (
auto *VE :
C->varlist()) {
11495 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11496 if (EVar.isInvalid())
11498 Vars.push_back(EVar.get());
11500 return getDerived().RebuildOMPExclusiveClause(
11501 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11504template <
typename Derived>
11505OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11506 OMPUsesAllocatorsClause *
C) {
11508 Data.reserve(
C->getNumberOfAllocators());
11509 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
11510 OMPUsesAllocatorsClause::Data
D =
C->getAllocatorData(I);
11511 ExprResult Allocator = getDerived().TransformExpr(
D.Allocator);
11512 if (Allocator.isInvalid())
11515 if (Expr *AT =
D.AllocatorTraits) {
11516 AllocatorTraits = getDerived().TransformExpr(AT);
11517 if (AllocatorTraits.isInvalid())
11520 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11521 NewD.Allocator = Allocator.get();
11522 NewD.AllocatorTraits = AllocatorTraits.get();
11523 NewD.LParenLoc =
D.LParenLoc;
11524 NewD.RParenLoc =
D.RParenLoc;
11526 return getDerived().RebuildOMPUsesAllocatorsClause(
11527 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11530template <
typename Derived>
11532TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11534 Locators.reserve(
C->varlist_size());
11536 if (Expr *Modifier =
C->getModifier()) {
11537 ModifierRes = getDerived().TransformExpr(Modifier);
11538 if (ModifierRes.isInvalid())
11541 for (Expr *
E :
C->varlist()) {
11542 ExprResult Locator = getDerived().TransformExpr(
E);
11543 if (Locator.isInvalid())
11545 Locators.push_back(Locator.get());
11547 return getDerived().RebuildOMPAffinityClause(
11548 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11549 ModifierRes.get(), Locators);
11552template <
typename Derived>
11553OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11554 return getDerived().RebuildOMPOrderClause(
11555 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11556 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11559template <
typename Derived>
11560OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11561 return getDerived().RebuildOMPBindClause(
11562 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11563 C->getLParenLoc(),
C->getEndLoc());
11566template <
typename Derived>
11567OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11568 OMPXDynCGroupMemClause *
C) {
11570 if (
Size.isInvalid())
11572 return getDerived().RebuildOMPXDynCGroupMemClause(
11573 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11576template <
typename Derived>
11578TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11580 Vars.reserve(
C->varlist_size());
11581 for (
auto *VE :
C->varlist()) {
11582 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11583 if (EVar.isInvalid())
11585 Vars.push_back(EVar.get());
11587 return getDerived().RebuildOMPDoacrossClause(
11588 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11589 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11592template <
typename Derived>
11594TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11596 for (
auto *A :
C->getAttrs())
11597 NewAttrs.push_back(getDerived().TransformAttr(A));
11598 return getDerived().RebuildOMPXAttributeClause(
11599 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11602template <
typename Derived>
11603OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11604 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11611template <
typename Derived>
11612class OpenACCClauseTransform final
11613 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11614 TreeTransform<Derived> &Self;
11616 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11617 OpenACCClause *NewClause =
nullptr;
11621 for (Expr *CurVar : VarList) {
11622 ExprResult Res = Self.TransformExpr(CurVar);
11624 if (!Res.isUsable())
11627 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getClauseKind(),
11630 if (Res.isUsable())
11631 InstantiatedVarList.push_back(Res.get());
11634 return InstantiatedVarList;
11638 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11640 SemaOpenACC::OpenACCParsedClause &PC)
11641 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11643 OpenACCClause *CreatedClause()
const {
return NewClause; }
11645#define VISIT_CLAUSE(CLAUSE_NAME) \
11646 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11647#include "clang/Basic/OpenACCClauses.def"
11650template <
typename Derived>
11651void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11652 const OpenACCDefaultClause &
C) {
11661template <
typename Derived>
11662void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11663 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11664 assert(Cond &&
"If constructed with invalid Condition");
11665 Sema::ConditionResult Res =
Self.TransformCondition(
11668 if (Res.isInvalid() || !Res.get().second)
11679template <
typename Derived>
11680void OpenACCClauseTransform<Derived>::VisitSelfClause(
11681 const OpenACCSelfClause &
C) {
11686 for (Expr *CurVar :
C.getVarList()) {
11689 if (!Res.isUsable())
11695 if (Res.isUsable())
11696 InstantiatedVarList.push_back(Res.get());
11708 if (
C.hasConditionExpr()) {
11709 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11710 Sema::ConditionResult Res =
11711 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11714 if (Res.isInvalid() || !Res.get().second)
11727template <
typename Derived>
11728void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11729 const OpenACCNumGangsClause &
C) {
11732 for (Expr *CurIntExpr :
C.getIntExprs()) {
11735 if (!Res.isUsable())
11740 C.getBeginLoc(), Res.get());
11741 if (!Res.isUsable())
11744 InstantiatedIntExprs.push_back(Res.get());
11754template <
typename Derived>
11755void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11756 const OpenACCPrivateClause &
C) {
11766template <
typename Derived>
11767void OpenACCClauseTransform<Derived>::VisitHostClause(
11768 const OpenACCHostClause &
C) {
11778template <
typename Derived>
11779void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11780 const OpenACCDeviceClause &
C) {
11790template <
typename Derived>
11791void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11792 const OpenACCFirstPrivateClause &
C) {
11802template <
typename Derived>
11803void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11804 const OpenACCNoCreateClause &
C) {
11814template <
typename Derived>
11815void OpenACCClauseTransform<Derived>::VisitPresentClause(
11816 const OpenACCPresentClause &
C) {
11826template <
typename Derived>
11827void OpenACCClauseTransform<Derived>::VisitCopyClause(
11828 const OpenACCCopyClause &
C) {
11838template <
typename Derived>
11839void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11840 const OpenACCCopyInClause &
C) {
11851template <
typename Derived>
11852void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11853 const OpenACCCopyOutClause &
C) {
11855 false,
C.isZero());
11864template <
typename Derived>
11865void OpenACCClauseTransform<Derived>::VisitCreateClause(
11866 const OpenACCCreateClause &
C) {
11868 false,
C.isZero());
11876template <
typename Derived>
11877void OpenACCClauseTransform<Derived>::VisitAttachClause(
11878 const OpenACCAttachClause &
C) {
11882 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11883 return Self.getSema().OpenACC().CheckVarIsPointerType(
11884 OpenACCClauseKind::Attach, E);
11885 }), VarList.end());
11895template <
typename Derived>
11896void OpenACCClauseTransform<Derived>::VisitDetachClause(
11897 const OpenACCDetachClause &
C) {
11902 std::remove_if(VarList.begin(), VarList.end(),
11904 return Self.getSema().OpenACC().CheckVarIsPointerType(
11905 OpenACCClauseKind::Detach, E);
11917template <
typename Derived>
11918void OpenACCClauseTransform<Derived>::VisitDeleteClause(
11919 const OpenACCDeleteClause &
C) {
11928template <
typename Derived>
11929void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
11930 const OpenACCUseDeviceClause &
C) {
11939template <
typename Derived>
11940void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
11941 const OpenACCDevicePtrClause &
C) {
11945 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11946 return Self.getSema().OpenACC().CheckVarIsPointerType(
11947 OpenACCClauseKind::DevicePtr, E);
11948 }), VarList.end());
11958template <
typename Derived>
11959void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
11960 const OpenACCNumWorkersClause &
C) {
11961 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11962 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
11965 if (!Res.isUsable())
11970 C.getBeginLoc(), Res.get());
11971 if (!Res.isUsable())
11981template <
typename Derived>
11982void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
11983 const OpenACCDeviceNumClause &
C) {
11984 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11985 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
11988 if (!Res.isUsable())
11993 C.getBeginLoc(), Res.get());
11994 if (!Res.isUsable())
12004template <
typename Derived>
12005void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12006 const OpenACCDefaultAsyncClause &
C) {
12007 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12008 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12011 if (!Res.isUsable())
12016 C.getBeginLoc(), Res.get());
12017 if (!Res.isUsable())
12027template <
typename Derived>
12028void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12029 const OpenACCVectorLengthClause &
C) {
12030 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12031 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12034 if (!Res.isUsable())
12039 C.getBeginLoc(), Res.get());
12040 if (!Res.isUsable())
12050template <
typename Derived>
12051void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12052 const OpenACCAsyncClause &
C) {
12053 if (
C.hasIntExpr()) {
12054 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12055 if (!Res.isUsable())
12060 C.getBeginLoc(), Res.get());
12061 if (!Res.isUsable())
12074template <
typename Derived>
12075void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12076 const OpenACCWorkerClause &
C) {
12077 if (
C.hasIntExpr()) {
12081 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12082 if (!Res.isUsable())
12087 C.getBeginLoc(), Res.get());
12088 if (!Res.isUsable())
12101template <
typename Derived>
12102void OpenACCClauseTransform<Derived>::VisitVectorClause(
12103 const OpenACCVectorClause &
C) {
12104 if (
C.hasIntExpr()) {
12108 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
12109 if (!Res.isUsable())
12114 C.getBeginLoc(), Res.get());
12115 if (!Res.isUsable())
12128template <
typename Derived>
12129void OpenACCClauseTransform<Derived>::VisitWaitClause(
12130 const OpenACCWaitClause &
C) {
12131 if (!
C.getLParenLoc().isInvalid()) {
12132 Expr *DevNumExpr =
nullptr;
12136 if (
C.getDevNumExpr()) {
12138 if (!Res.isUsable())
12142 C.getBeginLoc(), Res.get());
12143 if (!Res.isUsable())
12146 DevNumExpr = Res.get();
12150 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12152 if (!Res.isUsable())
12156 C.getBeginLoc(), Res.get());
12157 if (!Res.isUsable())
12160 InstantiatedQueueIdExprs.push_back(Res.get());
12164 std::move(InstantiatedQueueIdExprs));
12174template <
typename Derived>
12175void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12176 const OpenACCDeviceTypeClause &
C) {
12179 Self.getSema().getASTContext(),
C.getClauseKind(),
12181 C.getArchitectures(), ParsedClause.
getEndLoc());
12184template <
typename Derived>
12185void OpenACCClauseTransform<Derived>::VisitAutoClause(
12186 const OpenACCAutoClause &
C) {
12193template <
typename Derived>
12194void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12195 const OpenACCIndependentClause &
C) {
12201template <
typename Derived>
12202void OpenACCClauseTransform<Derived>::VisitSeqClause(
12203 const OpenACCSeqClause &
C) {
12208template <
typename Derived>
12209void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12210 const OpenACCFinalizeClause &
C) {
12216template <
typename Derived>
12217void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12218 const OpenACCIfPresentClause &
C) {
12224template <
typename Derived>
12225void OpenACCClauseTransform<Derived>::VisitReductionClause(
12226 const OpenACCReductionClause &
C) {
12230 for (Expr *Var : TransformedVars) {
12233 if (Res.isUsable())
12234 ValidVars.push_back(Res.get());
12237 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12240 C.getReductionOp(), ValidVars, ParsedClause.
getEndLoc());
12243template <
typename Derived>
12244void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12245 const OpenACCCollapseClause &
C) {
12246 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12247 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12251 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12253 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12256 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12258 if (!NewLoopCount.isUsable())
12268template <
typename Derived>
12269void OpenACCClauseTransform<Derived>::VisitTileClause(
12270 const OpenACCTileClause &
C) {
12274 for (Expr *
E :
C.getSizeExprs()) {
12277 if (!NewSizeExpr.isUsable())
12280 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12282 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12284 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12286 if (!NewSizeExpr.isUsable())
12288 TransformedExprs.push_back(NewSizeExpr.get());
12297template <
typename Derived>
12298void OpenACCClauseTransform<Derived>::VisitGangClause(
12299 const OpenACCGangClause &
C) {
12303 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12304 ExprResult ER =
Self.TransformExpr(
const_cast<Expr *
>(
C.getExpr(I).second));
12305 if (!ER.isUsable())
12308 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12310 C.getExpr(I).first, ER.get());
12311 if (!ER.isUsable())
12313 TransformedGangKinds.push_back(
C.getExpr(I).first);
12314 TransformedIntExprs.push_back(ER.get());
12317 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12320 TransformedGangKinds, TransformedIntExprs, ParsedClause.
getEndLoc());
12323template <
typename Derived>
12324OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12328 SemaOpenACC::OpenACCParsedClause ParsedClause(
12329 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12330 ParsedClause.
setEndLoc(OldClause->getEndLoc());
12332 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12335 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12337 Transform.Visit(OldClause);
12339 return Transform.CreatedClause();
12342template <
typename Derived>
12344TreeTransform<Derived>::TransformOpenACCClauseList(
12347 for (
const auto *Clause : OldClauses) {
12348 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12349 TransformedClauses, DirKind, Clause))
12350 TransformedClauses.push_back(TransformedClause);
12352 return TransformedClauses;
12355template <
typename Derived>
12356StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
12357 OpenACCComputeConstruct *
C) {
12358 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12361 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12364 if (getSema().OpenACC().ActOnStartStmtDirective(
12365 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12369 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12370 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12371 C->clauses(), TransformedClauses);
12372 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12373 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12374 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12376 return getDerived().RebuildOpenACCComputeConstruct(
12377 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12378 C->getEndLoc(), TransformedClauses, StrBlock);
12381template <
typename Derived>
12383TreeTransform<Derived>::TransformOpenACCLoopConstruct(OpenACCLoopConstruct *
C) {
12385 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12388 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12391 if (getSema().OpenACC().ActOnStartStmtDirective(
12392 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12396 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12397 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12398 C->clauses(), TransformedClauses);
12400 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12401 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12403 return getDerived().RebuildOpenACCLoopConstruct(
12404 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12405 TransformedClauses,
Loop);
12408template <
typename Derived>
12409StmtResult TreeTransform<Derived>::TransformOpenACCCombinedConstruct(
12410 OpenACCCombinedConstruct *
C) {
12411 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12414 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12417 if (getSema().OpenACC().ActOnStartStmtDirective(
12418 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12422 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12423 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12424 C->clauses(), TransformedClauses);
12426 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12427 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12429 return getDerived().RebuildOpenACCCombinedConstruct(
12430 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12431 C->getEndLoc(), TransformedClauses,
Loop);
12434template <
typename Derived>
12436TreeTransform<Derived>::TransformOpenACCDataConstruct(OpenACCDataConstruct *
C) {
12437 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12440 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12442 if (getSema().OpenACC().ActOnStartStmtDirective(
12443 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12446 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12447 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12448 C->clauses(), TransformedClauses);
12449 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12450 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12451 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12453 return getDerived().RebuildOpenACCDataConstruct(
12454 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12455 TransformedClauses, StrBlock);
12458template <
typename Derived>
12459StmtResult TreeTransform<Derived>::TransformOpenACCEnterDataConstruct(
12460 OpenACCEnterDataConstruct *
C) {
12461 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12464 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12466 if (getSema().OpenACC().ActOnStartStmtDirective(
12467 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12470 return getDerived().RebuildOpenACCEnterDataConstruct(
12471 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12472 TransformedClauses);
12475template <
typename Derived>
12476StmtResult TreeTransform<Derived>::TransformOpenACCExitDataConstruct(
12477 OpenACCExitDataConstruct *
C) {
12478 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12481 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12483 if (getSema().OpenACC().ActOnStartStmtDirective(
12484 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12487 return getDerived().RebuildOpenACCExitDataConstruct(
12488 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12489 TransformedClauses);
12492template <
typename Derived>
12493StmtResult TreeTransform<Derived>::TransformOpenACCHostDataConstruct(
12494 OpenACCHostDataConstruct *
C) {
12495 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12498 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12500 if (getSema().OpenACC().ActOnStartStmtDirective(
12501 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12504 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12505 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12506 C->clauses(), TransformedClauses);
12507 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12508 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12509 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12511 return getDerived().RebuildOpenACCHostDataConstruct(
12512 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12513 TransformedClauses, StrBlock);
12516template <
typename Derived>
12518TreeTransform<Derived>::TransformOpenACCInitConstruct(OpenACCInitConstruct *
C) {
12519 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12522 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12524 if (getSema().OpenACC().ActOnStartStmtDirective(
12525 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12528 return getDerived().RebuildOpenACCInitConstruct(
12529 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12530 TransformedClauses);
12533template <
typename Derived>
12534StmtResult TreeTransform<Derived>::TransformOpenACCShutdownConstruct(
12535 OpenACCShutdownConstruct *
C) {
12536 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12539 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12541 if (getSema().OpenACC().ActOnStartStmtDirective(
12542 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12545 return getDerived().RebuildOpenACCShutdownConstruct(
12546 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12547 TransformedClauses);
12549template <
typename Derived>
12551TreeTransform<Derived>::TransformOpenACCSetConstruct(OpenACCSetConstruct *
C) {
12552 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12555 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12557 if (getSema().OpenACC().ActOnStartStmtDirective(
12558 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12561 return getDerived().RebuildOpenACCSetConstruct(
12562 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12563 TransformedClauses);
12566template <
typename Derived>
12567StmtResult TreeTransform<Derived>::TransformOpenACCUpdateConstruct(
12568 OpenACCUpdateConstruct *
C) {
12569 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12572 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12574 if (getSema().OpenACC().ActOnStartStmtDirective(
12575 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12578 return getDerived().RebuildOpenACCUpdateConstruct(
12579 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12580 TransformedClauses);
12583template <
typename Derived>
12585TreeTransform<Derived>::TransformOpenACCWaitConstruct(OpenACCWaitConstruct *
C) {
12586 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12589 if (
C->hasDevNumExpr()) {
12590 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12592 if (DevNumExpr.isUsable())
12593 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12595 C->getBeginLoc(), DevNumExpr.get());
12600 for (Expr *QE :
C->getQueueIdExprs()) {
12601 assert(QE &&
"Null queue id expr?");
12602 ExprResult NewEQ = getDerived().TransformExpr(QE);
12604 if (!NewEQ.isUsable())
12608 C->getBeginLoc(), NewEQ.get());
12609 if (NewEQ.isUsable())
12610 QueueIdExprs.push_back(NewEQ.get());
12614 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12617 if (getSema().OpenACC().ActOnStartStmtDirective(
12618 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12621 return getDerived().RebuildOpenACCWaitConstruct(
12622 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12623 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12624 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12627template <
typename Derived>
12628StmtResult TreeTransform<Derived>::TransformOpenACCAtomicConstruct(
12629 OpenACCAtomicConstruct *
C) {
12630 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12632 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12633 C->getBeginLoc(), {}))
12637 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12638 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12640 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12641 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12642 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12645 return getDerived().RebuildOpenACCAtomicConstruct(
12646 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12647 C->getEndLoc(), AssocStmt);
12650template <
typename Derived>
12651ExprResult TreeTransform<Derived>::TransformOpenACCAsteriskSizeExpr(
12652 OpenACCAsteriskSizeExpr *
E) {
12653 if (getDerived().AlwaysRebuild())
12654 return getDerived().RebuildOpenACCAsteriskSizeExpr(
E->getLocation());
12662template<
typename Derived>
12664TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *
E) {
12665 return TransformExpr(
E->getSubExpr());
12668template <
typename Derived>
12669ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
12670 SYCLUniqueStableNameExpr *
E) {
12674 TypeSourceInfo *NewT = getDerived().TransformType(
E->getTypeSourceInfo());
12679 if (!getDerived().AlwaysRebuild() &&
E->getTypeSourceInfo() == NewT)
12682 return getDerived().RebuildSYCLUniqueStableNameExpr(
12683 E->getLocation(),
E->getLParenLocation(),
E->getRParenLocation(), NewT);
12686template<
typename Derived>
12688TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *
E) {
12692 return getDerived().RebuildPredefinedExpr(
E->getLocation(),
12693 E->getIdentKind());
12696template<
typename Derived>
12698TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *
E) {
12699 NestedNameSpecifierLoc QualifierLoc;
12700 if (
E->getQualifierLoc()) {
12702 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
12708 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getLocation(),
12713 NamedDecl *
Found = ND;
12714 if (
E->getFoundDecl() !=
E->getDecl()) {
12715 Found = cast_or_null<NamedDecl>(
12716 getDerived().TransformDecl(
E->getLocation(),
E->getFoundDecl()));
12721 DeclarationNameInfo NameInfo =
E->getNameInfo();
12722 if (NameInfo.getName()) {
12723 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12724 if (!NameInfo.getName())
12728 if (!getDerived().AlwaysRebuild() &&
12729 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12730 QualifierLoc ==
E->getQualifierLoc() && ND ==
E->getDecl() &&
12731 Found ==
E->getFoundDecl() &&
12732 NameInfo.getName() ==
E->getDecl()->getDeclName() &&
12733 !
E->hasExplicitTemplateArgs()) {
12742 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
12743 if (
E->hasExplicitTemplateArgs()) {
12744 TemplateArgs = &TransArgs;
12745 TransArgs.setLAngleLoc(
E->getLAngleLoc());
12746 TransArgs.setRAngleLoc(
E->getRAngleLoc());
12747 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
12748 E->getNumTemplateArgs(),
12753 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
12754 Found, TemplateArgs);
12757template<
typename Derived>
12759TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *
E) {
12763template <
typename Derived>
12764ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
12765 FixedPointLiteral *
E) {
12769template<
typename Derived>
12771TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *
E) {
12775template<
typename Derived>
12777TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *
E) {
12781template<
typename Derived>
12783TreeTransform<Derived>::TransformStringLiteral(StringLiteral *
E) {
12787template<
typename Derived>
12789TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *
E) {
12793template<
typename Derived>
12795TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *
E) {
12796 return getDerived().TransformCallExpr(
E);
12799template<
typename Derived>
12801TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *
E) {
12803 TypeSourceInfo *ControllingType =
nullptr;
12804 if (
E->isExprPredicate())
12805 ControllingExpr = getDerived().TransformExpr(
E->getControllingExpr());
12807 ControllingType = getDerived().TransformType(
E->getControllingType());
12809 if (ControllingExpr.isInvalid() && !ControllingType)
12815 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
12817 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
12820 AssocTypes.push_back(AssocType);
12822 AssocTypes.push_back(
nullptr);
12826 getDerived().TransformExpr(Assoc.getAssociationExpr());
12827 if (AssocExpr.isInvalid())
12829 AssocExprs.push_back(AssocExpr.get());
12832 if (!ControllingType)
12833 return getDerived().RebuildGenericSelectionExpr(
E->getGenericLoc(),
12834 E->getDefaultLoc(),
12836 ControllingExpr.get(),
12839 return getDerived().RebuildGenericSelectionExpr(
12840 E->getGenericLoc(),
E->getDefaultLoc(),
E->getRParenLoc(),
12841 ControllingType, AssocTypes, AssocExprs);
12844template<
typename Derived>
12846TreeTransform<Derived>::TransformParenExpr(ParenExpr *
E) {
12847 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
12848 if (SubExpr.isInvalid())
12851 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getSubExpr())
12854 return getDerived().RebuildParenExpr(SubExpr.get(),
E->getLParen(),
12861template<
typename Derived>
12865 return getDerived().TransformDependentScopeDeclRefExpr(
12866 DRE,
true,
nullptr);
12868 return getDerived().TransformUnresolvedLookupExpr(
12871 return getDerived().TransformExpr(
E);
12874template<
typename Derived>
12878 if (
E->getOpcode() == UO_AddrOf)
12879 SubExpr = TransformAddressOfOperand(
E->getSubExpr());
12881 SubExpr = TransformExpr(
E->getSubExpr());
12885 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getSubExpr())
12888 return getDerived().RebuildUnaryOperator(
E->getOperatorLoc(),
12893template<
typename Derived>
12895TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *
E) {
12897 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
12907 bool ExprChanged =
false;
12908 typedef Sema::OffsetOfComponent Component;
12910 for (
unsigned I = 0, N =
E->getNumComponents(); I != N; ++I) {
12911 const OffsetOfNode &ON =
E->getComponent(I);
12913 Comp.isBrackets =
true;
12914 Comp.LocStart = ON.getSourceRange().getBegin();
12915 Comp.LocEnd = ON.getSourceRange().getEnd();
12916 switch (ON.getKind()) {
12918 Expr *FromIndex =
E->getIndexExpr(ON.getArrayExprIndex());
12919 ExprResult Index = getDerived().TransformExpr(FromIndex);
12920 if (Index.isInvalid())
12923 ExprChanged = ExprChanged || Index.get() != FromIndex;
12924 Comp.isBrackets =
true;
12925 Comp.U.E = Index.get();
12931 Comp.isBrackets =
false;
12932 Comp.U.IdentInfo = ON.getFieldName();
12933 if (!
Comp.U.IdentInfo)
12943 Components.push_back(Comp);
12947 if (!getDerived().AlwaysRebuild() &&
12948 Type ==
E->getTypeSourceInfo() &&
12953 return getDerived().RebuildOffsetOfExpr(
E->getOperatorLoc(), Type,
12954 Components,
E->getRParenLoc());
12957template<
typename Derived>
12959TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *
E) {
12960 assert((!
E->getSourceExpr() || getDerived().AlreadyTransformed(
E->
getType())) &&
12961 "opaque value expression requires transformation");
12965template<
typename Derived>
12967TreeTransform<Derived>::TransformTypoExpr(TypoExpr *
E) {
12971template <
typename Derived>
12972ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *
E) {
12975 for (Expr *
C :
E->subExpressions()) {
12977 if (NewC.isInvalid())
12979 Children.push_back(NewC.get());
12983 if (!getDerived().AlwaysRebuild() && !Changed)
12989template<
typename Derived>
12991TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *
E) {
12999 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13000 if (result.isInvalid())
return ExprError();
13005 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13011template<
typename Derived>
13013TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
13014 UnaryExprOrTypeTraitExpr *
E) {
13015 if (
E->isArgumentType()) {
13016 TypeSourceInfo *OldT =
E->getArgumentTypeInfo();
13018 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
13022 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13025 return getDerived().RebuildUnaryExprOrTypeTrait(NewT,
E->getOperatorLoc(),
13039 TypeSourceInfo *RecoveryTSI =
nullptr;
13041 auto *PE = dyn_cast<ParenExpr>(
E->getArgumentExpr());
13043 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13044 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13045 PE, DRE,
false, &RecoveryTSI);
13047 SubExpr = getDerived().TransformExpr(
E->getArgumentExpr());
13050 return getDerived().RebuildUnaryExprOrTypeTrait(
13052 }
else if (SubExpr.isInvalid())
13055 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getArgumentExpr())
13058 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13059 E->getOperatorLoc(),
13064template<
typename Derived>
13066TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *
E) {
13067 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13068 if (LHS.isInvalid())
13071 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13072 if (RHS.isInvalid())
13076 if (!getDerived().AlwaysRebuild() &&
13077 LHS.get() ==
E->getLHS() &&
13078 RHS.get() ==
E->getRHS())
13081 return getDerived().RebuildArraySubscriptExpr(
13083 E->getLHS()->
getBeginLoc(), RHS.get(),
E->getRBracketLoc());
13086template <
typename Derived>
13088TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *
E) {
13090 if (
Base.isInvalid())
13093 ExprResult RowIdx = getDerived().TransformExpr(
E->getRowIdx());
13094 if (RowIdx.isInvalid())
13097 ExprResult ColumnIdx = getDerived().TransformExpr(
E->getColumnIdx());
13098 if (ColumnIdx.isInvalid())
13101 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
13102 RowIdx.get() ==
E->getRowIdx() && ColumnIdx.get() ==
E->getColumnIdx())
13105 return getDerived().RebuildMatrixSubscriptExpr(
13106 Base.get(), RowIdx.get(), ColumnIdx.get(),
E->getRBracketLoc());
13109template <
typename Derived>
13111TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *
E) {
13113 if (
Base.isInvalid())
13117 if (
E->getLowerBound()) {
13118 LowerBound = getDerived().TransformExpr(
E->getLowerBound());
13119 if (LowerBound.isInvalid())
13124 if (
E->getLength()) {
13125 Length = getDerived().TransformExpr(
E->getLength());
13126 if (Length.isInvalid())
13131 if (
E->isOMPArraySection()) {
13132 if (Expr *Str =
E->getStride()) {
13133 Stride = getDerived().TransformExpr(Str);
13134 if (Stride.isInvalid())
13139 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
13140 LowerBound.get() ==
E->getLowerBound() &&
13141 Length.get() ==
E->getLength() &&
13142 (
E->isOpenACCArraySection() || Stride.get() ==
E->getStride()))
13145 return getDerived().RebuildArraySectionExpr(
13147 LowerBound.get(),
E->getColonLocFirst(),
13148 E->isOMPArraySection() ?
E->getColonLocSecond() : SourceLocation{},
13149 Length.get(), Stride.get(),
E->getRBracketLoc());
13152template <
typename Derived>
13154TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *
E) {
13156 if (
Base.isInvalid())
13160 bool ErrorFound =
false;
13161 for (Expr *
Dim :
E->getDimensions()) {
13163 if (DimRes.isInvalid()) {
13167 Dims.push_back(DimRes.get());
13172 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(),
E->getLParenLoc(),
13173 E->getRParenLoc(), Dims,
13174 E->getBracketsRanges());
13177template <
typename Derived>
13179TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *
E) {
13180 unsigned NumIterators =
E->numOfIterators();
13183 bool ErrorFound =
false;
13184 bool NeedToRebuild = getDerived().AlwaysRebuild();
13185 for (
unsigned I = 0; I < NumIterators; ++I) {
13186 auto *
D = cast<VarDecl>(
E->getIteratorDecl(I));
13187 Data[I].DeclIdent =
D->getIdentifier();
13191 "Implicit type must be int.");
13193 TypeSourceInfo *TSI = getDerived().TransformType(
D->getTypeSourceInfo());
13194 QualType
DeclTy = getDerived().TransformType(
D->getType());
13197 OMPIteratorExpr::IteratorRange
Range =
E->getIteratorRange(I);
13201 ErrorFound = ErrorFound ||
13202 !(!
D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
13203 !
Data[I].Type.get().isNull())) ||
13208 Data[I].Range.End = End.get();
13209 Data[I].Range.Step = Step.get();
13210 Data[I].AssignLoc =
E->getAssignLoc(I);
13211 Data[I].ColonLoc =
E->getColonLoc(I);
13212 Data[I].SecColonLoc =
E->getSecondColonLoc(I);
13215 (
D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
13216 D->getType().getTypePtrOrNull()) ||
13222 if (!NeedToRebuild)
13225 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13226 E->getIteratorKwLoc(),
E->getLParenLoc(),
E->getRParenLoc(),
Data);
13227 if (!Res.isUsable())
13229 auto *IE = cast<OMPIteratorExpr>(Res.get());
13230 for (
unsigned I = 0; I < NumIterators; ++I)
13231 getDerived().transformedLocalDecl(
E->getIteratorDecl(I),
13232 IE->getIteratorDecl(I));
13236template<
typename Derived>
13238TreeTransform<Derived>::TransformCallExpr(CallExpr *
E) {
13245 bool ArgChanged =
false;
13247 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13251 if (!getDerived().AlwaysRebuild() &&
13252 Callee.get() ==
E->getCallee() &&
13257 SourceLocation FakeLParenLoc
13260 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13261 if (
E->hasStoredFPFeatures()) {
13262 FPOptionsOverride NewOverrides =
E->getFPFeatures();
13263 getSema().CurFPFeatures =
13264 NewOverrides.applyOverrides(getSema().getLangOpts());
13265 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13268 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13270 E->getRParenLoc());
13273template<
typename Derived>
13275TreeTransform<Derived>::TransformMemberExpr(MemberExpr *
E) {
13277 if (
Base.isInvalid())
13280 NestedNameSpecifierLoc QualifierLoc;
13281 if (
E->hasQualifier()) {
13283 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
13288 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
13291 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getMemberLoc(),
13292 E->getMemberDecl()));
13296 NamedDecl *FoundDecl =
E->getFoundDecl();
13297 if (FoundDecl ==
E->getMemberDecl()) {
13300 FoundDecl = cast_or_null<NamedDecl>(
13301 getDerived().TransformDecl(
E->getMemberLoc(), FoundDecl));
13306 if (!getDerived().AlwaysRebuild() &&
13307 Base.get() ==
E->getBase() &&
13308 QualifierLoc ==
E->getQualifierLoc() &&
13309 Member ==
E->getMemberDecl() &&
13310 FoundDecl ==
E->getFoundDecl() &&
13311 !
E->hasExplicitTemplateArgs()) {
13315 if (!(isa<CXXThisExpr>(
E->getBase()) &&
13316 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13317 cast<ValueDecl>(
Member)))) {
13325 TemplateArgumentListInfo TransArgs;
13326 if (
E->hasExplicitTemplateArgs()) {
13327 TransArgs.setLAngleLoc(
E->getLAngleLoc());
13328 TransArgs.setRAngleLoc(
E->getRAngleLoc());
13329 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
13330 E->getNumTemplateArgs(),
13336 SourceLocation FakeOperatorLoc =
13343 NamedDecl *FirstQualifierInScope =
nullptr;
13344 DeclarationNameInfo MemberNameInfo =
E->getMemberNameInfo();
13345 if (MemberNameInfo.getName()) {
13346 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13347 if (!MemberNameInfo.getName())
13351 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13358 (
E->hasExplicitTemplateArgs()
13359 ? &TransArgs :
nullptr),
13360 FirstQualifierInScope);
13363template<
typename Derived>
13365TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *
E) {
13366 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13367 if (LHS.isInvalid())
13371 getDerived().TransformInitializer(
E->getRHS(),
false);
13372 if (RHS.isInvalid())
13375 if (!getDerived().AlwaysRebuild() &&
13376 LHS.get() ==
E->getLHS() &&
13377 RHS.get() ==
E->getRHS())
13380 if (
E->isCompoundAssignmentOp())
13382 return getDerived().RebuildBinaryOperator(
13383 E->getOperatorLoc(),
E->getOpcode(), LHS.get(), RHS.get());
13384 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13385 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13386 getSema().CurFPFeatures =
13387 NewOverrides.applyOverrides(getSema().getLangOpts());
13388 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13389 return getDerived().RebuildBinaryOperator(
E->getOperatorLoc(),
E->getOpcode(),
13390 LHS.get(), RHS.get());
13393template <
typename Derived>
13394ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
13395 CXXRewrittenBinaryOperator *
E) {
13396 CXXRewrittenBinaryOperator::DecomposedForm Decomp =
E->getDecomposedForm();
13398 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13399 if (LHS.isInvalid())
13402 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13403 if (RHS.isInvalid())
13408 UnresolvedSet<2> UnqualLookups;
13409 bool ChangedAnyLookups =
false;
13410 Expr *PossibleBinOps[] = {
E->getSemanticForm(),
13411 const_cast<Expr *
>(Decomp.InnerBinOp)};
13412 for (Expr *PossibleBinOp : PossibleBinOps) {
13413 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13416 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13417 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
13422 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13423 E->getOperatorLoc(),
Callee->getFoundDecl()));
13427 ChangedAnyLookups =
true;
13428 UnqualLookups.addDecl(
Found);
13431 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13432 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13438 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13443 return getDerived().RebuildCXXRewrittenBinaryOperator(
13444 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13447template<
typename Derived>
13449TreeTransform<Derived>::TransformCompoundAssignOperator(
13450 CompoundAssignOperator *
E) {
13451 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13452 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13453 getSema().CurFPFeatures =
13454 NewOverrides.applyOverrides(getSema().getLangOpts());
13455 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13456 return getDerived().TransformBinaryOperator(
E);
13459template<
typename Derived>
13461TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
13465 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13466 if (commonExpr.isInvalid())
13469 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13470 if (rhs.isInvalid())
13473 if (!getDerived().AlwaysRebuild() &&
13474 commonExpr.get() == e->getCommon() &&
13475 rhs.get() == e->getFalseExpr())
13478 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13479 e->getQuestionLoc(),
13485template<
typename Derived>
13487TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *
E) {
13488 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13489 if (Cond.isInvalid())
13492 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13493 if (LHS.isInvalid())
13496 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13497 if (RHS.isInvalid())
13500 if (!getDerived().AlwaysRebuild() &&
13501 Cond.get() ==
E->getCond() &&
13502 LHS.get() ==
E->getLHS() &&
13503 RHS.get() ==
E->getRHS())
13506 return getDerived().RebuildConditionalOperator(Cond.get(),
13507 E->getQuestionLoc(),
13513template<
typename Derived>
13515TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *
E) {
13518 return getDerived().TransformExpr(
E->getSubExprAsWritten());
13521template<
typename Derived>
13523TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *
E) {
13524 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeInfoAsWritten());
13529 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13530 if (SubExpr.isInvalid())
13533 if (!getDerived().AlwaysRebuild() &&
13534 Type ==
E->getTypeInfoAsWritten() &&
13535 SubExpr.get() ==
E->getSubExpr())
13538 return getDerived().RebuildCStyleCastExpr(
E->getLParenLoc(),
13544template<
typename Derived>
13546TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *
E) {
13547 TypeSourceInfo *OldT =
E->getTypeSourceInfo();
13548 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
13553 if (
Init.isInvalid())
13556 if (!getDerived().AlwaysRebuild() &&
13558 Init.get() ==
E->getInitializer())
13565 return getDerived().RebuildCompoundLiteralExpr(
13566 E->getLParenLoc(), NewT,
13570template<
typename Derived>
13572TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *
E) {
13574 if (
Base.isInvalid())
13577 if (!getDerived().AlwaysRebuild() &&
13578 Base.get() ==
E->getBase())
13582 SourceLocation FakeOperatorLoc =
13584 return getDerived().RebuildExtVectorElementExpr(
13585 Base.get(), FakeOperatorLoc,
E->isArrow(),
E->getAccessorLoc(),
13589template<
typename Derived>
13591TreeTransform<Derived>::TransformInitListExpr(InitListExpr *
E) {
13592 if (InitListExpr *Syntactic =
E->getSyntacticForm())
13595 bool InitChanged =
false;
13597 EnterExpressionEvaluationContext Context(
13601 if (getDerived().TransformExprs(
E->getInits(),
E->getNumInits(),
false,
13602 Inits, &InitChanged))
13605 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13612 return getDerived().RebuildInitList(
E->getLBraceLoc(), Inits,
13613 E->getRBraceLoc());
13616template<
typename Derived>
13618TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *
E) {
13623 if (
Init.isInvalid())
13628 bool ExprChanged =
false;
13629 for (
const DesignatedInitExpr::Designator &
D :
E->designators()) {
13630 if (
D.isFieldDesignator()) {
13631 if (
D.getFieldDecl()) {
13632 FieldDecl *
Field = cast_or_null<FieldDecl>(
13633 getDerived().TransformDecl(
D.getFieldLoc(),
D.getFieldDecl()));
13634 if (Field !=
D.getFieldDecl())
13637 ExprChanged =
true;
13638 if (
Field->isAnonymousStructOrUnion())
13644 ExprChanged =
true;
13647 D.getFieldName(),
D.getDotLoc(),
D.getFieldLoc()));
13651 if (
D.isArrayDesignator()) {
13652 ExprResult Index = getDerived().TransformExpr(
E->getArrayIndex(
D));
13653 if (Index.isInvalid())
13656 Desig.AddDesignator(
13659 ExprChanged = ExprChanged ||
Init.get() !=
E->getArrayIndex(
D);
13660 ArrayExprs.push_back(Index.get());
13664 assert(
D.isArrayRangeDesignator() &&
"New kind of designator?");
13666 = getDerived().TransformExpr(
E->getArrayRangeStart(
D));
13667 if (Start.isInvalid())
13670 ExprResult End = getDerived().TransformExpr(
E->getArrayRangeEnd(
D));
13671 if (End.isInvalid())
13675 Start.get(), End.get(),
D.getLBracketLoc(),
D.getEllipsisLoc()));
13677 ExprChanged = ExprChanged || Start.get() !=
E->getArrayRangeStart(
D) ||
13678 End.get() !=
E->getArrayRangeEnd(
D);
13680 ArrayExprs.push_back(Start.get());
13681 ArrayExprs.push_back(End.get());
13684 if (!getDerived().AlwaysRebuild() &&
13685 Init.get() ==
E->getInit() &&
13689 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13690 E->getEqualOrColonLoc(),
13691 E->usesGNUSyntax(),
Init.get());
13696template<
typename Derived>
13698TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
13699 DesignatedInitUpdateExpr *
E) {
13700 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13705template<
typename Derived>
13707TreeTransform<Derived>::TransformNoInitExpr(
13709 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13713template<
typename Derived>
13715TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *
E) {
13716 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13720template<
typename Derived>
13722TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *
E) {
13723 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13727template<
typename Derived>
13729TreeTransform<Derived>::TransformImplicitValueInitExpr(
13730 ImplicitValueInitExpr *
E) {
13731 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
13735 QualType
T = getDerived().TransformType(
E->
getType());
13739 if (!getDerived().AlwaysRebuild() &&
13743 return getDerived().RebuildImplicitValueInitExpr(
T);
13746template<
typename Derived>
13748TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *
E) {
13749 TypeSourceInfo *TInfo = getDerived().TransformType(
E->getWrittenTypeInfo());
13753 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
13754 if (SubExpr.isInvalid())
13757 if (!getDerived().AlwaysRebuild() &&
13758 TInfo ==
E->getWrittenTypeInfo() &&
13759 SubExpr.get() ==
E->getSubExpr())
13762 return getDerived().RebuildVAArgExpr(
E->getBuiltinLoc(), SubExpr.get(),
13763 TInfo,
E->getRParenLoc());
13766template<
typename Derived>
13768TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *
E) {
13769 bool ArgumentChanged =
false;
13771 if (TransformExprs(
E->getExprs(),
E->getNumExprs(),
true, Inits,
13775 return getDerived().RebuildParenListExpr(
E->getLParenLoc(),
13777 E->getRParenLoc());
13785template<
typename Derived>
13787TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *
E) {
13788 Decl *LD = getDerived().TransformDecl(
E->getLabel()->getLocation(),
13793 return getDerived().RebuildAddrLabelExpr(
E->getAmpAmpLoc(),
E->getLabelLoc(),
13794 cast<LabelDecl>(LD));
13797template<
typename Derived>
13799TreeTransform<Derived>::TransformStmtExpr(StmtExpr *
E) {
13802 = getDerived().TransformCompoundStmt(
E->getSubStmt(),
true);
13803 if (SubStmt.isInvalid()) {
13808 unsigned OldDepth =
E->getTemplateDepth();
13809 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13811 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13812 SubStmt.get() ==
E->getSubStmt()) {
13818 return getDerived().RebuildStmtExpr(
E->getLParenLoc(), SubStmt.get(),
13819 E->getRParenLoc(), NewDepth);
13822template<
typename Derived>
13824TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *
E) {
13825 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13826 if (Cond.isInvalid())
13829 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13830 if (LHS.isInvalid())
13833 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13834 if (RHS.isInvalid())
13837 if (!getDerived().AlwaysRebuild() &&
13838 Cond.get() ==
E->getCond() &&
13839 LHS.get() ==
E->getLHS() &&
13840 RHS.get() ==
E->getRHS())
13843 return getDerived().RebuildChooseExpr(
E->getBuiltinLoc(),
13844 Cond.get(), LHS.get(), RHS.get(),
13845 E->getRParenLoc());
13848template<
typename Derived>
13850TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *
E) {
13854template<
typename Derived>
13856TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *
E) {
13857 switch (
E->getOperator()) {
13861 case OO_Array_Delete:
13862 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
13867 assert(
E->getNumArgs() >= 1 &&
"Object call is missing arguments");
13876 static_cast<Expr *
>(
Object.get())->getEndLoc());
13880 if (getDerived().TransformExprs(
E->getArgs() + 1,
E->getNumArgs() - 1,
true,
13884 if (
E->getOperator() == OO_Subscript)
13885 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
13888 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
13892#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
13896#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
13897#include "clang/Basic/OperatorKinds.def"
13899 case OO_Conditional:
13900 llvm_unreachable(
"conditional operator is not actually overloadable");
13904 llvm_unreachable(
"not an overloaded operator?");
13908 if (
E->getNumArgs() == 1 &&
E->getOperator() == OO_Amp)
13909 First = getDerived().TransformAddressOfOperand(
E->getArg(0));
13911 First = getDerived().TransformExpr(
E->getArg(0));
13912 if (
First.isInvalid())
13916 if (
E->getNumArgs() == 2) {
13918 getDerived().TransformInitializer(
E->getArg(1),
false);
13919 if (Second.isInvalid())
13923 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13924 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13925 getSema().CurFPFeatures =
13926 NewOverrides.applyOverrides(getSema().getLangOpts());
13927 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13929 Expr *
Callee =
E->getCallee();
13930 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
13931 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
13933 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
13936 return getDerived().RebuildCXXOperatorCallExpr(
13937 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13938 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
13941 UnresolvedSet<1> Functions;
13942 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
13943 Callee = ICE->getSubExprAsWritten();
13944 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
13945 ValueDecl *VD = cast_or_null<ValueDecl>(
13946 getDerived().TransformDecl(DR->getLocation(), DR));
13950 if (!isa<CXXMethodDecl>(VD))
13951 Functions.addDecl(VD);
13953 return getDerived().RebuildCXXOperatorCallExpr(
13954 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13955 false, Functions,
First.get(), Second.get());
13958template<
typename Derived>
13960TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *
E) {
13961 return getDerived().TransformCallExpr(
E);
13964template <
typename Derived>
13965ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *
E) {
13967 getSema().CurContext !=
E->getParentContext();
13969 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
13972 return getDerived().RebuildSourceLocExpr(
E->getIdentKind(),
E->
getType(),
13974 getSema().CurContext);
13977template <
typename Derived>
13978ExprResult TreeTransform<Derived>::TransformEmbedExpr(EmbedExpr *
E) {
13982template<
typename Derived>
13984TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *
E) {
13991 ExprResult EC = getDerived().TransformCallExpr(
E->getConfig());
13992 if (EC.isInvalid())
13996 bool ArgChanged =
false;
13998 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14002 if (!getDerived().AlwaysRebuild() &&
14003 Callee.get() ==
E->getCallee() &&
14008 SourceLocation FakeLParenLoc
14010 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14012 E->getRParenLoc(), EC.get());
14015template<
typename Derived>
14023 = getDerived().TransformExpr(
E->getSubExprAsWritten());
14027 if (!getDerived().AlwaysRebuild() &&
14028 Type ==
E->getTypeInfoAsWritten() &&
14029 SubExpr.
get() ==
E->getSubExpr())
14031 return getDerived().RebuildCXXNamedCastExpr(
14032 E->getOperatorLoc(),
E->
getStmtClass(),
E->getAngleBrackets().getBegin(),
14033 Type,
E->getAngleBrackets().getEnd(),
14035 E->getAngleBrackets().getEnd(), SubExpr.
get(),
E->getRParenLoc());
14038template<
typename Derived>
14047 if (Sub.isInvalid())
14050 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14054template<
typename Derived>
14056TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *
E) {
14057 return getDerived().TransformCXXNamedCastExpr(
E);
14060template<
typename Derived>
14062TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *
E) {
14063 return getDerived().TransformCXXNamedCastExpr(
E);
14066template<
typename Derived>
14068TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
14069 CXXReinterpretCastExpr *
E) {
14070 return getDerived().TransformCXXNamedCastExpr(
E);
14073template<
typename Derived>
14075TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *
E) {
14076 return getDerived().TransformCXXNamedCastExpr(
E);
14079template<
typename Derived>
14081TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *
E) {
14082 return getDerived().TransformCXXNamedCastExpr(
E);
14085template<
typename Derived>
14087TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
14088 CXXFunctionalCastExpr *
E) {
14089 TypeSourceInfo *
Type =
14090 getDerived().TransformTypeWithDeducedTST(
E->getTypeInfoAsWritten());
14095 = getDerived().TransformExpr(
E->getSubExprAsWritten());
14096 if (SubExpr.isInvalid())
14099 if (!getDerived().AlwaysRebuild() &&
14100 Type ==
E->getTypeInfoAsWritten() &&
14101 SubExpr.get() ==
E->getSubExpr())
14104 return getDerived().RebuildCXXFunctionalCastExpr(Type,
14108 E->isListInitialization());
14111template<
typename Derived>
14113TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *
E) {
14114 if (
E->isTypeOperand()) {
14115 TypeSourceInfo *TInfo
14116 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
14120 if (!getDerived().AlwaysRebuild() &&
14121 TInfo ==
E->getTypeOperandSourceInfo())
14131 Expr *Op =
E->getExprOperand();
14134 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
14135 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
14138 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
14141 ExprResult SubExpr = getDerived().TransformExpr(Op);
14142 if (SubExpr.isInvalid())
14145 if (!getDerived().AlwaysRebuild() &&
14146 SubExpr.get() ==
E->getExprOperand())
14153template<
typename Derived>
14155TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *
E) {
14156 if (
E->isTypeOperand()) {
14157 TypeSourceInfo *TInfo
14158 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
14162 if (!getDerived().AlwaysRebuild() &&
14163 TInfo ==
E->getTypeOperandSourceInfo())
14173 ExprResult SubExpr = getDerived().TransformExpr(
E->getExprOperand());
14174 if (SubExpr.isInvalid())
14177 if (!getDerived().AlwaysRebuild() &&
14178 SubExpr.get() ==
E->getExprOperand())
14185template<
typename Derived>
14187TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *
E) {
14191template<
typename Derived>
14193TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
14194 CXXNullPtrLiteralExpr *
E) {
14198template<
typename Derived>
14200TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *
E) {
14211 QualType
T = [&]() {
14212 auto &S = getSema();
14213 if (
E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14216 return getDerived().TransformType(
E->
getType());
14220 if (!getDerived().AlwaysRebuild() &&
T ==
E->
getType()) {
14223 getSema().MarkThisReferenced(
E);
14227 return getDerived().RebuildCXXThisExpr(
E->
getBeginLoc(),
T,
E->isImplicit());
14230template<
typename Derived>
14232TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *
E) {
14233 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
14234 if (SubExpr.isInvalid())
14237 if (!getDerived().AlwaysRebuild() &&
14238 SubExpr.get() ==
E->getSubExpr())
14241 return getDerived().RebuildCXXThrowExpr(
E->getThrowLoc(), SubExpr.get(),
14242 E->isThrownVariableInScope());
14245template<
typename Derived>
14247TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *
E) {
14248 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
14249 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getParam()));
14254 if (
E->hasRewrittenInit()) {
14255 InitRes = getDerived().TransformExpr(
E->getRewrittenExpr());
14256 if (InitRes.isInvalid())
14260 if (!getDerived().AlwaysRebuild() && Param ==
E->getParam() &&
14262 InitRes.get() ==
E->getRewrittenExpr())
14265 return getDerived().RebuildCXXDefaultArgExpr(
E->getUsedLocation(), Param,
14269template<
typename Derived>
14271TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *
E) {
14272 FieldDecl *
Field = cast_or_null<FieldDecl>(
14273 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getField()));
14277 if (!getDerived().AlwaysRebuild() && Field ==
E->getField() &&
14281 return getDerived().RebuildCXXDefaultInitExpr(
E->
getExprLoc(), Field);
14284template<
typename Derived>
14286TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
14287 CXXScalarValueInitExpr *
E) {
14288 TypeSourceInfo *
T = getDerived().TransformType(
E->getTypeSourceInfo());
14292 if (!getDerived().AlwaysRebuild() &&
14293 T ==
E->getTypeSourceInfo())
14296 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14297 T->getTypeLoc().getEndLoc(),
14298 E->getRParenLoc());
14301template<
typename Derived>
14303TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *
E) {
14305 TypeSourceInfo *AllocTypeInfo =
14306 getDerived().TransformTypeWithDeducedTST(
E->getAllocatedTypeSourceInfo());
14307 if (!AllocTypeInfo)
14311 std::optional<Expr *> ArraySize;
14312 if (
E->isArray()) {
14314 if (std::optional<Expr *> OldArraySize =
E->getArraySize()) {
14315 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14316 if (NewArraySize.isInvalid())
14319 ArraySize = NewArraySize.get();
14323 bool ArgumentChanged =
false;
14325 if (getDerived().TransformExprs(
E->getPlacementArgs(),
14326 E->getNumPlacementArgs(),
true,
14327 PlacementArgs, &ArgumentChanged))
14331 Expr *OldInit =
E->getInitializer();
14334 NewInit = getDerived().TransformInitializer(OldInit,
true);
14335 if (NewInit.isInvalid())
14339 FunctionDecl *OperatorNew =
nullptr;
14340 if (
E->getOperatorNew()) {
14341 OperatorNew = cast_or_null<FunctionDecl>(
14342 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorNew()));
14347 FunctionDecl *OperatorDelete =
nullptr;
14348 if (
E->getOperatorDelete()) {
14349 OperatorDelete = cast_or_null<FunctionDecl>(
14350 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14351 if (!OperatorDelete)
14355 if (!getDerived().AlwaysRebuild() &&
14356 AllocTypeInfo ==
E->getAllocatedTypeSourceInfo() &&
14357 ArraySize ==
E->getArraySize() &&
14358 NewInit.get() == OldInit &&
14359 OperatorNew ==
E->getOperatorNew() &&
14360 OperatorDelete ==
E->getOperatorDelete() &&
14361 !ArgumentChanged) {
14366 if (OperatorDelete)
14369 if (
E->isArray() && !
E->getAllocatedType()->isDependentType()) {
14370 QualType ElementType
14372 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
14373 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
14383 QualType AllocType = AllocTypeInfo->
getType();
14393 }
else if (
const ConstantArrayType *ConsArrayT
14394 = dyn_cast<ConstantArrayType>(ArrayT)) {
14398 AllocType = ConsArrayT->getElementType();
14399 }
else if (
const DependentSizedArrayType *DepArrayT
14400 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14401 if (DepArrayT->getSizeExpr()) {
14402 ArraySize = DepArrayT->getSizeExpr();
14403 AllocType = DepArrayT->getElementType();
14408 return getDerived().RebuildCXXNewExpr(
14412 AllocTypeInfo, ArraySize,
E->getDirectInitRange(), NewInit.get());
14415template<
typename Derived>
14417TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *
E) {
14423 FunctionDecl *OperatorDelete =
nullptr;
14424 if (
E->getOperatorDelete()) {
14425 OperatorDelete = cast_or_null<FunctionDecl>(
14426 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14427 if (!OperatorDelete)
14431 if (!getDerived().AlwaysRebuild() &&
14432 Operand.get() ==
E->getArgument() &&
14433 OperatorDelete ==
E->getOperatorDelete()) {
14436 if (OperatorDelete)
14441 E->getDestroyedType());
14442 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
14443 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
14452 return getDerived().RebuildCXXDeleteExpr(
14456template<
typename Derived>
14458TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
14459 CXXPseudoDestructorExpr *
E) {
14461 if (
Base.isInvalid())
14465 bool MayBePseudoDestructor =
false;
14467 E->getOperatorLoc(),
14468 E->isArrow()? tok::arrow : tok::period,
14470 MayBePseudoDestructor);
14471 if (
Base.isInvalid())
14474 QualType ObjectType = ObjectTypePtr.get();
14475 NestedNameSpecifierLoc QualifierLoc =
E->getQualifierLoc();
14476 if (QualifierLoc) {
14478 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14483 SS.Adopt(QualifierLoc);
14485 PseudoDestructorTypeStorage Destroyed;
14486 if (
E->getDestroyedTypeInfo()) {
14487 TypeSourceInfo *DestroyedTypeInfo
14488 = getDerived().TransformTypeInObjectScope(
E->getDestroyedTypeInfo(),
14489 ObjectType,
nullptr, SS);
14490 if (!DestroyedTypeInfo)
14492 Destroyed = DestroyedTypeInfo;
14493 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14496 Destroyed = PseudoDestructorTypeStorage(
E->getDestroyedTypeIdentifier(),
14497 E->getDestroyedTypeLoc());
14501 *
E->getDestroyedTypeIdentifier(),
E->getDestroyedTypeLoc(),
14502 nullptr, SS, ObjectTypePtr,
false);
14508 E->getDestroyedTypeLoc());
14511 TypeSourceInfo *ScopeTypeInfo =
nullptr;
14512 if (
E->getScopeTypeInfo()) {
14513 CXXScopeSpec EmptySS;
14514 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14515 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
14516 if (!ScopeTypeInfo)
14520 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14521 E->getOperatorLoc(),
14525 E->getColonColonLoc(),
14530template <
typename Derived>
14535 bool AllEmptyPacks =
true;
14536 for (
auto *OldD : Old->
decls()) {
14537 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
14541 if (isa<UsingShadowDecl>(OldD))
14550 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
14552 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14553 Decls = UPD->expansions();
14556 for (
auto *
D : Decls) {
14557 if (
auto *UD = dyn_cast<UsingDecl>(
D)) {
14558 for (
auto *SD : UD->shadows())
14565 AllEmptyPacks &= Decls.empty();
14574 if (AllEmptyPacks && !RequiresADL) {
14575 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
14576 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
14586 getSema().FilterAcceptableTemplateNames(R,
14593 diag::err_template_kw_refers_to_non_template)
14597 diag::note_template_kw_refers_to_non_template)
14606template <
typename Derived>
14609 return TransformUnresolvedLookupExpr(Old,
false);
14612template <
typename Derived>
14615 bool IsAddressOfOperand) {
14620 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14627 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14631 SS.
Adopt(QualifierLoc);
14635 CXXRecordDecl *NamingClass
14636 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14639 if (!NamingClass) {
14644 R.setNamingClass(NamingClass);
14665 SS, TemplateKWLoc, R,
14672 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14675 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14679template<
typename Derived>
14681TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *
E) {
14682 bool ArgChanged =
false;
14684 for (
unsigned I = 0, N =
E->getNumArgs(); I != N; ++I) {
14685 TypeSourceInfo *From =
E->getArg(I);
14686 TypeLoc FromTL = From->getTypeLoc();
14687 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
14688 TypeLocBuilder TLB;
14689 TLB.reserve(FromTL.getFullDataSize());
14690 QualType To = getDerived().TransformType(TLB, FromTL);
14694 if (To == From->getType())
14695 Args.push_back(From);
14697 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14706 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
14707 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14713 bool Expand =
true;
14714 bool RetainExpansion =
false;
14715 std::optional<unsigned> OrigNumExpansions =
14716 ExpansionTL.getTypePtr()->getNumExpansions();
14717 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14718 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
14719 PatternTL.getSourceRange(),
14721 Expand, RetainExpansion,
14729 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14731 TypeLocBuilder TLB;
14732 TLB.reserve(From->getTypeLoc().getFullDataSize());
14734 QualType To = getDerived().TransformType(TLB, PatternTL);
14738 To = getDerived().RebuildPackExpansionType(To,
14739 PatternTL.getSourceRange(),
14740 ExpansionTL.getEllipsisLoc(),
14745 PackExpansionTypeLoc ToExpansionTL
14746 = TLB.push<PackExpansionTypeLoc>(To);
14747 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14748 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14754 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14755 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
14756 TypeLocBuilder TLB;
14757 TLB.reserve(PatternTL.getFullDataSize());
14758 QualType To = getDerived().TransformType(TLB, PatternTL);
14762 if (To->containsUnexpandedParameterPack()) {
14763 To = getDerived().RebuildPackExpansionType(To,
14764 PatternTL.getSourceRange(),
14765 ExpansionTL.getEllipsisLoc(),
14770 PackExpansionTypeLoc ToExpansionTL
14771 = TLB.push<PackExpansionTypeLoc>(To);
14772 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14775 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14778 if (!RetainExpansion)
14783 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14785 TypeLocBuilder TLB;
14786 TLB.reserve(From->getTypeLoc().getFullDataSize());
14788 QualType To = getDerived().TransformType(TLB, PatternTL);
14792 To = getDerived().RebuildPackExpansionType(To,
14793 PatternTL.getSourceRange(),
14794 ExpansionTL.getEllipsisLoc(),
14799 PackExpansionTypeLoc ToExpansionTL
14800 = TLB.push<PackExpansionTypeLoc>(To);
14801 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14802 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14805 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14808 return getDerived().RebuildTypeTrait(
E->getTrait(),
E->
getBeginLoc(), Args,
14812template<
typename Derived>
14814TreeTransform<Derived>::TransformConceptSpecializationExpr(
14815 ConceptSpecializationExpr *
E) {
14816 const ASTTemplateArgumentListInfo *Old =
E->getTemplateArgsAsWritten();
14817 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
14818 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14819 Old->NumTemplateArgs, TransArgs))
14822 return getDerived().RebuildConceptSpecializationExpr(
14823 E->getNestedNameSpecifierLoc(),
E->getTemplateKWLoc(),
14824 E->getConceptNameInfo(),
E->getFoundDecl(),
E->getNamedConcept(),
14828template<
typename Derived>
14830TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *
E) {
14833 Sema::ExtParameterInfoBuilder ExtParamInfos;
14837 EnterExpressionEvaluationContext Ctx(
14842 getSema().Context, getSema().CurContext,
14845 Sema::ContextRAII SavedContext(getSema(), Body,
false);
14847 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
14848 E->getRequiresKWLoc(),
E->getRBraceLoc(),
E, Body,
14849 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
14851 for (ParmVarDecl *Param : TransParams)
14853 Param->setDeclContext(Body);
14859 if (!TypeParamResult.isUnset())
14860 return TypeParamResult;
14863 if (getDerived().TransformRequiresExprRequirements(
E->getRequirements(),
14867 for (concepts::Requirement *Req : TransReqs) {
14868 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
14869 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
14870 ER->getReturnTypeRequirement()
14871 .getTypeConstraintTemplateParameterList()->getParam(0)
14872 ->setDeclContext(Body);
14877 return getDerived().RebuildRequiresExpr(
14878 E->getRequiresKWLoc(), Body,
E->getLParenLoc(), TransParams,
14879 E->getRParenLoc(), TransReqs,
E->getRBraceLoc());
14882template<
typename Derived>
14888 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
14889 TransReq = getDerived().TransformTypeRequirement(TypeReq);
14890 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
14891 TransReq = getDerived().TransformExprRequirement(ExprReq);
14893 TransReq = getDerived().TransformNestedRequirement(
14894 cast<concepts::NestedRequirement>(Req));
14897 Transformed.push_back(TransReq);
14902template<
typename Derived>
14907 if (getDerived().AlwaysRebuild())
14908 return getDerived().RebuildTypeRequirement(
14915 return getDerived().RebuildTypeRequirement(TransType);
14918template<
typename Derived>
14921 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
14930 TransExpr = TransExprRes.
get();
14933 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
14935 if (RetReq.isEmpty())
14936 TransRetReq.emplace();
14937 else if (RetReq.isSubstitutionFailure())
14938 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
14939 else if (RetReq.isTypeConstraint()) {
14941 RetReq.getTypeConstraintTemplateParameterList();
14943 getDerived().TransformTemplateParameterList(OrigTPL);
14946 TransRetReq.emplace(TPL);
14948 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
14949 if (
Expr *
E = dyn_cast<Expr *>(TransExpr))
14950 return getDerived().RebuildExprRequirement(
E, Req->
isSimple(),
14952 std::move(*TransRetReq));
14953 return getDerived().RebuildExprRequirement(
14954 cast<concepts::Requirement::SubstitutionDiagnostic *>(TransExpr),
14958template<
typename Derived>
14963 if (getDerived().AlwaysRebuild())
14964 return getDerived().RebuildNestedRequirement(
14972 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
14975template<
typename Derived>
14978 TypeSourceInfo *
T = getDerived().TransformType(
E->getQueriedTypeSourceInfo());
14982 if (!getDerived().AlwaysRebuild() &&
14983 T ==
E->getQueriedTypeSourceInfo())
14990 SubExpr = getDerived().TransformExpr(
E->getDimensionExpression());
14995 return getDerived().RebuildArrayTypeTrait(
E->getTrait(),
E->
getBeginLoc(),
T,
14999template<
typename Derived>
15001TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *
E) {
15006 SubExpr = getDerived().TransformExpr(
E->getQueriedExpression());
15007 if (SubExpr.isInvalid())
15010 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getQueriedExpression())
15014 return getDerived().RebuildExpressionTrait(
E->getTrait(),
E->
getBeginLoc(),
15018template <
typename Derived>
15022 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
15023 DRE, AddrTaken, RecoveryTSI);
15030 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
15032 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
15036template <
typename Derived>
15039 return TransformDependentScopeDeclRefExpr(
E,
false,
15043template <
typename Derived>
15047 assert(
E->getQualifierLoc());
15049 getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
15059 getDerived().TransformDeclarationNameInfo(
E->getNameInfo());
15063 if (!
E->hasExplicitTemplateArgs()) {
15064 if (!getDerived().AlwaysRebuild() && QualifierLoc ==
E->getQualifierLoc() &&
15067 NameInfo.
getName() ==
E->getDeclName())
15070 return getDerived().RebuildDependentScopeDeclRefExpr(
15071 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15072 IsAddressOfOperand, RecoveryTSI);
15075 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15076 if (getDerived().TransformTemplateArguments(
15077 E->getTemplateArgs(),
E->getNumTemplateArgs(), TransArgs))
15080 return getDerived().RebuildDependentScopeDeclRefExpr(
15081 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15085template<
typename Derived>
15087TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *
E) {
15091 if (getDerived().AllowSkippingCXXConstructExpr() &&
15092 ((
E->getNumArgs() == 1 ||
15093 (
E->getNumArgs() > 1 && getDerived().DropCallArgument(
E->getArg(1)))) &&
15094 (!getDerived().DropCallArgument(
E->getArg(0))) &&
15095 !
E->isListInitialization()))
15096 return getDerived().TransformInitializer(
E->getArg(0),
15099 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
15101 QualType
T = getDerived().TransformType(
E->
getType());
15105 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15106 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15110 bool ArgumentChanged =
false;
15113 EnterExpressionEvaluationContext Context(
15115 E->isListInitialization());
15116 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15121 if (!getDerived().AlwaysRebuild() &&
15123 Constructor ==
E->getConstructor() &&
15124 !ArgumentChanged) {
15131 return getDerived().RebuildCXXConstructExpr(
15133 E->hadMultipleCandidates(),
E->isListInitialization(),
15134 E->isStdInitListInitialization(),
E->requiresZeroInitialization(),
15135 E->getConstructionKind(),
E->getParenOrBraceRange());
15138template<
typename Derived>
15139ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
15140 CXXInheritedCtorInitExpr *
E) {
15141 QualType
T = getDerived().TransformType(
E->
getType());
15145 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15146 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15150 if (!getDerived().AlwaysRebuild() &&
15152 Constructor ==
E->getConstructor()) {
15159 return getDerived().RebuildCXXInheritedCtorInitExpr(
15160 T,
E->getLocation(), Constructor,
15161 E->constructsVBase(),
E->inheritedFromVBase());
15168template<
typename Derived>
15170TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *
E) {
15171 if (
auto *Dtor =
E->getTemporary()->getDestructor())
15173 const_cast<CXXDestructorDecl *
>(Dtor));
15174 return getDerived().TransformExpr(
E->getSubExpr());
15182template<
typename Derived>
15184TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *
E) {
15185 return getDerived().TransformExpr(
E->getSubExpr());
15188template<
typename Derived>
15190TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
15191 CXXTemporaryObjectExpr *
E) {
15192 TypeSourceInfo *
T =
15193 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15197 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15198 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15202 bool ArgumentChanged =
false;
15204 Args.reserve(
E->getNumArgs());
15206 EnterExpressionEvaluationContext Context(
15208 E->isListInitialization());
15209 if (TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15213 if (
E->isListInitialization() && !
E->isStdInitListInitialization()) {
15215 if (Res.isInvalid())
15217 Args = {Res.get()};
15221 if (!getDerived().AlwaysRebuild() &&
15222 T ==
E->getTypeSourceInfo() &&
15223 Constructor ==
E->getConstructor() &&
15224 !ArgumentChanged) {
15230 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
15231 return getDerived().RebuildCXXTemporaryObjectExpr(
15232 T, LParenLoc, Args,
E->
getEndLoc(),
E->isListInitialization());
15235template<
typename Derived>
15237TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *
E) {
15240 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15241 struct TransformedInitCapture {
15243 SourceLocation EllipsisLoc;
15248 InitCaptures.resize(
E->explicit_capture_end() -
E->explicit_capture_begin());
15250 CEnd =
E->capture_end();
15252 if (!
E->isInitCapture(
C))
15255 TransformedInitCapture &
Result = InitCaptures[
C -
E->capture_begin()];
15256 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15258 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
15259 std::optional<unsigned> NumExpansions) {
15260 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15263 if (NewExprInitResult.isInvalid()) {
15264 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
15267 Expr *NewExprInit = NewExprInitResult.get();
15269 QualType NewInitCaptureType =
15270 getSema().buildLambdaInitCaptureInitialization(
15271 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15272 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15273 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
15276 Result.Expansions.push_back(
15277 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15281 if (OldVD->isParameterPack()) {
15282 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
15284 .castAs<PackExpansionTypeLoc>();
15290 bool Expand =
true;
15291 bool RetainExpansion =
false;
15292 std::optional<unsigned> OrigNumExpansions =
15293 ExpansionTL.getTypePtr()->getNumExpansions();
15294 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15295 if (getDerived().TryExpandParameterPacks(
15296 ExpansionTL.getEllipsisLoc(),
15297 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
15298 RetainExpansion, NumExpansions))
15300 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15301 "capture since it cannot be extended");
15303 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15304 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15305 SubstInitCapture(SourceLocation(), std::nullopt);
15308 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15309 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15312 SubstInitCapture(SourceLocation(), std::nullopt);
15316 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
15317 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
15328 DeclContext *DC = getSema().CurContext;
15346 while (DC->isRequiresExprBody())
15347 DC = DC->getParent();
15348 if ((getSema().isUnevaluatedContext() ||
15349 getSema().isConstantEvaluatedContext()) &&
15350 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15353 CXXRecordDecl *OldClass =
E->getLambdaClass();
15354 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
15355 E->getIntroducerRange(),
nullptr, DependencyKind,
15356 E->getCaptureDefault());
15357 getDerived().transformedLocalDecl(OldClass, {
Class});
15359 CXXMethodDecl *NewCallOperator =
15360 getSema().CreateLambdaCallOperator(
E->getIntroducerRange(),
Class);
15363 getSema().buildLambdaScope(LSI, NewCallOperator,
E->getIntroducerRange(),
15364 E->getCaptureDefault(),
E->getCaptureDefaultLoc(),
15365 E->hasExplicitParameters(),
E->isMutable());
15368 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
15375 CEnd =
E->capture_end();
15379 if (
C->isImplicit())
15383 if (
C->capturesThis()) {
15389 Sema::CXXThisScopeRAII ThisScope(
15391 dyn_cast_if_present<CXXRecordDecl>(
15392 getSema().getFunctionLevelDeclContext()),
15394 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15401 if (
C->capturesVLAType())
15405 if (
E->isInitCapture(
C)) {
15406 TransformedInitCapture &NewC = InitCaptures[
C -
E->capture_begin()];
15408 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15411 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15413 QualType InitQualType = Info.second;
15414 if (
Init.isInvalid() || InitQualType.isNull()) {
15418 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15419 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15420 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15421 getSema().CurContext);
15426 NewVDs.push_back(NewVD);
15427 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15432 if (NewC.EllipsisLoc.isInvalid())
15433 LSI->ContainsUnexpandedParameterPack |=
15434 Init.get()->containsUnexpandedParameterPack();
15440 getDerived().transformedLocalDecl(OldVD, NewVDs);
15444 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15452 SourceLocation EllipsisLoc;
15453 if (
C->isPackExpansion()) {
15455 bool ShouldExpand =
false;
15456 bool RetainExpansion =
false;
15457 std::optional<unsigned> NumExpansions;
15458 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
15461 ShouldExpand, RetainExpansion,
15467 if (ShouldExpand) {
15471 auto *Pack = cast<ValueDecl>(
C->getCapturedVar());
15472 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15473 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15474 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15475 getDerived().TransformDecl(
C->getLocation(), Pack));
15476 if (!CapturedVar) {
15482 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15490 EllipsisLoc =
C->getEllipsisLoc();
15494 auto *CapturedVar = cast_or_null<ValueDecl>(
15495 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15496 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15503 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15504 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15507 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15510 getSema().finishLambdaExplicitCaptures(LSI);
15514 auto TPL = getDerived().TransformTemplateParameterList(
15515 E->getTemplateParameterList());
15516 LSI->GLTemplateParameterList = TPL;
15518 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15520 LSI->ContainsUnexpandedParameterPack |=
15521 TPL->containsUnexpandedParameterPack();
15524 TypeLocBuilder NewCallOpTLBuilder;
15525 TypeLoc OldCallOpTypeLoc =
15526 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15527 QualType NewCallOpType =
15528 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15529 if (NewCallOpType.isNull())
15531 LSI->ContainsUnexpandedParameterPack |=
15532 NewCallOpType->containsUnexpandedParameterPack();
15533 TypeSourceInfo *NewCallOpTSI =
15534 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15538 auto FPTL = NewCallOpTSI->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>();
15539 assert(FPTL &&
"Not a FunctionProtoType?");
15541 getSema().CompleteLambdaCallOperator(
15542 NewCallOperator,
E->getCallOperator()->getLocation(),
15543 E->getCallOperator()->getInnerLocStart(),
15544 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
15545 E->getCallOperator()->getConstexprKind(),
15546 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15547 E->hasExplicitResultType());
15549 getDerived().transformAttrs(
E->getCallOperator(), NewCallOperator);
15550 getDerived().transformedLocalDecl(
E->getCallOperator(), {NewCallOperator});
15554 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
15556 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15557 if (getDerived().ReplacingOriginal()) {
15558 Numbering = OldClass->getLambdaNumbering();
15561 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15566 getSema().PushExpressionEvaluationContext(
15567 E->getCallOperator()->isConsteval() ?
15570 getSema().currentEvaluationContext().InImmediateEscalatingFunctionContext =
15571 getSema().getLangOpts().CPlusPlus20 &&
15572 E->getCallOperator()->isImmediateEscalating();
15574 Sema::CodeSynthesisContext
C;
15577 getSema().pushCodeSynthesisContext(
C);
15583 getSema().popCodeSynthesisContext();
15586 FuncScopeCleanup.disable();
15588 if (Body.isInvalid()) {
15589 SavedContext.pop();
15598 auto LSICopy = *LSI;
15599 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15601 SavedContext.pop();
15636 DependencyKind = getDerived().ComputeLambdaDependency(&LSICopy);
15637 Class->setLambdaDependencyKind(DependencyKind);
15640 Class->setTypeForDecl(
nullptr);
15641 getSema().Context.getTypeDeclType(
Class);
15643 return getDerived().RebuildLambdaExpr(
E->
getBeginLoc(),
15644 Body.get()->getEndLoc(), &LSICopy);
15647template<
typename Derived>
15650 return TransformStmt(S);
15653template<
typename Derived>
15658 CEnd =
E->capture_end();
15662 if (!
C->isImplicit())
15666 if (
C->capturesThis()) {
15667 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15674 if (
C->capturesVLAType())
15677 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15678 assert(!
E->isInitCapture(
C) &&
"implicit init-capture?");
15681 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15682 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15687 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15693template<
typename Derived>
15698 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15702 bool ArgumentChanged =
false;
15704 Args.reserve(
E->getNumArgs());
15708 E->isListInitialization());
15709 if (getDerived().TransformExprs(
E->arg_begin(),
E->getNumArgs(),
true, Args,
15714 if (!getDerived().AlwaysRebuild() &&
15715 T ==
E->getTypeSourceInfo() &&
15720 return getDerived().RebuildCXXUnresolvedConstructExpr(
15721 T,
E->getLParenLoc(), Args,
E->getRParenLoc(),
E->isListInitialization());
15724template<
typename Derived>
15726TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
15727 CXXDependentScopeMemberExpr *
E) {
15732 QualType ObjectType;
15733 if (!
E->isImplicitAccess()) {
15734 OldBase =
E->getBase();
15735 Base = getDerived().TransformExpr(OldBase);
15736 if (
Base.isInvalid())
15741 bool MayBePseudoDestructor =
false;
15743 E->getOperatorLoc(),
15744 E->isArrow()? tok::arrow : tok::period,
15746 MayBePseudoDestructor);
15747 if (
Base.isInvalid())
15750 ObjectType = ObjectTy.get();
15751 BaseType = ((Expr*)
Base.get())->getType();
15754 BaseType = getDerived().TransformType(
E->getBaseType());
15760 NamedDecl *FirstQualifierInScope
15761 = getDerived().TransformFirstQualifierInScope(
15762 E->getFirstQualifierFoundInScope(),
15765 NestedNameSpecifierLoc QualifierLoc;
15766 if (
E->getQualifier()) {
15768 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc(),
15770 FirstQualifierInScope);
15775 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
15781 DeclarationNameInfo NameInfo
15782 = getDerived().TransformDeclarationNameInfo(
E->getMemberNameInfo());
15783 if (!NameInfo.getName())
15786 if (!
E->hasExplicitTemplateArgs()) {
15789 if (!getDerived().AlwaysRebuild() &&
15790 Base.get() == OldBase &&
15791 BaseType ==
E->getBaseType() &&
15792 QualifierLoc ==
E->getQualifierLoc() &&
15793 NameInfo.getName() ==
E->getMember() &&
15794 FirstQualifierInScope ==
E->getFirstQualifierFoundInScope())
15797 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15800 E->getOperatorLoc(),
15803 FirstQualifierInScope,
15808 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15809 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
15810 E->getNumTemplateArgs(),
15814 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15817 E->getOperatorLoc(),
15820 FirstQualifierInScope,
15825template <
typename Derived>
15826ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
15827 UnresolvedMemberExpr *Old) {
15831 if (!Old->isImplicitAccess()) {
15832 Base = getDerived().TransformExpr(Old->getBase());
15833 if (
Base.isInvalid())
15836 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
15837 if (
Base.isInvalid())
15839 BaseType =
Base.get()->getType();
15841 BaseType = getDerived().TransformType(Old->getBaseType());
15844 NestedNameSpecifierLoc QualifierLoc;
15845 if (Old->getQualifierLoc()) {
15847 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
15852 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
15857 if (TransformOverloadExprDecls(Old,
false, R))
15861 if (Old->getNamingClass()) {
15862 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
15863 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
15867 R.setNamingClass(NamingClass);
15870 TemplateArgumentListInfo TransArgs;
15871 if (Old->hasExplicitTemplateArgs()) {
15872 TransArgs.setLAngleLoc(Old->getLAngleLoc());
15873 TransArgs.setRAngleLoc(Old->getRAngleLoc());
15874 if (getDerived().TransformTemplateArguments(
15875 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
15883 NamedDecl *FirstQualifierInScope =
nullptr;
15885 return getDerived().RebuildUnresolvedMemberExpr(
15886 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
15887 TemplateKWLoc, FirstQualifierInScope, R,
15888 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
15891template<
typename Derived>
15893TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *
E) {
15896 ExprResult SubExpr = getDerived().TransformExpr(
E->getOperand());
15897 if (SubExpr.isInvalid())
15900 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getOperand())
15903 return getDerived().RebuildCXXNoexceptExpr(
E->
getSourceRange(),SubExpr.get());
15906template<
typename Derived>
15908TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *
E) {
15909 ExprResult Pattern = getDerived().TransformExpr(
E->getPattern());
15910 if (Pattern.isInvalid())
15913 if (!getDerived().AlwaysRebuild() && Pattern.get() ==
E->getPattern())
15916 return getDerived().RebuildPackExpansion(Pattern.get(),
E->getEllipsisLoc(),
15917 E->getNumExpansions());
15920template<
typename Derived>
15922TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *
E) {
15932 TemplateArgument ArgStorage;
15935 if (
E->isPartiallySubstituted()) {
15936 PackArgs =
E->getPartialArguments();
15939 bool ShouldExpand =
false;
15940 bool RetainExpansion =
false;
15941 std::optional<unsigned> NumExpansions;
15942 if (getDerived().TryExpandParameterPacks(
E->getOperatorLoc(),
E->getPackLoc(),
15944 ShouldExpand, RetainExpansion,
15950 if (ShouldExpand) {
15951 auto *Pack =
E->getPack();
15952 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
15953 ArgStorage = getSema().Context.getPackExpansionType(
15955 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
15956 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
15958 auto *VD = cast<ValueDecl>(Pack);
15959 ExprResult DRE = getSema().BuildDeclRefExpr(
15960 VD, VD->getType().getNonLValueExprType(getSema().Context),
15963 if (DRE.isInvalid())
15965 ArgStorage =
new (getSema().Context)
15966 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
15967 E->getPackLoc(), std::nullopt);
15969 PackArgs = ArgStorage;
15974 if (!PackArgs.size()) {
15975 auto *Pack = cast_or_null<NamedDecl>(
15976 getDerived().TransformDecl(
E->getPackLoc(),
E->getPack()));
15979 return getDerived().RebuildSizeOfPackExpr(
15980 E->getOperatorLoc(), Pack,
E->getPackLoc(),
E->getRParenLoc(),
15985 std::optional<unsigned>
Result = 0;
15986 for (
const TemplateArgument &Arg : PackArgs) {
15987 if (!Arg.isPackExpansion()) {
15992 TemplateArgumentLoc ArgLoc;
15993 InventTemplateArgumentLoc(Arg, ArgLoc);
15996 SourceLocation Ellipsis;
15997 std::optional<unsigned> OrigNumExpansions;
15998 TemplateArgumentLoc Pattern =
15999 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16000 OrigNumExpansions);
16003 TemplateArgumentLoc OutPattern;
16004 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16005 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
16010 std::optional<unsigned> NumExpansions =
16011 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
16012 if (!NumExpansions) {
16025 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
16027 E->getRParenLoc(), *
Result, {});
16029 TemplateArgumentListInfo TransformedPackArgs(
E->getPackLoc(),
16032 TemporaryBase Rebase(*
this,
E->getPackLoc(), getBaseEntity());
16033 typedef TemplateArgumentLocInventIterator<
16034 Derived,
const TemplateArgument*> PackLocIterator;
16035 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16036 PackLocIterator(*
this, PackArgs.end()),
16037 TransformedPackArgs,
true))
16044 bool PartialSubstitution =
false;
16045 for (
auto &
Loc : TransformedPackArgs.arguments()) {
16046 Args.push_back(
Loc.getArgument());
16047 if (
Loc.getArgument().isPackExpansion())
16048 PartialSubstitution =
true;
16051 if (PartialSubstitution)
16052 return getDerived().RebuildSizeOfPackExpr(
16053 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
16054 std::nullopt, Args);
16056 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
16057 E->getPackLoc(),
E->getRParenLoc(),
16061template <
typename Derived>
16063TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *
E) {
16070 EnterExpressionEvaluationContext ConstantContext(
16072 IndexExpr = getDerived().TransformExpr(
E->getIndexExpr());
16073 if (IndexExpr.isInvalid())
16078 bool FullySubstituted =
true;
16079 if (!
E->expandsToEmptyPack() &&
E->getExpressions().empty()) {
16080 Expr *Pattern =
E->getPackIdExpression();
16082 getSema().collectUnexpandedParameterPacks(
E->getPackIdExpression(),
16084 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16088 bool ShouldExpand =
true;
16089 bool RetainExpansion =
false;
16090 std::optional<unsigned> OrigNumExpansions;
16091 std::optional<unsigned> NumExpansions = OrigNumExpansions;
16092 if (getDerived().TryExpandParameterPacks(
16094 ShouldExpand, RetainExpansion, NumExpansions))
16096 if (!ShouldExpand) {
16097 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16098 ExprResult Pack = getDerived().TransformExpr(Pattern);
16099 if (Pack.isInvalid())
16101 return getDerived().RebuildPackIndexingExpr(
16102 E->getEllipsisLoc(),
E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16105 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16106 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
16107 ExprResult Out = getDerived().TransformExpr(Pattern);
16108 if (Out.isInvalid())
16110 if (Out.get()->containsUnexpandedParameterPack()) {
16111 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
16112 OrigNumExpansions);
16113 if (Out.isInvalid())
16115 FullySubstituted =
false;
16117 ExpandedExprs.push_back(Out.get());
16121 if (RetainExpansion) {
16122 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16124 ExprResult Out = getDerived().TransformExpr(Pattern);
16125 if (Out.isInvalid())
16128 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
16129 OrigNumExpansions);
16130 if (Out.isInvalid())
16132 FullySubstituted =
false;
16133 ExpandedExprs.push_back(Out.get());
16135 }
else if (!
E->expandsToEmptyPack()) {
16136 if (getDerived().TransformExprs(
E->getExpressions().data(),
16137 E->getExpressions().size(),
false,
16142 return getDerived().RebuildPackIndexingExpr(
16143 E->getEllipsisLoc(),
E->getRSquareLoc(),
E->getPackIdExpression(),
16144 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16147template<
typename Derived>
16149TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
16150 SubstNonTypeTemplateParmPackExpr *
E) {
16155template<
typename Derived>
16157TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
16158 SubstNonTypeTemplateParmExpr *
E) {
16163template<
typename Derived>
16165TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *
E) {
16170template <
typename Derived>
16171ExprResult TreeTransform<Derived>::TransformResolvedUnexpandedPackExpr(
16172 ResolvedUnexpandedPackExpr *
E) {
16173 bool ArgumentChanged =
false;
16175 if (TransformExprs(
E->getExprs().begin(),
E->getNumExprs(),
16176 false, NewExprs, &ArgumentChanged))
16179 if (!AlwaysRebuild() && !ArgumentChanged)
16188template<
typename Derived>
16190TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
16191 MaterializeTemporaryExpr *
E) {
16192 return getDerived().TransformExpr(
E->getSubExpr());
16195template<
typename Derived>
16197TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *
E) {
16198 UnresolvedLookupExpr *
Callee =
nullptr;
16199 if (Expr *OldCallee =
E->getCallee()) {
16200 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16201 if (CalleeResult.isInvalid())
16203 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
16206 Expr *Pattern =
E->getPattern();
16209 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16210 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16214 bool Expand =
true;
16215 bool RetainExpansion =
false;
16216 std::optional<unsigned> OrigNumExpansions =
E->getNumExpansions(),
16217 NumExpansions = OrigNumExpansions;
16218 if (getDerived().TryExpandParameterPacks(
E->getEllipsisLoc(),
16221 Expand, RetainExpansion,
16228 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16231 E->getLHS() ? getDerived().TransformExpr(
E->getLHS()) :
ExprResult();
16232 if (LHS.isInvalid())
16236 E->getRHS() ? getDerived().TransformExpr(
E->getRHS()) :
ExprResult();
16237 if (RHS.isInvalid())
16240 if (!getDerived().AlwaysRebuild() &&
16241 LHS.get() ==
E->getLHS() && RHS.get() ==
E->getRHS())
16244 return getDerived().RebuildCXXFoldExpr(
16246 E->getEllipsisLoc(), RHS.get(),
E->
getEndLoc(), NumExpansions);
16252 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
16253 SemaRef.
Diag(
E->getEllipsisLoc(),
16254 clang::diag::err_fold_expression_limit_exceeded)
16255 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16257 SemaRef.
Diag(
E->getEllipsisLoc(), diag::note_bracket_depth);
16266 bool LeftFold =
E->isLeftFold();
16270 if (!LeftFold && RetainExpansion) {
16271 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16273 ExprResult Out = getDerived().TransformExpr(Pattern);
16274 if (Out.isInvalid())
16277 Result = getDerived().RebuildCXXFoldExpr(
16284 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16285 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
16286 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16287 ExprResult Out = getDerived().TransformExpr(Pattern);
16288 if (Out.isInvalid())
16291 if (Out.get()->containsUnexpandedParameterPack()) {
16293 Result = getDerived().RebuildCXXFoldExpr(
16295 E->getOperator(),
E->getEllipsisLoc(),
16297 OrigNumExpansions);
16298 }
else if (
Result.isUsable()) {
16300 Expr *LHS = LeftFold ?
Result.get() : Out.get();
16301 Expr *RHS = LeftFold ? Out.get() :
Result.get();
16303 UnresolvedSet<16> Functions;
16304 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
16305 Result = getDerived().RebuildCXXOperatorCallExpr(
16307 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16308 Functions, LHS, RHS);
16310 Result = getDerived().RebuildBinaryOperator(
E->getEllipsisLoc(),
16311 E->getOperator(), LHS, RHS);
16322 if (LeftFold && RetainExpansion) {
16323 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16325 ExprResult Out = getDerived().TransformExpr(Pattern);
16326 if (Out.isInvalid())
16329 Result = getDerived().RebuildCXXFoldExpr(
16331 E->getEllipsisLoc(), Out.get(),
E->
getEndLoc(), OrigNumExpansions);
16336 if (ParenExpr *PE = dyn_cast_or_null<ParenExpr>(
Result.get()))
16337 PE->setIsProducedByFoldExpansion();
16342 return getDerived().RebuildEmptyCXXFoldExpr(
E->getEllipsisLoc(),
16347template <
typename Derived>
16349TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *
E) {
16352 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16356 return getDerived().RebuildParenListExpr(
E->
getBeginLoc(), TransformedInits,
16360template<
typename Derived>
16362TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
16363 CXXStdInitializerListExpr *
E) {
16364 return getDerived().TransformExpr(
E->getSubExpr());
16367template<
typename Derived>
16369TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *
E) {
16373template<
typename Derived>
16375TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *
E) {
16379template<
typename Derived>
16381TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *
E) {
16382 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
16383 if (SubExpr.isInvalid())
16386 if (!getDerived().AlwaysRebuild() &&
16387 SubExpr.get() ==
E->getSubExpr())
16390 return getDerived().RebuildObjCBoxedExpr(
E->
getSourceRange(), SubExpr.get());
16393template<
typename Derived>
16395TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *
E) {
16398 bool ArgChanged =
false;
16399 if (getDerived().TransformExprs(
E->getElements(),
E->getNumElements(),
16400 false, Elements, &ArgChanged))
16403 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16411template<
typename Derived>
16413TreeTransform<Derived>::TransformObjCDictionaryLiteral(
16414 ObjCDictionaryLiteral *
E) {
16417 bool ArgChanged =
false;
16418 for (
unsigned I = 0, N =
E->getNumElements(); I != N; ++I) {
16419 ObjCDictionaryElement OrigElement =
E->getKeyValueElement(I);
16421 if (OrigElement.isPackExpansion()) {
16424 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16425 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16426 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16430 bool Expand =
true;
16431 bool RetainExpansion =
false;
16432 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
16433 std::optional<unsigned> NumExpansions = OrigNumExpansions;
16434 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16435 OrigElement.Value->getEndLoc());
16436 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
16437 PatternRange, Unexpanded, Expand,
16438 RetainExpansion, NumExpansions))
16445 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16446 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16447 if (Key.isInvalid())
16450 if (Key.get() != OrigElement.Key)
16454 if (
Value.isInvalid())
16457 if (
Value.get() != OrigElement.Value)
16460 ObjCDictionaryElement Expansion = {
16461 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16463 Elements.push_back(Expansion);
16473 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16474 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
16475 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16476 if (Key.isInvalid())
16480 if (
Value.isInvalid())
16483 ObjCDictionaryElement Element = {
16484 Key.get(),
Value.get(), SourceLocation(), NumExpansions
16490 if (Key.get()->containsUnexpandedParameterPack() ||
16491 Value.get()->containsUnexpandedParameterPack())
16492 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16494 Elements.push_back(Element);
16504 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16505 if (Key.isInvalid())
16508 if (Key.get() != OrigElement.Key)
16513 = getDerived().TransformExpr(OrigElement.Value);
16514 if (
Value.isInvalid())
16517 if (
Value.get() != OrigElement.Value)
16520 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
16522 Elements.push_back(Element);
16525 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16528 return getDerived().RebuildObjCDictionaryLiteral(
E->
getSourceRange(),
16532template<
typename Derived>
16534TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *
E) {
16535 TypeSourceInfo *EncodedTypeInfo
16536 = getDerived().TransformType(
E->getEncodedTypeSourceInfo());
16537 if (!EncodedTypeInfo)
16540 if (!getDerived().AlwaysRebuild() &&
16541 EncodedTypeInfo ==
E->getEncodedTypeSourceInfo())
16544 return getDerived().RebuildObjCEncodeExpr(
E->getAtLoc(),
16546 E->getRParenLoc());
16549template<
typename Derived>
16551TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *
E) {
16556 return getDerived().TransformExpr(
E->getSubExpr());
16559template<
typename Derived>
16561TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *
E) {
16562 TypeSourceInfo *TSInfo
16563 = getDerived().TransformType(
E->getTypeInfoAsWritten());
16571 if (!getDerived().AlwaysRebuild() &&
16572 TSInfo ==
E->getTypeInfoAsWritten() &&
16573 Result.get() ==
E->getSubExpr())
16577 E->getLParenLoc(),
E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
16581template <
typename Derived>
16582ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
16583 ObjCAvailabilityCheckExpr *
E) {
16587template<
typename Derived>
16589TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *
E) {
16591 bool ArgChanged =
false;
16593 Args.reserve(
E->getNumArgs());
16594 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
false, Args,
16600 TypeSourceInfo *ReceiverTypeInfo
16601 = getDerived().TransformType(
E->getClassReceiverTypeInfo());
16602 if (!ReceiverTypeInfo)
16606 if (!getDerived().AlwaysRebuild() &&
16607 ReceiverTypeInfo ==
E->getClassReceiverTypeInfo() && !ArgChanged)
16612 E->getSelectorLocs(SelLocs);
16613 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16616 E->getMethodDecl(),
16623 if (!
E->getMethodDecl())
16628 E->getSelectorLocs(SelLocs);
16629 return getDerived().RebuildObjCMessageExpr(
E->getSuperLoc(),
16632 E->getReceiverType(),
16633 E->getMethodDecl(),
16641 "Only class and instance messages may be instantiated");
16643 = getDerived().TransformExpr(
E->getInstanceReceiver());
16644 if (Receiver.isInvalid())
16648 if (!getDerived().AlwaysRebuild() &&
16649 Receiver.get() ==
E->getInstanceReceiver() && !ArgChanged)
16654 E->getSelectorLocs(SelLocs);
16655 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16658 E->getMethodDecl(),
16664template<
typename Derived>
16666TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *
E) {
16670template<
typename Derived>
16672TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *
E) {
16676template<
typename Derived>
16678TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *
E) {
16681 if (
Base.isInvalid())
16687 if (!getDerived().AlwaysRebuild() &&
16688 Base.get() ==
E->getBase())
16691 return getDerived().RebuildObjCIvarRefExpr(
Base.get(),
E->getDecl(),
16693 E->isArrow(),
E->isFreeIvar());
16696template<
typename Derived>
16698TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *
E) {
16701 if (!
E->isObjectReceiver())
16706 if (
Base.isInvalid())
16712 if (!getDerived().AlwaysRebuild() &&
16713 Base.get() ==
E->getBase())
16716 if (
E->isExplicitProperty())
16717 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16718 E->getExplicitProperty(),
16721 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16723 E->getImplicitPropertyGetter(),
16724 E->getImplicitPropertySetter(),
16728template<
typename Derived>
16730TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *
E) {
16733 if (
Base.isInvalid())
16737 ExprResult Key = getDerived().TransformExpr(
E->getKeyExpr());
16738 if (Key.isInvalid())
16742 if (!getDerived().AlwaysRebuild() &&
16743 Key.get() ==
E->getKeyExpr() &&
Base.get() ==
E->getBaseExpr())
16746 return getDerived().RebuildObjCSubscriptRefExpr(
E->getRBracket(),
16747 Base.get(), Key.get(),
16748 E->getAtIndexMethodDecl(),
16749 E->setAtIndexMethodDecl());
16752template<
typename Derived>
16754TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *
E) {
16757 if (
Base.isInvalid())
16761 if (!getDerived().AlwaysRebuild() &&
16762 Base.get() ==
E->getBase())
16765 return getDerived().RebuildObjCIsaExpr(
Base.get(),
E->getIsaMemberLoc(),
16770template<
typename Derived>
16772TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *
E) {
16773 bool ArgumentChanged =
false;
16775 SubExprs.reserve(
E->getNumSubExprs());
16776 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16777 SubExprs, &ArgumentChanged))
16780 if (!getDerived().AlwaysRebuild() &&
16784 return getDerived().RebuildShuffleVectorExpr(
E->getBuiltinLoc(),
16786 E->getRParenLoc());
16789template<
typename Derived>
16791TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *
E) {
16792 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16793 if (SrcExpr.isInvalid())
16796 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
16800 if (!getDerived().AlwaysRebuild() &&
16801 Type ==
E->getTypeSourceInfo() &&
16802 SrcExpr.get() ==
E->getSrcExpr())
16805 return getDerived().RebuildConvertVectorExpr(
E->getBuiltinLoc(),
16806 SrcExpr.get(), Type,
16807 E->getRParenLoc());
16810template<
typename Derived>
16812TreeTransform<Derived>::TransformBlockExpr(BlockExpr *
E) {
16813 BlockDecl *oldBlock =
E->getBlockDecl();
16816 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
16819 blockScope->TheDecl->setBlockMissingReturnType(
16820 oldBlock->blockMissingReturnType());
16825 const FunctionProtoType *exprFunctionType =
E->getFunctionType();
16828 Sema::ExtParameterInfoBuilder extParamInfos;
16829 if (getDerived().TransformFunctionTypeParams(
16830 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
16831 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
16833 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16837 QualType exprResultType =
16838 getDerived().TransformType(exprFunctionType->getReturnType());
16840 auto epi = exprFunctionType->getExtProtoInfo();
16841 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
16844 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
16848 if (!params.empty())
16849 blockScope->TheDecl->setParams(params);
16851 if (!oldBlock->blockMissingReturnType()) {
16852 blockScope->HasImplicitReturnType =
false;
16853 blockScope->ReturnType = exprResultType;
16857 StmtResult body = getDerived().TransformStmt(
E->getBody());
16858 if (body.isInvalid()) {
16859 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16867 for (
const auto &I : oldBlock->captures()) {
16868 VarDecl *oldCapture = I.getVariable();
16871 if (oldCapture->isParameterPack())
16874 VarDecl *newCapture =
16875 cast<VarDecl>(getDerived().TransformDecl(
E->getCaretLocation(),
16877 assert(blockScope->CaptureMap.count(newCapture));
16883 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
16884 "this pointer isn't captured in the old block");
16892template<
typename Derived>
16894TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *
E) {
16895 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16896 if (SrcExpr.isInvalid())
16899 QualType
Type = getDerived().TransformType(
E->
getType());
16902 E->getRParenLoc());
16905template<
typename Derived>
16907TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *
E) {
16908 bool ArgumentChanged =
false;
16910 SubExprs.reserve(
E->getNumSubExprs());
16911 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16912 SubExprs, &ArgumentChanged))
16915 if (!getDerived().AlwaysRebuild() &&
16919 return getDerived().RebuildAtomicExpr(
E->getBuiltinLoc(), SubExprs,
16920 E->getOp(),
E->getRParenLoc());
16927template<
typename Derived>
16931 getDerived().getBaseEntity());
16934template<
typename Derived>
16938 getDerived().getBaseEntity());
16941template<
typename Derived>
16944 bool WrittenAsLValue,
16947 Sigil, getDerived().getBaseEntity());
16950template<
typename Derived>
16956 getDerived().getBaseEntity());
16959template<
typename Derived>
16967 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16971template<
typename Derived>
16983 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
16984 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16989template<
typename Derived>
16996template <
typename Derived>
16999 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17000 if (SizeExpr || !Size)
17002 IndexTypeQuals, BracketsRange,
17003 getDerived().getBaseEntity());
17011 for (
const auto &
T : Types)
17023 IndexTypeQuals, BracketsRange,
17024 getDerived().getBaseEntity());
17027template <
typename Derived>
17030 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17031 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17032 IndexTypeQuals, BracketsRange);
17035template <
typename Derived>
17039 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17040 IndexTypeQuals, BracketsRange);
17043template <
typename Derived>
17046 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17047 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17049 IndexTypeQuals, BracketsRange);
17052template <
typename Derived>
17055 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17056 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17058 IndexTypeQuals, BracketsRange);
17061template <
typename Derived>
17068template <
typename Derived>
17070 unsigned NumElements,
17076template <
typename Derived>
17083template<
typename Derived>
17085 unsigned NumElements,
17088 NumElements,
true);
17095template<
typename Derived>
17103template <
typename Derived>
17105 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17110template <
typename Derived>
17118template <
typename Derived>
17123 getDerived().getBaseLocation(),
17124 getDerived().getBaseEntity(),
17128template<
typename Derived>
17133template<
typename Derived>
17136 assert(
D &&
"no decl found");
17140 if (
auto *UPD = dyn_cast<UsingPackDecl>(
D)) {
17144 if (UPD->expansions().empty()) {
17145 getSema().Diag(
Loc, diag::err_using_pack_expansion_empty)
17146 << UPD->isCXXClassMember() << UPD;
17155 for (
auto *
E : UPD->expansions()) {
17161 else if (
T.isNull())
17165 "mismatched resolved types in using pack expansion");
17167 return T.isNull() ? FallbackT :
T;
17168 }
else if (
auto *Using = dyn_cast<UsingDecl>(
D)) {
17169 assert(Using->hasTypename() &&
17170 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17173 assert(++Using->shadow_begin() == Using->shadow_end());
17182 assert(isa<UnresolvedUsingTypenameDecl>(
D) &&
17183 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17185 cast<UnresolvedUsingTypenameDecl>(
D));
17189template <
typename Derived>
17195template<
typename Derived>
17201template <
typename Derived>
17206template <
typename Derived>
17212 FullySubstituted, Expansions);
17215template<
typename Derived>
17222template<
typename Derived>
17230template<
typename Derived>
17236template<
typename Derived>
17244template <
typename Derived>
17255template <
typename Derived>
17261template<
typename Derived>
17270template<
typename Derived>
17278 bool AllowInjectedClassName) {
17282 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17285 AllowInjectedClassName);
17286 return Template.
get();
17289template<
typename Derived>
17296 bool AllowInjectedClassName) {
17299 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17300 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
17302 getSema().ActOnTemplateName(
17304 false, Template, AllowInjectedClassName);
17305 return Template.
get();
17308template <
typename Derived>
17313 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17319 Opc,
First, Second);
17334 if (Op == OO_Subscript) {
17335 if (!
First->getType()->isOverloadableType() &&
17337 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17339 }
else if (Op == OO_Arrow) {
17342 if (
First->getType()->isDependentType())
17346 }
else if (Second ==
nullptr || isPostIncDec) {
17347 if (!
First->getType()->isOverloadableType() ||
17348 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
17355 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17359 !
First->getType()->isOverloadableType() &&
17374 if (!Second || isPostIncDec) {
17384 First, Second, RequiresADL);
17391template<
typename Derived>
17406 ->template getAs<RecordType>())){
17409 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17410 CCLoc, TildeLoc, Destroyed);
17422 if (!ScopeType->getType()->getAs<
TagType>()) {
17423 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17424 diag::err_expected_class_or_namespace)
17425 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
17433 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
17434 OperatorLoc, isArrow,
17442template<
typename Derived>
17450 for (
unsigned I = 0; I < NumParams; ++I) {
17451 if (I != ContextParamPos) {
17457 Params.push_back(std::make_pair(StringRef(), QualType()));
17460 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
17461 S->getCapturedRegionKind(), Params);
17464 Sema::CompoundScopeRAII CompoundScope(getSema());
17465 Body = getDerived().TransformStmt(S->getCapturedStmt());
17468 if (Body.isInvalid()) {
17469 getSema().ActOnCapturedRegionError();
17473 return getSema().ActOnCapturedRegionEnd(Body.get());
17476template <
typename Derived>
17478TreeTransform<Derived>::TransformSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
17482 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17486template <
typename Derived>
17487ExprResult TreeTransform<Derived>::TransformHLSLOutArgExpr(HLSLOutArgExpr *
E) {
17490 return getDerived().TransformExpr(
E->getArgLValue());
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Target Target
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
DeclarationNameTable DeclarationNames
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex, SubstTemplateTypeParmTypeFlag Flag=SubstTemplateTypeParmTypeFlag::None) const
Retrieve a substitution-result type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CanQualType PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
CanQualType UnsignedInt128Ty
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getRParenLoc() const
TypeLoc getValueLoc() const
SourceLocation getKWLoc() const
SourceLocation getLParenLoc() const
Attr - This represents one attribute.
attr::Kind getKind() const
Represents an attribute applied to a statement.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
void setIsVariadic(bool value)
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
Represents binding an expression to a temporary.
CXXCatchStmt - This represents a C++ catch block.
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
Represents a call to an inherited base class constructor from an inheriting constructor.
Abstract class common to all of the C++ "named"/"keyword" casts.
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
SourceLocation getBegin() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
The name of a declaration.
@ CXXConversionFunctionName
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a dependent template name that cannot be resolved prior to template instantiation.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
SourceLocation getTemplateNameLoc() const
SourceLocation getLAngleLoc() const
void setTemplateKeywordLoc(SourceLocation Loc)
SourceLocation getTemplateKeywordLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
SourceLocation getRAngleLoc() const
SourceLocation getElaboratedKeywordLoc() const
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
Represents a template specialization type whose template cannot be resolved, e.g.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
TypeLoc getNamedTypeLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
RAII object that enters a new expression evaluation context.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
QualType getCallResultType() const
Determine the type of an expression that calls this function.
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present,...
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
QualType getReturnType() const
AssociationTy< false > Association
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
const TypeClass * getTypePtr() const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This represents clauses with a list of expressions that are mappable.
ObjCIvarDecl - Represents an ObjC instance variable.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
bool isInstanceMethod() const
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents the declaration of an Objective-C type parameter.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Wrapper for void* pointer.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
Represents a pack expansion of types.
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
static ResolvedUnexpandedPackExpr * Create(ASTContext &C, SourceLocation BeginLoc, QualType T, unsigned NumExprs)
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
OpenACCDirectiveKind getDirectiveKind() const
SourceLocation getEndLoc() const
void setLParenLoc(SourceLocation EndLoc)
void setConditionDetails(Expr *ConditionExpr)
void setCollapseDetails(bool IsForce, Expr *LoopCount)
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
void setDefaultDetails(OpenACCDefaultClauseKind DefKind)
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
void setWaitDetails(Expr *DevNum, SourceLocation QueuesLoc, llvm::SmallVector< Expr * > &&IntExprs)
void setEndLoc(SourceLocation EndLoc)
Expr * getLoopCount() const
void setIntExprDetails(ArrayRef< Expr * > IntExprs)
OpenACCDefaultClauseKind getDefaultClauseKind() const
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
ExprResult checkAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
QualType BuildParenType(QualType T)
Build a paren type including T.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
static std::enable_if_t< std::is_base_of_v< Attr, AttrInfo >, SourceLocation > getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
@ IER_DoesNotExist
The symbol does not exist.
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ IER_Error
An error occurred.
@ IER_Exists
The symbol exists.
void ActOnStartStmtExpr()
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
std::optional< FunctionEffectMode > ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName)
Try to parse the conditional expression attached to an effect attribute (e.g.
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
ConvertVectorExpr - Handle __builtin_convertvector.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
DeclContext * getCurLexicalContext() const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
@ TryCapture_ExplicitByVal
@ TryCapture_ExplicitByRef
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
bool CheckRebuiltStmtAttributes(ArrayRef< const Attr * > Attrs)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, const FunctionEffectWithCondition &EC, SourceLocation NewAttrLoc)
Warn and return true if adding a function effect to a set would create a conflict.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
ExprResult BuiltinShuffleVector(CallExpr *TheCall)
BuiltinShuffleVector - Handle __builtin_shufflevector.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, std::optional< unsigned > Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
A structure for storing an already-substituted template template parameter pack.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
TypeSourceInfo * getTypeSourceInfo() const
SourceRange getSourceRange() const LLVM_READONLY
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getSourceExpression() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
SourceLocation getTemplateNameLoc() const
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
Wrapper for template type parameters.
The top declaration context.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
SourceLocation getTemplateKeywordLoc() const
Get the SourceLocation of the template keyword (if any).
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
ElaboratedTypeKeyword getKeyword() const
The base class of the type hierarchy.
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isFunctionType() const
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
TypedefNameDecl * getTypedefNameDecl() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
A set of unresolved declarations.
void addDecl(NamedDecl *D)
A set of unresolved declarations.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
bool Inc(InterpState &S, CodePtr OpPC)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
ArrayTypeTrait
Names for the array type traits.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, ResolvedUnexpandedPackExpr * >, SourceLocation > UnexpandedParameterPack
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
ActionResult< Expr * > ExprResult
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
ActionResult< Stmt * > StmtResult
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
const FunctionProtoType * T
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
MutableArrayRef< Expr * > MultiExprArg
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
This structure contains most locations needed for by an OMPVarListClause.
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.