13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
47#include "llvm/ADT/ArrayRef.h"
48#include "llvm/Support/ErrorHandling.h"
52using namespace llvm::omp;
108template<
typename Derived>
113 class ForgetPartiallySubstitutedPackRAII {
121 ForgetPartiallySubstitutedPackRAII(Derived &Self)
122 : Self(Self), ResetPackSubstIndex(Self.getSema(), -1) {
123 Old = Self.ForgetPartiallySubstitutedPack();
126 ~ForgetPartiallySubstitutedPackRAII() {
127 Self.RememberPartiallySubstitutedPack(Old);
144 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
148 return static_cast<const Derived&
>(*this);
213 OldLocation = Self.getDerived().getBaseLocation();
214 OldEntity = Self.getDerived().getBaseEntity();
217 Self.getDerived().setBase(Location, Entity);
221 Self.getDerived().setBase(OldLocation, OldEntity);
251 return E->isDefaultArgument();
294 bool &ShouldExpand,
bool &RetainExpansion,
295 std::optional<unsigned> &NumExpansions) {
296 ShouldExpand =
false;
411 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
412#include "clang/Basic/AttrList.inc"
422 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
423 const X##Attr *A) { \
424 return getDerived().Transform##X##Attr(A); \
426#include "clang/Basic/AttrList.inc"
472 bool *ArgChanged =
nullptr);
481 llvm::DenseMap<Decl *, Decl *>::iterator Known
484 return Known->second;
512 assert(New.size() == 1 &&
513 "must override transformedLocalDecl if performing pack expansion");
551 NamedDecl *FirstQualifierInScope =
nullptr);
596 NamedDecl *FirstQualifierInScope =
nullptr,
597 bool AllowInjectedClassName =
false);
609 bool Uneval =
false);
632 bool Uneval =
false) {
651 template<
typename InputIterator>
655 bool Uneval =
false);
667#define ABSTRACT_TYPELOC(CLASS, PARENT)
668#define TYPELOC(CLASS, PARENT) \
669 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
670#include "clang/AST/TypeLocNodes.def"
674 bool SuppressObjCLifetime);
678 bool SuppressObjCLifetime);
680 template<
typename Fn>
733 return getDerived().TransformFunctionTypeParams(
734 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
752 KWLoc, Params,
nullptr,
753 nullptr, PTypes, &TransParams, PInfos))
766 std::optional<unsigned> NumExpansions,
767 bool ExpectParameterPack);
794 bool IsAddressOfOperand,
802 bool IsAddressOfOperand);
810#define STMT(Node, Parent) \
811 LLVM_ATTRIBUTE_NOINLINE \
812 StmtResult Transform##Node(Node *S);
813#define VALUESTMT(Node, Parent) \
814 LLVM_ATTRIBUTE_NOINLINE \
815 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
816#define EXPR(Node, Parent) \
817 LLVM_ATTRIBUTE_NOINLINE \
818 ExprResult Transform##Node(Node *E);
819#define ABSTRACT_STMT(Stmt)
820#include "clang/AST/StmtNodes.inc"
822#define GEN_CLANG_CLAUSE_CLASS
823#define CLAUSE_CLASS(Enum, Str, Class) \
824 LLVM_ATTRIBUTE_NOINLINE \
825 OMPClause *Transform##Class(Class *S);
826#include "llvm/Frontend/OpenMP/OMP.inc"
903 const llvm::APInt *Size,
Expr *SizeExpr,
904 unsigned IndexTypeQuals,
SourceRange BracketsRange);
913 const llvm::APInt &Size,
Expr *SizeExpr,
914 unsigned IndexTypeQuals,
924 unsigned IndexTypeQuals,
934 unsigned IndexTypeQuals,
945 unsigned IndexTypeQuals,
983 unsigned NumColumns);
1000 Expr *AddrSpaceExpr,
1070 bool FullySubstituted,
1084 TypeConstraintConcept,
1085 TypeConstraintArgs);
1093 Template, Deduced,
false);
1139 bool AllowInjectedClassName) {
1143 SS.
Adopt(QualifierLoc);
1145 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1146 AllowInjectedClassName);
1160 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1177 bool DeducedTSTContext) {
1179 SS.
Adopt(QualifierLoc);
1192 *
Id, IdLoc, DeducedTSTContext);
1210 switch (
Result.getResultKind()) {
1221 llvm_unreachable(
"Tag lookup cannot find non-tags");
1233 switch (
Result.getResultKind()) {
1239 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1240 << SomeDecl << NTK << llvm::to_underlying(Kind);
1246 << llvm::to_underlying(Kind) <<
Id << DC
1255 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1256 SemaRef.
Diag(Tag->getLocation(), diag::note_previous_use);
1273 std::optional<unsigned> NumExpansions) {
1318 bool AllowInjectedClassName);
1331 bool AllowInjectedClassName);
1341 Decl *AssociatedDecl,
unsigned Index,
1344 ArgPack, AssociatedDecl, Index, Final);
1422 Then, ElseLoc, Else);
1476 Inc, RParenLoc, Body);
1521 bool IsVolatile,
unsigned NumOutputs,
1528 NumInputs, Names, Constraints, Exprs,
1529 AsmString, Clobbers, NumLabels, RParenLoc);
1538 StringRef AsmString,
1539 unsigned NumOutputs,
unsigned NumInputs,
1545 NumOutputs, NumInputs,
1546 Constraints, Clobbers, Exprs, EndLoc);
1575 CoawaitLoc, Operand, OpCoawaitLookup);
1579 Suspend.
get(),
true);
1680 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1692 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1706 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1817 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1830 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1843 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1894 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1921 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1922 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1936 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1937 ReductionId, UnresolvedReductions);
1952 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1953 ReductionId, UnresolvedReductions);
1966 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1967 StepModifierLoc, EndLoc);
1980 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2040 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2053 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2068 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2069 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2070 ColonLoc, VarList, Locs,
2071 false, UnresolvedMappers);
2086 Allocate, ACModifier, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2134 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2147 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2182 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2197 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2198 ColonLoc, VarList, Locs, UnresolvedMappers);
2213 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2214 ColonLoc, VarList, Locs, UnresolvedMappers);
2265 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2312 StartLoc, LParenLoc, EndLoc,
Data);
2325 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2337 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2350 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2361 LParenLoc, VarLoc, EndLoc);
2373 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2512 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2560 ForLoc, Element, Collection, RParenLoc);
2578 StartLoc, IdLoc,
Id);
2616 if (RangeStmt->isSingleDecl()) {
2617 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2618 if (RangeVar->isInvalidDecl())
2621 Expr *RangeExpr = RangeVar->getInit();
2628 diag::err_objc_for_range_init_stmt)
2629 <<
Init->getSourceRange();
2632 ForLoc, LoopVar, RangeExpr, RParenLoc);
2639 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2653 QualifierLoc, NameInfo, Nested);
2715 SS.
Adopt(QualifierLoc);
2827 if (IsOMPArraySection)
2829 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2830 Stride, RBracketLoc);
2832 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2833 "Stride/second colon not allowed for OpenACC");
2836 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2848 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2860 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2870 Expr *ExecConfig =
nullptr) {
2872 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2879 nullptr, Callee, LParenLoc, Args, RParenLoc);
2897 if (!
Member->getDeclName()) {
2901 assert(
Member->getType()->isRecordType() &&
2902 "unnamed member not of record type?");
2915 if (!isArrow &&
Base->isPRValue()) {
2924 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2930 SS.
Adopt(QualifierLoc);
2933 if (
Base->containsErrors())
2947 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2948 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2949 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2952 ->getAsCXXRecordDecl()) {
2953 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2956 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2964 FirstQualifierInScope,
2965 R, ExplicitTemplateArgs,
3143 Expr *ControllingExpr,
3148 ControllingExpr, Types, Exprs);
3163 ControllingType, Types, Exprs);
3196 case Stmt::CXXStaticCastExprClass:
3197 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3198 RAngleLoc, LParenLoc,
3199 SubExpr, RParenLoc);
3201 case Stmt::CXXDynamicCastExprClass:
3202 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3203 RAngleLoc, LParenLoc,
3204 SubExpr, RParenLoc);
3206 case Stmt::CXXReinterpretCastExprClass:
3207 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3208 RAngleLoc, LParenLoc,
3212 case Stmt::CXXConstCastExprClass:
3213 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3214 RAngleLoc, LParenLoc,
3215 SubExpr, RParenLoc);
3217 case Stmt::CXXAddrspaceCastExprClass:
3218 return getDerived().RebuildCXXAddrspaceCastExpr(
3219 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3222 llvm_unreachable(
"Invalid C++ named cast");
3300 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3312 bool ListInitialization) {
3316 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3318 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3319 RParenLoc, ListInitialization);
3322 ListInitialization);
3386 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3396 bool IsThrownVariableInScope) {
3406 Expr *RewrittenExpr) {
3408 RewrittenExpr,
getSema().CurContext);
3442 std::optional<Expr *> ArraySize,
3461 bool IsGlobalDelete,
3512 bool IsAddressOfOperand,
3515 SS.
Adopt(QualifierLoc);
3517 if (TemplateArgs || TemplateKWLoc.
isValid())
3519 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3522 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3544 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3545 bool ListInitialization,
bool StdInitListInitialization,
3551 if (Constructor->isInheritingConstructor())
3552 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3555 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3562 HadMultipleCandidates,
3564 StdInitListInitialization,
3565 RequiresZeroInit, ConstructKind,
3573 bool ConstructsVBase,
3574 bool InheritedFromVBase) {
3576 Loc,
T, Constructor, ConstructsVBase, InheritedFromVBase);
3587 bool ListInitialization) {
3589 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3600 bool ListInitialization) {
3602 RParenLoc, ListInitialization);
3619 SS.
Adopt(QualifierLoc);
3622 OperatorLoc, IsArrow,
3624 FirstQualifierInScope,
3626 TemplateArgs,
nullptr);
3642 SS.
Adopt(QualifierLoc);
3645 OperatorLoc, IsArrow,
3647 FirstQualifierInScope,
3648 R, TemplateArgs,
nullptr);
3663 std::optional<unsigned> Length,
3666 RParenLoc, Length, PartialArgs);
3671 Expr *PackIdExpression,
Expr *IndexExpr,
3673 bool FullySubstituted =
false) {
3675 IndexExpr, RSquareLoc, ExpandedExprs,
3705 NamedConcept, TALI);
3723 LocalParameters, RParenLoc, Requirements,
3777 Expr **Elements,
unsigned NumElements) {
3787 RB,
Base, Key, getterMethod, setterMethod);
3819 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3834 Sel, Method, LBracLoc,
3835 SelectorLocs, RBracLoc, Args);
3849 nullptr, SuperType, SuperLoc, Sel, Method, LBracLoc,
3850 SelectorLocs, RBracLoc, Args)
3852 Sel, Method, LBracLoc,
3853 SelectorLocs, RBracLoc, Args);
3862 bool IsArrow,
bool IsFreeIvar) {
3871 if (IsFreeIvar &&
Result.isUsable())
3872 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3908 PropertyLoc,
Base));
3940 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3949 CK_BuiltinFnToFnPtr).
get();
3975 std::optional<unsigned> NumExpansions) {
3980 EllipsisLoc, NumExpansions);
4002 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4023 std::optional<unsigned> NumExpansions) {
4036 std::optional<unsigned> NumExpansions) {
4038 EllipsisLoc, RHS, RParenLoc,
4047 Init->containsUnexpandedParameterPack();
4048 else if (PVD->hasUninstantiatedDefaultArg())
4050 PVD->getUninstantiatedDefaultArg()
4051 ->containsUnexpandedParameterPack();
4178 Exprs.push_back(DevNumExpr);
4179 Exprs.insert(Exprs.end(), QueueIdExprs.begin(), QueueIdExprs.end());
4182 Exprs, RParenLoc, EndLoc, Clauses, {});
4206 bool DeducibleTSTContext);
4218template <
typename Derived>
4223 switch (S->getStmtClass()) {
4228#define STMT(Node, Parent) \
4229 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4230#define VALUESTMT(Node, Parent) \
4231 case Stmt::Node##Class: \
4232 return getDerived().Transform##Node(cast<Node>(S), SDK);
4233#define ABSTRACT_STMT(Node)
4234#define EXPR(Node, Parent)
4235#include "clang/AST/StmtNodes.inc"
4238#define STMT(Node, Parent)
4239#define ABSTRACT_STMT(Stmt)
4240#define EXPR(Node, Parent) case Stmt::Node##Class:
4241#include "clang/AST/StmtNodes.inc"
4243 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4245 if (SDK == SDK_StmtExprResult)
4246 E = getSema().ActOnStmtExprResult(
E);
4247 return getSema().ActOnExprStmt(
E, SDK == SDK_Discarded);
4254template<
typename Derived>
4259 switch (S->getClauseKind()) {
4262#define GEN_CLANG_CLAUSE_CLASS
4263#define CLAUSE_CLASS(Enum, Str, Class) \
4265 return getDerived().Transform##Class(cast<Class>(S));
4266#include "llvm/Frontend/OpenMP/OMP.inc"
4273template<
typename Derived>
4280#define STMT(Node, Parent) case Stmt::Node##Class: break;
4281#define ABSTRACT_STMT(Stmt)
4282#define EXPR(Node, Parent) \
4283 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4284#include "clang/AST/StmtNodes.inc"
4290template<
typename Derived>
4298 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4299 Init = FE->getSubExpr();
4301 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4307 Init = MTE->getSubExpr();
4310 Init = Binder->getSubExpr();
4313 Init = ICE->getSubExprAsWritten();
4316 dyn_cast<CXXStdInitializerListExpr>(
Init))
4317 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4324 return getDerived().TransformExpr(
Init);
4329 return getDerived().RebuildParenListExpr(
Parens.getBegin(), {},
4334 if (isa<ImplicitValueInitExpr>(
Init))
4340 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4341 return getDerived().TransformExpr(
Init);
4346 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4353 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4354 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4355 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4356 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4358 bool ArgChanged =
false;
4360 true, NewArgs, &ArgChanged))
4365 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4370 if (
Parens.isInvalid()) {
4373 assert(NewArgs.empty() &&
4374 "no parens or braces but have direct init with arguments?");
4377 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4381template<
typename Derived>
4387 for (
unsigned I = 0; I != NumInputs; ++I) {
4389 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4397 Expr *Pattern = Expansion->getPattern();
4400 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4401 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4406 bool RetainExpansion =
false;
4407 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4408 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4409 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4412 Expand, RetainExpansion,
4421 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4425 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4426 Expansion->getEllipsisLoc(),
4428 if (Out.isInvalid())
4433 Outputs.push_back(Out.get());
4439 if (ArgChanged) *ArgChanged =
true;
4443 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4445 ExprResult Out = getDerived().TransformExpr(Pattern);
4446 if (Out.isInvalid())
4449 if (Out.get()->containsUnexpandedParameterPack()) {
4450 Out = getDerived().RebuildPackExpansion(
4451 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4452 if (Out.isInvalid())
4456 Outputs.push_back(Out.get());
4461 if (RetainExpansion) {
4462 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4464 ExprResult Out = getDerived().TransformExpr(Pattern);
4465 if (Out.isInvalid())
4468 Out = getDerived().RebuildPackExpansion(
4469 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4470 if (Out.isInvalid())
4473 Outputs.push_back(Out.get());
4480 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4481 : getDerived().TransformExpr(Inputs[I]);
4485 if (
Result.get() != Inputs[I] && ArgChanged)
4488 Outputs.push_back(
Result.get());
4494template <
typename Derived>
4498 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4499 getDerived().TransformDefinition(Var->
getLocation(), Var));
4504 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4513 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4520template <
typename Derived>
4528 Qualifier = Qualifier.getPrefix())
4544 SS, FirstQualifierInScope,
false))
4551 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4559 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4574 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4583 FirstQualifierInScope, SS);
4593 diag::warn_cxx98_compat_enum_nested_name_spec);
4596 SS.
Adopt(ETL.getQualifierLoc());
4597 TL = ETL.getNamedTypeLoc();
4616 FirstQualifierInScope =
nullptr;
4622 !getDerived().AlwaysRebuild())
4635template<
typename Derived>
4643 switch (Name.getNameKind()) {
4654 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4655 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4656 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4672 NewTInfo = getDerived().TransformType(OldTInfo);
4680 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4696 llvm_unreachable(
"Unknown name kind.");
4699template<
typename Derived>
4706 bool AllowInjectedClassName) {
4708 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4709 assert(Template &&
"qualified template name must refer to a template");
4712 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4717 if (!getDerived().AlwaysRebuild() &&
4719 TransTemplate == Template)
4722 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4730 FirstQualifierInScope =
nullptr;
4733 if (!getDerived().AlwaysRebuild() &&
4741 if (DTN->isIdentifier()) {
4742 return getDerived().RebuildTemplateName(SS,
4744 *DTN->getIdentifier(),
4747 FirstQualifierInScope,
4748 AllowInjectedClassName);
4751 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4752 DTN->getOperator(), NameLoc,
4753 ObjectType, AllowInjectedClassName);
4757 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4759 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4764 return getDerived().RebuildTemplateName(SS,
false,
4769 = Name.getAsSubstTemplateTemplateParmPack()) {
4770 return getDerived().RebuildTemplateName(
4771 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4772 SubstPack->getIndex(), SubstPack->getFinal());
4776 llvm_unreachable(
"overloaded function decl survived to here");
4779template<
typename Derived>
4783 Output = getSema().getTrivialTemplateArgumentLoc(
4784 Arg,
QualType(), getDerived().getBaseLocation());
4787template <
typename Derived>
4795 llvm_unreachable(
"Unexpected TemplateArgument");
4805 QualType NewT = getDerived().TransformType(
T);
4812 ValueDecl *NewD =
D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4813 getDerived().getBaseLocation(),
D))
4818 if (NewT ==
T &&
D == NewD)
4835 llvm_unreachable(
"unexpected template argument kind");
4845 DI = getDerived().TransformType(DI);
4856 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4862 SS.
Adopt(QualifierLoc);
4863 TemplateName Template = getDerived().TransformTemplateName(
4874 llvm_unreachable(
"Caller should expand pack expansions");
4889 ExprResult E = getDerived().TransformExpr(InputExpr);
4904template<
typename Derived,
typename InputIterator>
4912 typedef typename std::iterator_traits<InputIterator>::difference_type
4942 Self.InventTemplateArgumentLoc(*
Iter,
Result);
4950 return X.Iter == Y.Iter;
4955 return X.Iter != Y.Iter;
4959template<
typename Derived>
4960template<
typename InputIterator>
4977 if (TransformTemplateArguments(PackLocIterator(*
this,
4978 In.getArgument().pack_begin()),
4979 PackLocIterator(*
this,
4980 In.getArgument().pack_end()),
4987 if (In.getArgument().isPackExpansion()) {
4991 std::optional<unsigned> OrigNumExpansions;
4993 = getSema().getTemplateArgumentPackExpansionPattern(
4994 In, Ellipsis, OrigNumExpansions);
4997 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4998 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5003 bool RetainExpansion =
false;
5004 std::optional<unsigned> NumExpansions = OrigNumExpansions;
5005 if (getDerived().TryExpandParameterPacks(Ellipsis,
5019 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
5022 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
5024 if (Out.getArgument().isNull())
5033 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5036 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
5039 if (Out.getArgument().containsUnexpandedParameterPack()) {
5040 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
5042 if (Out.getArgument().isNull())
5051 if (RetainExpansion) {
5052 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5054 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
5057 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
5059 if (Out.getArgument().isNull())
5069 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
5083template<
typename Derived>
5085 if (getDerived().AlreadyTransformed(
T))
5091 getDerived().getBaseLocation());
5101template<
typename Derived>
5105 getDerived().getBaseEntity());
5106 if (getDerived().AlreadyTransformed(DI->
getType()))
5121template<
typename Derived>
5124 switch (
T.getTypeLocClass()) {
5125#define ABSTRACT_TYPELOC(CLASS, PARENT)
5126#define TYPELOC(CLASS, PARENT) \
5127 case TypeLoc::CLASS: \
5128 return getDerived().Transform##CLASS##Type(TLB, \
5129 T.castAs<CLASS##TypeLoc>());
5130#include "clang/AST/TypeLocNodes.def"
5133 llvm_unreachable(
"unhandled type loc!");
5136template<
typename Derived>
5138 if (!isa<DependentNameType>(
T))
5139 return TransformType(
T);
5141 if (getDerived().AlreadyTransformed(
T))
5144 getDerived().getBaseLocation());
5145 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5149template<
typename Derived>
5152 if (!isa<DependentNameType>(DI->
getType()))
5153 return TransformType(DI);
5157 getDerived().getBaseEntity());
5158 if (getDerived().AlreadyTransformed(DI->
getType()))
5178 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5187template<
typename Derived>
5192 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5193 auto SuppressObjCLifetime =
5194 T.getType().getLocalQualifiers().hasObjCLifetime();
5196 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5197 SuppressObjCLifetime);
5198 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5199 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5200 TLB, STTP, SuppressObjCLifetime);
5202 Result = getDerived().TransformType(TLB, UnqualTL);
5221template <
typename Derived>
5231 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5262 else if (
T.getObjCLifetime()) {
5267 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5283 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5292template<
typename Derived>
5298 if (getDerived().AlreadyTransformed(TL.
getType()))
5302 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5308template<
typename Derived>
5310TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5311 QualType ObjectType,
5312 NamedDecl *UnqualLookup,
5314 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5317 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5321template <
typename Derived>
5322TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5323 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5325 QualType
T = TL.getType();
5326 assert(!getDerived().AlreadyTransformed(
T));
5331 if (isa<TemplateSpecializationType>(
T)) {
5332 TemplateSpecializationTypeLoc SpecTL =
5333 TL.castAs<TemplateSpecializationTypeLoc>();
5335 TemplateName Template = getDerived().TransformTemplateName(
5336 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5337 ObjectType, UnqualLookup,
true);
5338 if (Template.isNull())
5341 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5343 }
else if (isa<DependentTemplateSpecializationType>(
T)) {
5344 DependentTemplateSpecializationTypeLoc SpecTL =
5345 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5347 TemplateName Template
5348 = getDerived().RebuildTemplateName(SS,
5349 SpecTL.getTemplateKeywordLoc(),
5350 *SpecTL.getTypePtr()->getIdentifier(),
5351 SpecTL.getTemplateNameLoc(),
5352 ObjectType, UnqualLookup,
5354 if (Template.isNull())
5357 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5363 Result = getDerived().TransformType(TLB, TL);
5372template <
class TyLoc>
static inline
5374 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5375 NewT.setNameLoc(
T.getNameLoc());
5379template<
typename Derived>
5380QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5382 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5383 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5384 if (
T.needsExtraLocalData())
5385 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5389template<
typename Derived>
5390QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5396template <
typename Derived>
5397QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5398 AdjustedTypeLoc TL) {
5400 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5403template<
typename Derived>
5404QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5405 DecayedTypeLoc TL) {
5406 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5407 if (OriginalType.isNull())
5410 QualType
Result = TL.getType();
5411 if (getDerived().AlwaysRebuild() ||
5412 OriginalType != TL.getOriginalLoc().getType())
5414 TLB.push<DecayedTypeLoc>(
Result);
5419template <
typename Derived>
5421TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5422 ArrayParameterTypeLoc TL) {
5423 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5424 if (OriginalType.isNull())
5427 QualType
Result = TL.getType();
5428 if (getDerived().AlwaysRebuild() ||
5429 OriginalType != TL.getElementLoc().getType())
5431 TLB.push<ArrayParameterTypeLoc>(
Result);
5436template<
typename Derived>
5437QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5438 PointerTypeLoc TL) {
5439 QualType PointeeType
5440 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5441 if (PointeeType.isNull())
5444 QualType
Result = TL.getType();
5445 if (PointeeType->getAs<ObjCObjectType>()) {
5452 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5453 NewT.setStarLoc(TL.getStarLoc());
5457 if (getDerived().AlwaysRebuild() ||
5458 PointeeType != TL.getPointeeLoc().getType()) {
5459 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5466 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5468 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5469 NewT.setSigilLoc(TL.getSigilLoc());
5473template<
typename Derived>
5475TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5476 BlockPointerTypeLoc TL) {
5477 QualType PointeeType
5478 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5479 if (PointeeType.isNull())
5482 QualType
Result = TL.getType();
5483 if (getDerived().AlwaysRebuild() ||
5484 PointeeType != TL.getPointeeLoc().getType()) {
5485 Result = getDerived().RebuildBlockPointerType(PointeeType,
5491 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5492 NewT.setSigilLoc(TL.getSigilLoc());
5500template<
typename Derived>
5508 if (PointeeType.
isNull())
5512 if (getDerived().AlwaysRebuild() ||
5513 PointeeType !=
T->getPointeeTypeAsWritten()) {
5514 Result = getDerived().RebuildReferenceType(PointeeType,
5515 T->isSpelledAsLValue(),
5528 if (isa<LValueReferenceType>(
Result))
5537template<
typename Derived>
5541 return TransformReferenceType(TLB, TL);
5544template<
typename Derived>
5546TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5547 RValueReferenceTypeLoc TL) {
5548 return TransformReferenceType(TLB, TL);
5551template<
typename Derived>
5553TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5554 MemberPointerTypeLoc TL) {
5555 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5556 if (PointeeType.isNull())
5559 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5560 TypeSourceInfo *NewClsTInfo =
nullptr;
5562 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5567 const MemberPointerType *
T = TL.getTypePtr();
5568 QualType OldClsType = QualType(
T->getClass(), 0);
5569 QualType NewClsType;
5571 NewClsType = NewClsTInfo->getType();
5573 NewClsType = getDerived().TransformType(OldClsType);
5574 if (NewClsType.isNull())
5578 QualType
Result = TL.getType();
5579 if (getDerived().AlwaysRebuild() ||
5581 NewClsType != OldClsType) {
5582 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5590 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5591 if (MPT && PointeeType != MPT->getPointeeType()) {
5592 assert(isa<AdjustedType>(MPT->getPointeeType()));
5593 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5596 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5597 NewTL.setSigilLoc(TL.getSigilLoc());
5598 NewTL.setClassTInfo(NewClsTInfo);
5603template<
typename Derived>
5605TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5606 ConstantArrayTypeLoc TL) {
5607 const ConstantArrayType *
T = TL.getTypePtr();
5608 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5609 if (ElementType.isNull())
5613 Expr *
OldSize = TL.getSizeExpr();
5615 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5616 Expr *NewSize =
nullptr;
5620 NewSize = getDerived().TransformExpr(
OldSize).template getAs<Expr>();
5624 QualType
Result = TL.getType();
5625 if (getDerived().AlwaysRebuild() ||
5626 ElementType !=
T->getElementType() ||
5627 (
T->getSizeExpr() && NewSize !=
OldSize)) {
5628 Result = getDerived().RebuildConstantArrayType(ElementType,
5629 T->getSizeModifier(),
5630 T->getSize(), NewSize,
5631 T->getIndexTypeCVRQualifiers(),
5632 TL.getBracketsRange());
5641 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5642 NewTL.setLBracketLoc(TL.getLBracketLoc());
5643 NewTL.setRBracketLoc(TL.getRBracketLoc());
5644 NewTL.setSizeExpr(NewSize);
5649template<
typename Derived>
5650QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5651 TypeLocBuilder &TLB,
5652 IncompleteArrayTypeLoc TL) {
5653 const IncompleteArrayType *
T = TL.getTypePtr();
5654 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5655 if (ElementType.isNull())
5658 QualType
Result = TL.getType();
5659 if (getDerived().AlwaysRebuild() ||
5660 ElementType !=
T->getElementType()) {
5661 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5662 T->getSizeModifier(),
5663 T->getIndexTypeCVRQualifiers(),
5664 TL.getBracketsRange());
5669 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5670 NewTL.setLBracketLoc(TL.getLBracketLoc());
5671 NewTL.setRBracketLoc(TL.getRBracketLoc());
5672 NewTL.setSizeExpr(
nullptr);
5677template<
typename Derived>
5679TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5680 VariableArrayTypeLoc TL) {
5681 const VariableArrayType *
T = TL.getTypePtr();
5682 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5683 if (ElementType.isNull())
5688 EnterExpressionEvaluationContext Context(
5690 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5692 if (SizeResult.isInvalid())
5696 if (SizeResult.isInvalid())
5699 Expr *
Size = SizeResult.get();
5701 QualType
Result = TL.getType();
5702 if (getDerived().AlwaysRebuild() ||
5703 ElementType !=
T->getElementType() ||
5704 Size !=
T->getSizeExpr()) {
5705 Result = getDerived().RebuildVariableArrayType(ElementType,
5706 T->getSizeModifier(),
5708 T->getIndexTypeCVRQualifiers(),
5709 TL.getBracketsRange());
5716 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5717 NewTL.setLBracketLoc(TL.getLBracketLoc());
5718 NewTL.setRBracketLoc(TL.getRBracketLoc());
5719 NewTL.setSizeExpr(Size);
5724template<
typename Derived>
5726TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5727 DependentSizedArrayTypeLoc TL) {
5728 const DependentSizedArrayType *
T = TL.getTypePtr();
5729 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5730 if (ElementType.isNull())
5738 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5741 Expr *origSize = TL.getSizeExpr();
5742 if (!origSize) origSize =
T->getSizeExpr();
5745 = getDerived().TransformExpr(origSize);
5747 if (sizeResult.isInvalid())
5750 Expr *size = sizeResult.get();
5752 QualType
Result = TL.getType();
5753 if (getDerived().AlwaysRebuild() ||
5754 ElementType !=
T->getElementType() ||
5756 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5757 T->getSizeModifier(),
5759 T->getIndexTypeCVRQualifiers(),
5760 TL.getBracketsRange());
5767 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5768 NewTL.setLBracketLoc(TL.getLBracketLoc());
5769 NewTL.setRBracketLoc(TL.getRBracketLoc());
5770 NewTL.setSizeExpr(size);
5775template <
typename Derived>
5776QualType TreeTransform<Derived>::TransformDependentVectorType(
5777 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5778 const DependentVectorType *
T = TL.getTypePtr();
5779 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5780 if (ElementType.isNull())
5788 if (
Size.isInvalid())
5791 QualType
Result = TL.getType();
5792 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5793 Size.get() !=
T->getSizeExpr()) {
5794 Result = getDerived().RebuildDependentVectorType(
5795 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5801 if (isa<DependentVectorType>(
Result)) {
5802 DependentVectorTypeLoc NewTL =
5803 TLB.push<DependentVectorTypeLoc>(
Result);
5804 NewTL.setNameLoc(TL.getNameLoc());
5806 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5807 NewTL.setNameLoc(TL.getNameLoc());
5813template<
typename Derived>
5814QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5815 TypeLocBuilder &TLB,
5816 DependentSizedExtVectorTypeLoc TL) {
5817 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5820 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5821 if (ElementType.isNull())
5830 if (
Size.isInvalid())
5833 QualType
Result = TL.getType();
5834 if (getDerived().AlwaysRebuild() ||
5835 ElementType !=
T->getElementType() ||
5836 Size.get() !=
T->getSizeExpr()) {
5837 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5839 T->getAttributeLoc());
5845 if (isa<DependentSizedExtVectorType>(
Result)) {
5846 DependentSizedExtVectorTypeLoc NewTL
5847 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5848 NewTL.setNameLoc(TL.getNameLoc());
5850 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5851 NewTL.setNameLoc(TL.getNameLoc());
5857template <
typename Derived>
5859TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5860 ConstantMatrixTypeLoc TL) {
5861 const ConstantMatrixType *
T = TL.getTypePtr();
5862 QualType ElementType = getDerived().TransformType(
T->getElementType());
5863 if (ElementType.isNull())
5866 QualType
Result = TL.getType();
5867 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
5868 Result = getDerived().RebuildConstantMatrixType(
5869 ElementType,
T->getNumRows(),
T->getNumColumns());
5874 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5875 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5876 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5877 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5878 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5883template <
typename Derived>
5884QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5885 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5886 const DependentSizedMatrixType *
T = TL.getTypePtr();
5888 QualType ElementType = getDerived().TransformType(
T->getElementType());
5889 if (ElementType.isNull()) {
5897 Expr *origRows = TL.getAttrRowOperand();
5899 origRows =
T->getRowExpr();
5900 Expr *origColumns = TL.getAttrColumnOperand();
5902 origColumns =
T->getColumnExpr();
5904 ExprResult rowResult = getDerived().TransformExpr(origRows);
5906 if (rowResult.isInvalid())
5909 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5911 if (columnResult.isInvalid())
5914 Expr *rows = rowResult.get();
5915 Expr *columns = columnResult.get();
5917 QualType
Result = TL.getType();
5918 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5919 rows != origRows || columns != origColumns) {
5920 Result = getDerived().RebuildDependentSizedMatrixType(
5921 ElementType, rows, columns,
T->getAttributeLoc());
5929 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5930 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5931 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5932 NewTL.setAttrRowOperand(rows);
5933 NewTL.setAttrColumnOperand(columns);
5937template <
typename Derived>
5938QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5939 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5940 const DependentAddressSpaceType *
T = TL.getTypePtr();
5942 QualType pointeeType =
5943 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
5945 if (pointeeType.isNull())
5952 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
5954 if (AddrSpace.isInvalid())
5957 QualType
Result = TL.getType();
5958 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
5959 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
5960 Result = getDerived().RebuildDependentAddressSpaceType(
5961 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
5967 if (isa<DependentAddressSpaceType>(
Result)) {
5968 DependentAddressSpaceTypeLoc NewTL =
5969 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
5971 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5972 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
5973 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5976 TLB.TypeWasModifiedSafely(
Result);
5982template <
typename Derived>
5983QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
5985 const VectorType *
T = TL.getTypePtr();
5986 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5987 if (ElementType.isNull())
5990 QualType
Result = TL.getType();
5991 if (getDerived().AlwaysRebuild() ||
5992 ElementType !=
T->getElementType()) {
5993 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
5994 T->getVectorKind());
5999 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
6000 NewTL.setNameLoc(TL.getNameLoc());
6005template<
typename Derived>
6006QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
6007 ExtVectorTypeLoc TL) {
6008 const VectorType *
T = TL.getTypePtr();
6009 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6010 if (ElementType.isNull())
6013 QualType
Result = TL.getType();
6014 if (getDerived().AlwaysRebuild() ||
6015 ElementType !=
T->getElementType()) {
6016 Result = getDerived().RebuildExtVectorType(ElementType,
6017 T->getNumElements(),
6023 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
6024 NewTL.setNameLoc(TL.getNameLoc());
6029template <
typename Derived>
6032 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
6036 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
6063 NewDI = getDerived().TransformType(OldDI);
6067 if (NewDI == OldDI && indexAdjustment == 0)
6081 transformedLocalDecl(OldParm, {newParm});
6085template <
typename Derived>
6093 unsigned *LastParamTransformed) {
6094 int indexAdjustment = 0;
6096 unsigned NumParams = Params.size();
6097 for (
unsigned i = 0; i != NumParams; ++i) {
6098 if (LastParamTransformed)
6099 *LastParamTransformed = i;
6101 assert(OldParm->getFunctionScopeIndex() == i);
6103 std::optional<unsigned> NumExpansions;
6105 if (OldParm->isParameterPack()) {
6110 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6116 bool ShouldExpand =
false;
6117 bool RetainExpansion =
false;
6118 std::optional<unsigned> OrigNumExpansions;
6119 if (Unexpanded.size() > 0) {
6121 NumExpansions = OrigNumExpansions;
6122 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
6123 Pattern.getSourceRange(),
6135 "Could not find parameter packs or undeduced auto type!");
6142 getDerived().ExpandingFunctionParameterPack(OldParm);
6143 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6146 = getDerived().TransformFunctionTypeParam(OldParm,
6154 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6155 OutParamTypes.push_back(NewParm->
getType());
6157 PVars->push_back(NewParm);
6162 if (RetainExpansion) {
6163 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6165 = getDerived().TransformFunctionTypeParam(OldParm,
6173 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6174 OutParamTypes.push_back(NewParm->
getType());
6176 PVars->push_back(NewParm);
6192 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6197 "Parameter pack no longer a parameter pack after "
6200 NewParm = getDerived().TransformFunctionTypeParam(
6201 OldParm, indexAdjustment, std::nullopt,
6209 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6210 OutParamTypes.push_back(NewParm->
getType());
6212 PVars->push_back(NewParm);
6220 bool IsPackExpansion =
false;
6221 std::optional<unsigned> NumExpansions;
6224 = dyn_cast<PackExpansionType>(OldType)) {
6226 QualType Pattern = Expansion->getPattern();
6228 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6231 bool ShouldExpand =
false;
6232 bool RetainExpansion =
false;
6244 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6246 QualType NewType = getDerived().TransformType(Pattern);
6251 NewType = getSema().getASTContext().getPackExpansionType(
6252 NewType, std::nullopt);
6259 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6260 OutParamTypes.push_back(NewType);
6262 PVars->push_back(
nullptr);
6271 if (RetainExpansion) {
6272 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6273 QualType NewType = getDerived().TransformType(Pattern);
6278 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6279 OutParamTypes.push_back(NewType);
6281 PVars->push_back(
nullptr);
6286 OldType = Expansion->getPattern();
6287 IsPackExpansion =
true;
6289 NewType = getDerived().TransformType(OldType);
6291 NewType = getDerived().TransformType(OldType);
6297 if (IsPackExpansion)
6298 NewType = getSema().Context.getPackExpansionType(NewType,
6302 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6303 OutParamTypes.push_back(NewType);
6305 PVars->push_back(
nullptr);
6310 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6312 assert(parm->getFunctionScopeIndex() == i);
6319template<
typename Derived>
6324 return getDerived().TransformFunctionProtoType(
6327 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6328 ExceptionStorage, Changed);
6332template<
typename Derived>
template<
typename Fn>
6335 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6352 if (getDerived().TransformFunctionTypeParams(
6356 ParamTypes, &ParamDecls, ExtParamInfos))
6368 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6370 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6376 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6380 if (getDerived().TransformFunctionTypeParams(
6384 ParamTypes, &ParamDecls, ExtParamInfos))
6390 bool EPIChanged =
false;
6395 if (
auto NewExtParamInfos =
6411 std::optional<FunctionEffectSet> NewFX;
6420 ExprResult NewExpr = getDerived().TransformExpr(CondExpr);
6423 std::optional<FunctionEffectMode> Mode =
6443 "FunctionEffectMode::None shouldn't be possible here");
6449 NewFX->insert(NewEC, Errs);
6450 assert(Errs.empty());
6458 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6460 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6471 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6477template<
typename Derived>
6487 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6489 SemaRef, Method ? Method->getParent() :
nullptr,
6490 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6500 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6523 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6528 bool Expand =
false;
6529 bool RetainExpansion =
false;
6530 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6533 if (getDerived().TryExpandParameterPacks(
6535 RetainExpansion, NumExpansions))
6543 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6548 Exceptions.push_back(
U);
6554 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6557 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6561 Exceptions.push_back(
U);
6570 Exceptions.push_back(
U);
6580template<
typename Derived>
6590 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6591 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6602template <
typename Derived>
6603QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6604 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6605 const UnresolvedUsingType *
T = TL.getTypePtr();
6606 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6610 QualType
Result = TL.getType();
6611 if (getDerived().AlwaysRebuild() ||
D !=
T->getDecl()) {
6612 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(),
D);
6619 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6620 NewTL.setNameLoc(TL.getNameLoc());
6625template <
typename Derived>
6626QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6628 const UsingType *
T = TL.getTypePtr();
6630 auto *
Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6631 TL.getLocalSourceRange().getBegin(),
T->getFoundDecl()));
6635 QualType Underlying = getDerived().TransformType(
T->
desugar());
6636 if (Underlying.isNull())
6639 QualType
Result = TL.getType();
6640 if (getDerived().AlwaysRebuild() ||
Found !=
T->getFoundDecl() ||
6641 Underlying !=
T->getUnderlyingType()) {
6642 Result = getDerived().RebuildUsingType(
Found, Underlying);
6647 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6651template<
typename Derived>
6652QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6653 TypedefTypeLoc TL) {
6654 const TypedefType *
T = TL.getTypePtr();
6655 TypedefNameDecl *Typedef
6656 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6661 QualType
Result = TL.getType();
6662 if (getDerived().AlwaysRebuild() ||
6663 Typedef !=
T->getDecl()) {
6664 Result = getDerived().RebuildTypedefType(Typedef);
6669 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6670 NewTL.setNameLoc(TL.getNameLoc());
6675template<
typename Derived>
6676QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6677 TypeOfExprTypeLoc TL) {
6683 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6691 QualType
Result = TL.getType();
6693 if (getDerived().AlwaysRebuild() ||
E.get() != TL.getUnderlyingExpr()) {
6695 getDerived().RebuildTypeOfExprType(
E.get(), TL.getTypeofLoc(), Kind);
6700 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6701 NewTL.setTypeofLoc(TL.getTypeofLoc());
6702 NewTL.setLParenLoc(TL.getLParenLoc());
6703 NewTL.setRParenLoc(TL.getRParenLoc());
6708template<
typename Derived>
6709QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6711 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6712 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6716 QualType
Result = TL.getType();
6718 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6719 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6724 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6725 NewTL.setTypeofLoc(TL.getTypeofLoc());
6726 NewTL.setLParenLoc(TL.getLParenLoc());
6727 NewTL.setRParenLoc(TL.getRParenLoc());
6728 NewTL.setUnmodifiedTInfo(New_Under_TI);
6733template<
typename Derived>
6734QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6735 DecltypeTypeLoc TL) {
6736 const DecltypeType *
T = TL.getTypePtr();
6743 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6747 E = getSema().ActOnDecltypeExpression(
E.get());
6751 QualType
Result = TL.getType();
6752 if (getDerived().AlwaysRebuild() ||
6753 E.get() !=
T->getUnderlyingExpr()) {
6754 Result = getDerived().RebuildDecltypeType(
E.get(), TL.getDecltypeLoc());
6760 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6761 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6762 NewTL.setRParenLoc(TL.getRParenLoc());
6766template <
typename Derived>
6768TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6769 PackIndexingTypeLoc TL) {
6773 EnterExpressionEvaluationContext ConstantContext(
6776 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6777 if (IndexExpr.isInvalid())
6780 QualType Pattern = TL.getPattern();
6782 const PackIndexingType *PIT = TL.getTypePtr();
6786 bool NotYetExpanded = Types.empty();
6787 bool FullySubstituted =
true;
6789 if (Types.empty() && !PIT->expandsToEmptyPack())
6792 for (QualType
T : Types) {
6794 QualType Transformed = getDerived().TransformType(
T);
6795 if (Transformed.isNull())
6797 SubtitutedTypes.push_back(Transformed);
6802 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
6803 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6806 bool ShouldExpand =
true;
6807 bool RetainExpansion =
false;
6808 std::optional<unsigned> OrigNumExpansions;
6809 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6810 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6811 Unexpanded, ShouldExpand,
6812 RetainExpansion, NumExpansions))
6814 if (!ShouldExpand) {
6815 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6818 TypeSourceInfo *TI =
6820 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6823 if (NotYetExpanded) {
6824 FullySubstituted =
false;
6825 QualType Out = getDerived().RebuildPackIndexingType(
6826 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6831 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6832 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6835 SubtitutedTypes.push_back(Pack);
6838 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6839 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6840 QualType Out = getDerived().TransformType(
T);
6843 SubtitutedTypes.push_back(Out);
6844 FullySubstituted &= !Out->containsUnexpandedParameterPack();
6848 if (RetainExpansion) {
6849 FullySubstituted =
false;
6850 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6851 QualType Out = getDerived().TransformType(
T);
6854 SubtitutedTypes.push_back(Out);
6861 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6862 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6864 QualType Out = getDerived().RebuildPackIndexingType(
6865 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6866 FullySubstituted, SubtitutedTypes);
6870 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6871 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6875template<
typename Derived>
6876QualType TreeTransform<Derived>::TransformUnaryTransformType(
6877 TypeLocBuilder &TLB,
6878 UnaryTransformTypeLoc TL) {
6879 QualType
Result = TL.getType();
6880 if (
Result->isDependentType()) {
6881 const UnaryTransformType *
T = TL.getTypePtr();
6883 TypeSourceInfo *NewBaseTSI =
6884 getDerived().TransformType(TL.getUnderlyingTInfo());
6887 QualType NewBase = NewBaseTSI->getType();
6889 Result = getDerived().RebuildUnaryTransformType(NewBase,
6896 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6897 NewTL.setKWLoc(TL.getKWLoc());
6898 NewTL.setParensRange(TL.getParensRange());
6899 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6903template<
typename Derived>
6904QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6905 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6906 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
6909 TemplateName TemplateName = getDerived().TransformTemplateName(
6910 SS,
T->getTemplateName(), TL.getTemplateNameLoc());
6911 if (TemplateName.isNull())
6914 QualType OldDeduced =
T->getDeducedType();
6915 QualType NewDeduced;
6916 if (!OldDeduced.isNull()) {
6917 NewDeduced = getDerived().TransformType(OldDeduced);
6918 if (NewDeduced.isNull())
6922 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6923 TemplateName, NewDeduced);
6927 DeducedTemplateSpecializationTypeLoc NewTL =
6928 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6929 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6934template<
typename Derived>
6935QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6937 const RecordType *
T = TL.getTypePtr();
6939 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6944 QualType
Result = TL.getType();
6945 if (getDerived().AlwaysRebuild() ||
6952 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6953 NewTL.setNameLoc(TL.getNameLoc());
6958template<
typename Derived>
6959QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
6961 const EnumType *
T = TL.getTypePtr();
6963 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6968 QualType
Result = TL.getType();
6969 if (getDerived().AlwaysRebuild() ||
6970 Enum !=
T->getDecl()) {
6976 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
6977 NewTL.setNameLoc(TL.getNameLoc());
6982template<
typename Derived>
6983QualType TreeTransform<Derived>::TransformInjectedClassNameType(
6984 TypeLocBuilder &TLB,
6985 InjectedClassNameTypeLoc TL) {
6986 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
6987 TL.getTypePtr()->getDecl());
6988 if (!
D)
return QualType();
6991 TLB.pushTypeSpec(
T).setNameLoc(TL.getNameLoc());
6995template<
typename Derived>
6999 return getDerived().TransformTemplateTypeParmType(
7004template <
typename Derived>
7010template<
typename Derived>
7011QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7012 TypeLocBuilder &TLB,
7013 SubstTemplateTypeParmTypeLoc TL) {
7014 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
7017 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
7022 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7023 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
7024 if (Replacement.isNull())
7028 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex());
7031 SubstTemplateTypeParmTypeLoc NewTL
7032 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7033 NewTL.setNameLoc(TL.getNameLoc());
7038template<
typename Derived>
7042 return getDerived().TransformSubstTemplateTypeParmPackType(
7046template <
typename Derived>
7052template<
typename Derived>
7062 = getDerived().TransformTemplateName(SS,
T->getTemplateName(),
7067 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
7070template<
typename Derived>
7078 if (getDerived().AlwaysRebuild() ||
7080 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
7085 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
7093template <
typename Derived>
7094QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
7096 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7097 if (ValueType.isNull())
7100 QualType
Result = TL.getType();
7101 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7102 const PipeType *PT =
Result->castAs<PipeType>();
7103 bool isReadPipe = PT->isReadOnly();
7104 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7109 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
7110 NewTL.setKWLoc(TL.getKWLoc());
7115template <
typename Derived>
7116QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
7118 const BitIntType *EIT = TL.getTypePtr();
7119 QualType
Result = TL.getType();
7121 if (getDerived().AlwaysRebuild()) {
7122 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7123 EIT->getNumBits(), TL.getNameLoc());
7128 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7129 NewTL.setNameLoc(TL.getNameLoc());
7133template <
typename Derived>
7134QualType TreeTransform<Derived>::TransformDependentBitIntType(
7135 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
7136 const DependentBitIntType *EIT = TL.getTypePtr();
7140 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7143 if (BitsExpr.isInvalid())
7146 QualType
Result = TL.getType();
7148 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7149 Result = getDerived().RebuildDependentBitIntType(
7150 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7156 if (isa<DependentBitIntType>(
Result)) {
7157 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
7158 NewTL.setNameLoc(TL.getNameLoc());
7160 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7161 NewTL.setNameLoc(TL.getNameLoc());
7171 template<
typename ArgLocContainer>
7173 ArgLocContainer *Container;
7198 : Container(&Container), Index(Index) { }
7212 return Container->getArgLoc(Index);
7216 return pointer(Container->getArgLoc(Index));
7221 return X.Container == Y.Container &&
X.Index == Y.Index;
7230template<
typename Derived>
7231QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7233 const AutoType *
T = TL.getTypePtr();
7234 QualType OldDeduced =
T->getDeducedType();
7235 QualType NewDeduced;
7236 if (!OldDeduced.isNull()) {
7237 NewDeduced = getDerived().TransformType(OldDeduced);
7238 if (NewDeduced.isNull())
7242 ConceptDecl *NewCD =
nullptr;
7243 TemplateArgumentListInfo NewTemplateArgs;
7244 NestedNameSpecifierLoc NewNestedNameSpec;
7245 if (
T->isConstrained()) {
7246 assert(TL.getConceptReference());
7247 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7248 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7250 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7251 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7252 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7253 if (getDerived().TransformTemplateArguments(
7254 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7258 if (TL.getNestedNameSpecifierLoc()) {
7260 = getDerived().TransformNestedNameSpecifierLoc(
7261 TL.getNestedNameSpecifierLoc());
7262 if (!NewNestedNameSpec)
7267 QualType
Result = TL.getType();
7268 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7272 NewArgList.reserve(NewTemplateArgs.size());
7273 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7274 NewArgList.push_back(ArgLoc.getArgument());
7275 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7281 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7282 NewTL.setNameLoc(TL.getNameLoc());
7283 NewTL.setRParenLoc(TL.getRParenLoc());
7284 NewTL.setConceptReference(
nullptr);
7286 if (
T->isConstrained()) {
7287 DeclarationNameInfo DNI = DeclarationNameInfo(
7288 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7289 TL.getConceptNameLoc(),
7290 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7292 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7293 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7295 NewTL.setConceptReference(CR);
7301template <
typename Derived>
7303 TypeLocBuilder &TLB,
7304 TemplateSpecializationTypeLoc TL,
7305 TemplateName Template) {
7306 TemplateArgumentListInfo NewTemplateArgs;
7307 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7308 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7309 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7311 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7312 ArgIterator(TL, TL.getNumArgs()),
7319 getDerived().RebuildTemplateSpecializationType(Template,
7320 TL.getTemplateNameLoc(),
7328 if (isa<DependentTemplateSpecializationType>(
Result)) {
7329 DependentTemplateSpecializationTypeLoc NewTL
7330 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7331 NewTL.setElaboratedKeywordLoc(SourceLocation());
7332 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7333 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7334 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7335 NewTL.setLAngleLoc(TL.getLAngleLoc());
7336 NewTL.setRAngleLoc(TL.getRAngleLoc());
7337 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7338 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7342 TemplateSpecializationTypeLoc NewTL
7343 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7344 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7345 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7346 NewTL.setLAngleLoc(TL.getLAngleLoc());
7347 NewTL.setRAngleLoc(TL.getRAngleLoc());
7348 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7349 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7355template <
typename Derived>
7366 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7374 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7376 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7386 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7392 = getDerived().RebuildTemplateSpecializationType(Template,
7404 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7411template<
typename Derived>
7426 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7427 if (NamedT.isNull())
7436 if (
const TemplateSpecializationType *TST =
7437 NamedT->getAs<TemplateSpecializationType>()) {
7438 TemplateName Template = TST->getTemplateName();
7439 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7440 Template.getAsTemplateDecl())) {
7442 diag::err_tag_reference_non_tag)
7444 << llvm::to_underlying(
7446 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7452 if (getDerived().AlwaysRebuild() ||
7454 NamedT !=
T->getNamedType()) {
7457 QualifierLoc, NamedT);
7462 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7464 NewTL.setQualifierLoc(QualifierLoc);
7468template <
typename Derived>
7469QualType TreeTransform<Derived>::TransformAttributedType(TypeLocBuilder &TLB,
7470 AttributedTypeLoc TL) {
7472 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7473 if (modifiedType.isNull())
7477 const Attr *oldAttr = TL.getAttr();
7478 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7479 if (oldAttr && !newAttr)
7482 QualType result = TL.getType();
7485 if (getDerived().AlwaysRebuild() ||
7486 modifiedType != oldType->getModifiedType()) {
7499 QualType equivalentType = modifiedType;
7500 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7501 TypeLocBuilder AuxiliaryTLB;
7502 AuxiliaryTLB.reserve(TL.getFullDataSize());
7504 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7505 if (equivalentType.isNull())
7511 if (
auto nullability = oldType->getImmediateNullability()) {
7512 if (!modifiedType->canHaveNullability()) {
7513 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7514 : TL.getModifiedLoc().getBeginLoc()),
7515 diag::err_nullability_nonpointer)
7527 AttributedTypeLoc newTL = TLB.push<AttributedTypeLoc>(result);
7528 newTL.setAttr(newAttr);
7532template <
typename Derived>
7533QualType TreeTransform<Derived>::TransformCountAttributedType(
7534 TypeLocBuilder &TLB, CountAttributedTypeLoc TL) {
7535 const CountAttributedType *OldTy = TL.
getTypePtr();
7536 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7537 if (InnerTy.isNull())
7540 Expr *OldCount = TL.getCountExpr();
7541 Expr *NewCount =
nullptr;
7543 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7544 if (CountResult.isInvalid())
7546 NewCount = CountResult.get();
7549 QualType
Result = TL.getType();
7550 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7551 OldCount != NewCount) {
7554 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7557 TLB.push<CountAttributedTypeLoc>(
Result);
7561template <
typename Derived>
7562QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7563 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7565 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7568template <
typename Derived>
7569QualType TreeTransform<Derived>::TransformHLSLAttributedResourceType(
7570 TypeLocBuilder &TLB, HLSLAttributedResourceTypeLoc TL) {
7572 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7574 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7575 if (WrappedTy.isNull())
7578 QualType ContainedTy = QualType();
7579 QualType OldContainedTy = oldType->getContainedType();
7580 if (!OldContainedTy.isNull()) {
7581 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7582 if (!oldContainedTSI)
7583 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7584 OldContainedTy, SourceLocation());
7585 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7588 ContainedTy = ContainedTSI->getType();
7591 QualType
Result = TL.getType();
7592 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7593 ContainedTy != oldType->getContainedType()) {
7595 WrappedTy, ContainedTy, oldType->getAttrs());
7598 TLB.push<HLSLAttributedResourceTypeLoc>(
Result);
7602template<
typename Derived>
7604TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7606 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7610 QualType
Result = TL.getType();
7611 if (getDerived().AlwaysRebuild() ||
7612 Inner != TL.getInnerLoc().getType()) {
7613 Result = getDerived().RebuildParenType(Inner);
7618 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7619 NewTL.setLParenLoc(TL.getLParenLoc());
7620 NewTL.setRParenLoc(TL.getRParenLoc());
7624template <
typename Derived>
7626TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7627 MacroQualifiedTypeLoc TL) {
7628 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7632 QualType
Result = TL.getType();
7633 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7635 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7640 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7641 NewTL.setExpansionLoc(TL.getExpansionLoc());
7645template<
typename Derived>
7646QualType TreeTransform<Derived>::TransformDependentNameType(
7647 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7648 return TransformDependentNameType(TLB, TL,
false);
7651template<
typename Derived>
7652QualType TreeTransform<Derived>::TransformDependentNameType(
7653 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7654 const DependentNameType *
T = TL.getTypePtr();
7656 NestedNameSpecifierLoc QualifierLoc
7657 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7662 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7663 TL.getElaboratedKeywordLoc(),
7671 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7672 QualType NamedT = ElabT->getNamedType();
7673 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7675 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7676 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7677 NewTL.setQualifierLoc(QualifierLoc);
7679 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7680 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7681 NewTL.setQualifierLoc(QualifierLoc);
7682 NewTL.setNameLoc(TL.getNameLoc());
7687template<
typename Derived>
7690 DependentTemplateSpecializationTypeLoc TL) {
7691 NestedNameSpecifierLoc QualifierLoc;
7692 if (TL.getQualifierLoc()) {
7694 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7700 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7703template<
typename Derived>
7716 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7721 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7729 QualType NamedT = ElabT->getNamedType();
7738 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7745 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7754 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7763 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7769template<
typename Derived>
7778 if (getDerived().AlwaysRebuild() ||
7780 Result = getDerived().RebuildPackExpansionType(Pattern,
7788 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7793template<
typename Derived>
7795TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7796 ObjCInterfaceTypeLoc TL) {
7798 TLB.pushFullCopy(TL);
7799 return TL.getType();
7802template<
typename Derived>
7804TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7805 ObjCTypeParamTypeLoc TL) {
7806 const ObjCTypeParamType *
T = TL.getTypePtr();
7807 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7808 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7812 QualType
Result = TL.getType();
7813 if (getDerived().AlwaysRebuild() ||
7814 OTP !=
T->getDecl()) {
7815 Result = getDerived().RebuildObjCTypeParamType(
7816 OTP, TL.getProtocolLAngleLoc(),
7817 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7818 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7823 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7824 if (TL.getNumProtocols()) {
7825 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7826 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7827 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7828 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7833template<
typename Derived>
7835TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7836 ObjCObjectTypeLoc TL) {
7838 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7839 if (BaseType.isNull())
7842 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7846 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7847 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7848 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7849 QualType TypeArg = TypeArgInfo->getType();
7850 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7854 const auto *PackExpansion = PackExpansionLoc.getType()
7855 ->castAs<PackExpansionType>();
7859 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7863 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7864 bool Expand =
false;
7865 bool RetainExpansion =
false;
7866 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7867 if (getDerived().TryExpandParameterPacks(
7868 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7869 Unexpanded, Expand, RetainExpansion, NumExpansions))
7876 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7878 TypeLocBuilder TypeArgBuilder;
7879 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7880 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7882 if (NewPatternType.isNull())
7886 NewPatternType, NumExpansions);
7887 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7888 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7889 NewTypeArgInfos.push_back(
7890 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7896 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7897 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7899 TypeLocBuilder TypeArgBuilder;
7900 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7902 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7904 if (NewTypeArg.isNull())
7907 NewTypeArgInfos.push_back(
7908 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7914 TypeLocBuilder TypeArgBuilder;
7915 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7916 QualType NewTypeArg =
7917 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7918 if (NewTypeArg.isNull())
7922 if (NewTypeArg == TypeArg) {
7923 NewTypeArgInfos.push_back(TypeArgInfo);
7927 NewTypeArgInfos.push_back(
7928 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7932 QualType
Result = TL.getType();
7933 if (getDerived().AlwaysRebuild() || AnyChanged) {
7935 Result = getDerived().RebuildObjCObjectType(
7936 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7937 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7938 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7939 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7945 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7946 NewT.setHasBaseTypeAsWritten(
true);
7947 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7948 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7949 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7950 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7951 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7952 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7953 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7954 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7958template<
typename Derived>
7960TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
7961 ObjCObjectPointerTypeLoc TL) {
7962 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7963 if (PointeeType.isNull())
7966 QualType
Result = TL.getType();
7967 if (getDerived().AlwaysRebuild() ||
7968 PointeeType != TL.getPointeeLoc().getType()) {
7969 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
7975 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
7976 NewT.setStarLoc(TL.getStarLoc());
7983template<
typename Derived>
7985TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
7989template<
typename Derived>
7992 return getDerived().TransformCompoundStmt(S,
false);
7995template<
typename Derived>
8001 if (S->hasStoredFPFeatures())
8002 getSema().resetFPOptions(
8003 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
8006 bool SubStmtInvalid =
false;
8007 bool SubStmtChanged =
false;
8009 for (
auto *B : S->body()) {
8011 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
8013 if (
Result.isInvalid()) {
8016 if (isa<DeclStmt>(B))
8020 SubStmtInvalid =
true;
8024 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8025 Statements.push_back(
Result.getAs<Stmt>());
8031 if (!getDerived().AlwaysRebuild() &&
8035 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
8041template<
typename Derived>
8043TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
8050 LHS = getDerived().TransformExpr(S->getLHS());
8052 if (LHS.isInvalid())
8056 RHS = getDerived().TransformExpr(S->getRHS());
8058 if (RHS.isInvalid())
8065 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8067 S->getEllipsisLoc(),
8070 if (Case.isInvalid())
8075 getDerived().TransformStmt(S->getSubStmt());
8076 if (SubStmt.isInvalid())
8080 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8083template <
typename Derived>
8084StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
8087 getDerived().TransformStmt(S->getSubStmt());
8088 if (SubStmt.isInvalid())
8092 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8096template<
typename Derived>
8098TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
8099 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8100 if (SubStmt.isInvalid())
8103 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8111 if (LD == S->getDecl())
8112 S->getDecl()->setStmt(
nullptr);
8115 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8116 cast<LabelDecl>(LD), SourceLocation(),
8120template <
typename Derived>
8129 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8130#include "clang/Basic/AttrList.inc"
8135template <
typename Derived>
8146 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8147#include "clang/Basic/AttrList.inc"
8149 return TransformAttr(R);
8152template <
typename Derived>
8155 StmtDiscardKind SDK) {
8156 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8160 bool AttrsChanged =
false;
8164 for (
const auto *I : S->getAttrs()) {
8166 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
8167 AttrsChanged |= (I != R);
8172 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
8180 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8184template<
typename Derived>
8186TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
8189 if (
Init.isInvalid())
8192 Sema::ConditionResult Cond;
8193 if (!S->isConsteval()) {
8195 Cond = getDerived().TransformCondition(
8196 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8199 if (Cond.isInvalid())
8204 std::optional<bool> ConstexprConditionValue;
8205 if (S->isConstexpr())
8206 ConstexprConditionValue = Cond.getKnownValue();
8210 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8211 EnterExpressionEvaluationContext Ctx(
8214 S->isNonNegatedConsteval());
8216 Then = getDerived().TransformStmt(S->getThen());
8217 if (Then.isInvalid())
8223 Then =
new (getSema().Context)
8224 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8229 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8230 EnterExpressionEvaluationContext Ctx(
8233 S->isNegatedConsteval());
8235 Else = getDerived().TransformStmt(S->getElse());
8236 if (Else.isInvalid())
8238 }
else if (S->getElse() && ConstexprConditionValue &&
8239 *ConstexprConditionValue) {
8243 Else =
new (getSema().Context)
8244 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8247 if (!getDerived().AlwaysRebuild() &&
8248 Init.get() == S->getInit() &&
8249 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8250 Then.get() == S->getThen() &&
8251 Else.get() == S->getElse())
8254 return getDerived().RebuildIfStmt(
8255 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8256 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8259template<
typename Derived>
8261TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8264 if (
Init.isInvalid())
8268 Sema::ConditionResult Cond = getDerived().TransformCondition(
8269 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8271 if (Cond.isInvalid())
8276 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8277 Init.get(), Cond, S->getRParenLoc());
8282 StmtResult Body = getDerived().TransformStmt(S->getBody());
8283 if (Body.isInvalid())
8287 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8291template<
typename Derived>
8293TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8295 Sema::ConditionResult Cond = getDerived().TransformCondition(
8296 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8298 if (Cond.isInvalid())
8303 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8307 StmtResult Body = getDerived().TransformStmt(S->getBody());
8308 if (Body.isInvalid())
8311 if (!getDerived().AlwaysRebuild() &&
8312 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8313 Body.get() == S->getBody())
8316 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8317 Cond, S->getRParenLoc(), Body.get());
8320template<
typename Derived>
8322TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8325 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8329 StmtResult Body = getDerived().TransformStmt(S->getBody());
8330 if (Body.isInvalid())
8334 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8335 if (Cond.isInvalid())
8338 if (!getDerived().AlwaysRebuild() &&
8339 Cond.get() == S->getCond() &&
8340 Body.get() == S->getBody())
8343 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8344 S->getWhileLoc(), Cond.get(),
8348template<
typename Derived>
8350TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8351 if (getSema().getLangOpts().OpenMP)
8352 getSema().OpenMP().startOpenMPLoop();
8356 if (
Init.isInvalid())
8361 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8362 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8366 Sema::ConditionResult Cond = getDerived().TransformCondition(
8367 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8369 if (Cond.isInvalid())
8374 if (
Inc.isInvalid())
8377 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8378 if (S->getInc() && !FullInc.get())
8383 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
8385 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8386 Cond.get().second, S->getInc(),
Inc.get());
8389 StmtResult Body = getDerived().TransformStmt(S->getBody());
8390 if (Body.isInvalid())
8395 if (!getDerived().AlwaysRebuild() &&
8396 Init.get() == S->getInit() &&
8397 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8398 Inc.get() == S->getInc() &&
8399 Body.get() == S->getBody())
8402 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8403 Init.get(), Cond, FullInc,
8404 S->getRParenLoc(), Body.get());
8407template<
typename Derived>
8409TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8410 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8416 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8417 cast<LabelDecl>(LD));
8420template<
typename Derived>
8422TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8428 if (!getDerived().AlwaysRebuild() &&
8429 Target.get() == S->getTarget())
8432 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8436template<
typename Derived>
8438TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8442template<
typename Derived>
8444TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8448template<
typename Derived>
8450TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8458 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8461template<
typename Derived>
8463TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8464 bool DeclChanged =
false;
8466 LambdaScopeInfo *LSI = getSema().getCurLambda();
8467 for (
auto *
D : S->decls()) {
8472 if (Transformed !=
D)
8476 if (
auto *TD = dyn_cast<TypeDecl>(Transformed))
8477 LSI->ContainsUnexpandedParameterPack |=
8480 .getTypeDeclType(TD)
8482 ->containsUnexpandedParameterPack();
8484 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8485 LSI->ContainsUnexpandedParameterPack |=
8486 VD->getType()->containsUnexpandedParameterPack();
8489 Decls.push_back(Transformed);
8492 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8495 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8498template<
typename Derived>
8500TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8509 bool ExprsChanged =
false;
8512 for (
unsigned I = 0,
E = S->getNumOutputs(); I !=
E; ++I) {
8513 Names.push_back(S->getOutputIdentifier(I));
8516 Constraints.push_back(S->getOutputConstraintLiteral(I));
8519 Expr *OutputExpr = S->getOutputExpr(I);
8524 ExprsChanged |=
Result.get() != OutputExpr;
8526 Exprs.push_back(
Result.get());
8530 for (
unsigned I = 0,
E = S->getNumInputs(); I !=
E; ++I) {
8531 Names.push_back(S->getInputIdentifier(I));
8534 Constraints.push_back(S->getInputConstraintLiteral(I));
8537 Expr *InputExpr = S->getInputExpr(I);
8542 ExprsChanged |=
Result.get() != InputExpr;
8544 Exprs.push_back(
Result.get());
8548 for (
unsigned I = 0,
E = S->getNumLabels(); I !=
E; ++I) {
8549 Names.push_back(S->getLabelIdentifier(I));
8554 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8555 Exprs.push_back(
Result.get());
8557 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8561 for (
unsigned I = 0,
E = S->getNumClobbers(); I !=
E; ++I)
8562 Clobbers.push_back(S->getClobberStringLiteral(I));
8565 AsmString = S->getAsmString();
8566 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8567 S->isVolatile(), S->getNumOutputs(),
8568 S->getNumInputs(), Names.data(),
8569 Constraints, Exprs, AsmString.get(),
8570 Clobbers, S->getNumLabels(),
8574template<
typename Derived>
8576TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8579 bool HadError =
false, HadChange =
false;
8583 TransformedExprs.reserve(SrcExprs.size());
8584 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8586 if (!
Result.isUsable()) {
8589 HadChange |= (
Result.get() != SrcExprs[i]);
8590 TransformedExprs.push_back(
Result.get());
8595 if (!HadChange && !getDerived().AlwaysRebuild())
8598 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8599 AsmToks, S->getAsmString(),
8600 S->getNumOutputs(), S->getNumInputs(),
8601 S->getAllConstraints(), S->getClobbers(),
8602 TransformedExprs, S->getEndLoc());
8606template<
typename Derived>
8608TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8610 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8611 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8612 ScopeInfo->NeedsCoroutineSuspends &&
8613 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8614 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8615 "expected clean scope info");
8619 ScopeInfo->setNeedsCoroutineSuspends(
false);
8632 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8633 ScopeInfo->CoroutinePromise = Promise;
8638 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8639 if (InitSuspend.isInvalid())
8642 getDerived().TransformStmt(S->getFinalSuspendStmt());
8643 if (FinalSuspend.isInvalid() ||
8646 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8647 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8649 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8650 if (BodyRes.isInvalid())
8653 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8654 if (Builder.isInvalid())
8657 Expr *ReturnObject = S->getReturnValueInit();
8658 assert(ReturnObject &&
"the return object is expected to be valid");
8659 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8661 if (Res.isInvalid())
8663 Builder.ReturnValue = Res.get();
8668 if (S->hasDependentPromiseType()) {
8671 if (!Promise->getType()->isDependentType()) {
8672 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8673 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8674 "these nodes should not have been built yet");
8675 if (!Builder.buildDependentStatements())
8679 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8680 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8681 if (Res.isInvalid())
8683 Builder.OnFallthrough = Res.get();
8686 if (
auto *OnException = S->getExceptionHandler()) {
8687 StmtResult Res = getDerived().TransformStmt(OnException);
8688 if (Res.isInvalid())
8690 Builder.OnException = Res.get();
8693 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8694 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8695 if (Res.isInvalid())
8697 Builder.ReturnStmtOnAllocFailure = Res.get();
8701 assert(S->getAllocate() && S->getDeallocate() &&
8702 "allocation and deallocation calls must already be built");
8703 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8704 if (AllocRes.isInvalid())
8706 Builder.Allocate = AllocRes.get();
8708 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8709 if (DeallocRes.isInvalid())
8711 Builder.Deallocate = DeallocRes.get();
8713 if (
auto *ResultDecl = S->getResultDecl()) {
8714 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8715 if (Res.isInvalid())
8717 Builder.ResultDecl = Res.get();
8720 if (
auto *ReturnStmt = S->getReturnStmt()) {
8721 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8722 if (Res.isInvalid())
8724 Builder.ReturnStmt = Res.get();
8728 return getDerived().RebuildCoroutineBodyStmt(Builder);
8731template<
typename Derived>
8733TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8741 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8745template <
typename Derived>
8746ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *
E) {
8758 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8759 getSema().getCurScope(),
E->getKeywordLoc());
8763 return getDerived().RebuildCoawaitExpr(
8765 cast<UnresolvedLookupExpr>(Lookup.get()),
E->isImplicit());
8768template <
typename Derived>
8770TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *
E) {
8771 ExprResult OperandResult = getDerived().TransformInitializer(
E->getOperand(),
8773 if (OperandResult.isInvalid())
8776 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8777 E->getOperatorCoawaitLookup());
8779 if (LookupResult.isInvalid())
8784 return getDerived().RebuildDependentCoawaitExpr(
8785 E->getKeywordLoc(), OperandResult.get(),
8786 cast<UnresolvedLookupExpr>(LookupResult.get()));
8789template<
typename Derived>
8791TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *
E) {
8799 return getDerived().RebuildCoyieldExpr(
E->getKeywordLoc(),
Result.get());
8804template<
typename Derived>
8806TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8808 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8809 if (TryBody.isInvalid())
8813 bool AnyCatchChanged =
false;
8815 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8816 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8817 if (Catch.isInvalid())
8819 if (Catch.get() != S->getCatchStmt(I))
8820 AnyCatchChanged =
true;
8821 CatchStmts.push_back(Catch.get());
8826 if (S->getFinallyStmt()) {
8827 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8828 if (Finally.isInvalid())
8833 if (!getDerived().AlwaysRebuild() &&
8834 TryBody.get() == S->getTryBody() &&
8836 Finally.get() == S->getFinallyStmt())
8840 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8841 CatchStmts, Finally.get());
8844template<
typename Derived>
8846TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8848 VarDecl *Var =
nullptr;
8849 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8850 TypeSourceInfo *TSInfo =
nullptr;
8851 if (FromVar->getTypeSourceInfo()) {
8852 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8859 T = TSInfo->getType();
8861 T = getDerived().TransformType(FromVar->getType());
8866 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8871 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8872 if (Body.isInvalid())
8875 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8880template<
typename Derived>
8882TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8884 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8885 if (Body.isInvalid())
8889 if (!getDerived().AlwaysRebuild() &&
8890 Body.get() == S->getFinallyBody())
8894 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8898template<
typename Derived>
8900TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8902 if (S->getThrowExpr()) {
8903 Operand = getDerived().TransformExpr(S->getThrowExpr());
8908 if (!getDerived().AlwaysRebuild() &&
8909 Operand.get() == S->getThrowExpr())
8912 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8915template<
typename Derived>
8917TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8918 ObjCAtSynchronizedStmt *S) {
8924 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8930 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8931 if (Body.isInvalid())
8935 if (!getDerived().AlwaysRebuild() &&
8936 Object.get() == S->getSynchExpr() &&
8937 Body.get() == S->getSynchBody())
8941 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8942 Object.get(), Body.get());
8945template<
typename Derived>
8947TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8948 ObjCAutoreleasePoolStmt *S) {
8950 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8951 if (Body.isInvalid())
8955 if (!getDerived().AlwaysRebuild() &&
8956 Body.get() == S->getSubStmt())
8960 return getDerived().RebuildObjCAutoreleasePoolStmt(
8961 S->getAtLoc(), Body.get());
8964template<
typename Derived>
8966TreeTransform<Derived>::TransformObjCForCollectionStmt(
8967 ObjCForCollectionStmt *S) {
8970 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
8971 if (Element.isInvalid())
8975 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
8976 if (Collection.isInvalid())
8980 StmtResult Body = getDerived().TransformStmt(S->getBody());
8981 if (Body.isInvalid())
8985 if (!getDerived().AlwaysRebuild() &&
8986 Element.get() == S->getElement() &&
8987 Collection.get() == S->getCollection() &&
8988 Body.get() == S->getBody())
8992 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
8999template <
typename Derived>
9000StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
9002 VarDecl *Var =
nullptr;
9003 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9005 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9009 Var = getDerived().RebuildExceptionDecl(
9010 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9011 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9012 if (!Var || Var->isInvalidDecl())
9017 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9018 if (Handler.isInvalid())
9021 if (!getDerived().AlwaysRebuild() && !Var &&
9022 Handler.get() == S->getHandlerBlock())
9025 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9028template <
typename Derived>
9029StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
9031 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9032 if (TryBlock.isInvalid())
9036 bool HandlerChanged =
false;
9038 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9039 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9040 if (Handler.isInvalid())
9043 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9044 Handlers.push_back(Handler.getAs<Stmt>());
9047 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9051 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9055template<
typename Derived>
9057TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
9058 EnterExpressionEvaluationContext ForRangeInitContext(
9066 auto &LastRecord = getSema().currentEvaluationContext();
9067 LastRecord.InLifetimeExtendingContext =
true;
9068 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9071 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9072 if (
Init.isInvalid())
9081 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9082 auto ForRangeLifetimeExtendTemps =
9083 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9088 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9089 if (End.isInvalid())
9092 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9093 if (Cond.isInvalid())
9097 if (Cond.isInvalid())
9103 if (
Inc.isInvalid())
9108 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9109 if (LoopVar.isInvalid())
9113 if (getDerived().AlwaysRebuild() ||
9114 Init.get() != S->getInit() ||
9115 Range.get() != S->getRangeStmt() ||
9116 Begin.get() != S->getBeginStmt() ||
9117 End.get() != S->getEndStmt() ||
9118 Cond.get() != S->getCond() ||
9119 Inc.get() != S->getInc() ||
9120 LoopVar.get() != S->getLoopVarStmt()) {
9121 NewStmt = getDerived().RebuildCXXForRangeStmt(
9122 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9124 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9125 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9128 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
9135 SemaOpenACC::LoopInConstructRAII LCR{SemaRef.
OpenACC()};
9138 StmtResult Body = getDerived().TransformStmt(S->getBody());
9139 if (Body.isInvalid())
9146 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9147 NewStmt = getDerived().RebuildCXXForRangeStmt(
9148 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9150 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9151 if (NewStmt.isInvalid())
9155 if (NewStmt.get() == S)
9158 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9161template<
typename Derived>
9163TreeTransform<Derived>::TransformMSDependentExistsStmt(
9164 MSDependentExistsStmt *S) {
9166 NestedNameSpecifierLoc QualifierLoc;
9167 if (S->getQualifierLoc()) {
9169 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9175 DeclarationNameInfo NameInfo = S->getNameInfo();
9176 if (NameInfo.getName()) {
9177 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9178 if (!NameInfo.getName())
9183 if (!getDerived().AlwaysRebuild() &&
9184 QualifierLoc == S->getQualifierLoc() &&
9185 NameInfo.getName() == S->getNameInfo().getName())
9190 SS.Adopt(QualifierLoc);
9192 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9194 if (S->isIfExists())
9197 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9200 if (S->isIfNotExists())
9203 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9214 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9215 if (SubStmt.isInvalid())
9223 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9230template<
typename Derived>
9232TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *
E) {
9233 NestedNameSpecifierLoc QualifierLoc;
9234 if (
E->getQualifierLoc()) {
9236 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
9241 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
9242 getDerived().TransformDecl(
E->getMemberLoc(),
E->getPropertyDecl()));
9247 if (
Base.isInvalid())
9251 MSPropertyRefExpr(
Base.get(), PD,
E->isArrow(),
9253 QualifierLoc,
E->getMemberLoc());
9256template <
typename Derived>
9257ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
9258 MSPropertySubscriptExpr *
E) {
9259 auto BaseRes = getDerived().TransformExpr(
E->getBase());
9260 if (BaseRes.isInvalid())
9262 auto IdxRes = getDerived().TransformExpr(
E->getIdx());
9263 if (IdxRes.isInvalid())
9266 if (!getDerived().AlwaysRebuild() &&
9267 BaseRes.get() ==
E->getBase() &&
9268 IdxRes.get() ==
E->getIdx())
9271 return getDerived().RebuildArraySubscriptExpr(
9272 BaseRes.get(), SourceLocation(), IdxRes.get(),
E->getRBracketLoc());
9275template <
typename Derived>
9276StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
9277 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9278 if (TryBlock.isInvalid())
9281 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9282 if (Handler.isInvalid())
9285 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9286 Handler.get() == S->getHandler())
9289 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9290 TryBlock.get(), Handler.get());
9293template <
typename Derived>
9294StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9296 if (
Block.isInvalid())
9299 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9302template <
typename Derived>
9303StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9304 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9305 if (FilterExpr.isInvalid())
9309 if (
Block.isInvalid())
9312 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9316template <
typename Derived>
9318 if (isa<SEHFinallyStmt>(Handler))
9319 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9321 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9324template<
typename Derived>
9334template <
typename Derived>
9336TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9340 return getDerived().TransformStmt(L->getLoopStmt());
9343template <
typename Derived>
9350 TClauses.reserve(Clauses.size());
9354 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9355 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9356 getDerived().getSema().OpenMP().EndOpenMPClause();
9358 TClauses.push_back(Clause);
9360 TClauses.push_back(
nullptr);
9364 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9365 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9366 D->getDirectiveKind(),
9372 if (
D->getDirectiveKind() == OMPD_atomic ||
9373 D->getDirectiveKind() == OMPD_critical ||
9374 D->getDirectiveKind() == OMPD_section ||
9375 D->getDirectiveKind() == OMPD_master)
9376 CS =
D->getAssociatedStmt();
9378 CS =
D->getRawStmt();
9379 Body = getDerived().TransformStmt(CS);
9381 getSema().getLangOpts().OpenMPIRBuilder)
9382 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9385 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9390 if (TClauses.size() != Clauses.size()) {
9396 if (
D->getDirectiveKind() == OMPD_critical) {
9397 DirName = cast<OMPCriticalDirective>(
D)->getDirectiveName();
9398 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9401 if (
D->getDirectiveKind() == OMPD_cancellation_point) {
9402 CancelRegion = cast<OMPCancellationPointDirective>(
D)->getCancelRegion();
9403 }
else if (
D->getDirectiveKind() == OMPD_cancel) {
9404 CancelRegion = cast<OMPCancelDirective>(
D)->getCancelRegion();
9407 return getDerived().RebuildOMPExecutableDirective(
9408 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9417template <
typename Derived>
9424 TClauses.reserve(Clauses.size());
9427 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9428 OMPClause *Clause = getDerived().TransformOMPClause(
C);
9429 getDerived().getSema().OpenMP().EndOpenMPClause();
9431 TClauses.push_back(Clause);
9433 TClauses.push_back(
nullptr);
9437 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9438 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9439 D->getDirectiveKind(),
9444 assert(
D->getDirectiveKind() == OMPD_assume &&
9445 "Unexpected informational directive");
9446 Stmt *CS =
D->getAssociatedStmt();
9447 Body = getDerived().TransformStmt(CS);
9450 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9454 if (TClauses.size() != Clauses.size())
9459 return getDerived().RebuildOMPInformationalDirective(
9460 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9464template <
typename Derived>
9469 << getOpenMPDirectiveName(
D->getDirectiveKind());
9473template <
typename Derived>
9475TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *
D) {
9476 DeclarationNameInfo DirName;
9477 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9479 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9480 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9484template <
typename Derived>
9486TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *
D) {
9487 DeclarationNameInfo DirName;
9488 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9490 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9491 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9495template <
typename Derived>
9497TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *
D) {
9498 DeclarationNameInfo DirName;
9499 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9501 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9502 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9506template <
typename Derived>
9508TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *
D) {
9509 DeclarationNameInfo DirName;
9510 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9512 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9513 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9517template <
typename Derived>
9519TreeTransform<Derived>::TransformOMPReverseDirective(OMPReverseDirective *
D) {
9520 DeclarationNameInfo DirName;
9521 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9523 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9524 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9528template <
typename Derived>
9529StmtResult TreeTransform<Derived>::TransformOMPInterchangeDirective(
9530 OMPInterchangeDirective *
D) {
9531 DeclarationNameInfo DirName;
9532 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9534 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9535 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9539template <
typename Derived>
9541TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *
D) {
9542 DeclarationNameInfo DirName;
9543 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9545 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9546 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9550template <
typename Derived>
9552TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *
D) {
9553 DeclarationNameInfo DirName;
9554 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9556 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9557 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9561template <
typename Derived>
9563TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *
D) {
9564 DeclarationNameInfo DirName;
9565 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9567 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9568 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9572template <
typename Derived>
9574TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *
D) {
9575 DeclarationNameInfo DirName;
9576 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9578 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9579 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9583template <
typename Derived>
9585TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *
D) {
9586 DeclarationNameInfo DirName;
9587 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9589 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9590 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9594template <
typename Derived>
9596TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *
D) {
9597 DeclarationNameInfo DirName;
9598 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9600 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9601 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9605template <
typename Derived>
9607TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *
D) {
9608 DeclarationNameInfo DirName;
9609 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9611 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9612 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9616template <
typename Derived>
9618TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *
D) {
9619 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9620 OMPD_critical,
D->getDirectiveName(),
nullptr,
D->
getBeginLoc());
9621 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9622 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9626template <
typename Derived>
9627StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9628 OMPParallelForDirective *
D) {
9629 DeclarationNameInfo DirName;
9630 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9631 OMPD_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9632 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9633 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9637template <
typename Derived>
9638StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9639 OMPParallelForSimdDirective *
D) {
9640 DeclarationNameInfo DirName;
9641 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9642 OMPD_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9643 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9644 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9648template <
typename Derived>
9649StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9650 OMPParallelMasterDirective *
D) {
9651 DeclarationNameInfo DirName;
9652 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9653 OMPD_parallel_master, DirName,
nullptr,
D->
getBeginLoc());
9654 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9655 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9659template <
typename Derived>
9660StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9661 OMPParallelMaskedDirective *
D) {
9662 DeclarationNameInfo DirName;
9663 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9664 OMPD_parallel_masked, DirName,
nullptr,
D->
getBeginLoc());
9665 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9666 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9670template <
typename Derived>
9671StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9672 OMPParallelSectionsDirective *
D) {
9673 DeclarationNameInfo DirName;
9674 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9675 OMPD_parallel_sections, DirName,
nullptr,
D->
getBeginLoc());
9676 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9677 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9681template <
typename Derived>
9683TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *
D) {
9684 DeclarationNameInfo DirName;
9685 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9687 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9688 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9692template <
typename Derived>
9693StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9694 OMPTaskyieldDirective *
D) {
9695 DeclarationNameInfo DirName;
9696 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9698 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9699 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9703template <
typename Derived>
9705TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *
D) {
9706 DeclarationNameInfo DirName;
9707 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9709 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9710 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9714template <
typename Derived>
9716TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *
D) {
9717 DeclarationNameInfo DirName;
9718 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9720 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9721 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9725template <
typename Derived>
9727TreeTransform<Derived>::TransformOMPAssumeDirective(OMPAssumeDirective *
D) {
9728 DeclarationNameInfo DirName;
9729 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9731 StmtResult Res = getDerived().TransformOMPInformationalDirective(
D);
9732 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9736template <
typename Derived>
9738TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *
D) {
9739 DeclarationNameInfo DirName;
9740 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9742 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9743 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9747template <
typename Derived>
9748StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9749 OMPTaskgroupDirective *
D) {
9750 DeclarationNameInfo DirName;
9751 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9753 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9754 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9758template <
typename Derived>
9760TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *
D) {
9761 DeclarationNameInfo DirName;
9762 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9764 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9765 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9769template <
typename Derived>
9771TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *
D) {
9772 DeclarationNameInfo DirName;
9773 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9775 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9776 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9780template <
typename Derived>
9782TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *
D) {
9783 DeclarationNameInfo DirName;
9784 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9786 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9787 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9791template <
typename Derived>
9793TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *
D) {
9794 DeclarationNameInfo DirName;
9795 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9797 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9798 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9802template <
typename Derived>
9804TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *
D) {
9805 DeclarationNameInfo DirName;
9806 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9808 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9809 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9813template <
typename Derived>
9815TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *
D) {
9816 DeclarationNameInfo DirName;
9817 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9819 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9820 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9824template <
typename Derived>
9825StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9826 OMPTargetDataDirective *
D) {
9827 DeclarationNameInfo DirName;
9828 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9830 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9831 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9835template <
typename Derived>
9836StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9837 OMPTargetEnterDataDirective *
D) {
9838 DeclarationNameInfo DirName;
9839 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9840 OMPD_target_enter_data, DirName,
nullptr,
D->
getBeginLoc());
9841 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9842 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9846template <
typename Derived>
9847StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9848 OMPTargetExitDataDirective *
D) {
9849 DeclarationNameInfo DirName;
9850 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9851 OMPD_target_exit_data, DirName,
nullptr,
D->
getBeginLoc());
9852 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9853 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9857template <
typename Derived>
9858StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9859 OMPTargetParallelDirective *
D) {
9860 DeclarationNameInfo DirName;
9861 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9862 OMPD_target_parallel, DirName,
nullptr,
D->
getBeginLoc());
9863 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9864 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9868template <
typename Derived>
9869StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9870 OMPTargetParallelForDirective *
D) {
9871 DeclarationNameInfo DirName;
9872 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9873 OMPD_target_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9874 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9875 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9879template <
typename Derived>
9880StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9881 OMPTargetUpdateDirective *
D) {
9882 DeclarationNameInfo DirName;
9883 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9884 OMPD_target_update, DirName,
nullptr,
D->
getBeginLoc());
9885 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9886 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9890template <
typename Derived>
9892TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *
D) {
9893 DeclarationNameInfo DirName;
9894 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9896 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9897 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9901template <
typename Derived>
9902StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9903 OMPCancellationPointDirective *
D) {
9904 DeclarationNameInfo DirName;
9905 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9906 OMPD_cancellation_point, DirName,
nullptr,
D->
getBeginLoc());
9907 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9908 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9912template <
typename Derived>
9914TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *
D) {
9915 DeclarationNameInfo DirName;
9916 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9918 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9919 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9923template <
typename Derived>
9925TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *
D) {
9926 DeclarationNameInfo DirName;
9927 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9929 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9930 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9934template <
typename Derived>
9935StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9936 OMPTaskLoopSimdDirective *
D) {
9937 DeclarationNameInfo DirName;
9938 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9939 OMPD_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9940 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9941 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9945template <
typename Derived>
9946StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9947 OMPMasterTaskLoopDirective *
D) {
9948 DeclarationNameInfo DirName;
9949 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9950 OMPD_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9951 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9952 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9956template <
typename Derived>
9957StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
9958 OMPMaskedTaskLoopDirective *
D) {
9959 DeclarationNameInfo DirName;
9960 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9961 OMPD_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9962 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9963 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9967template <
typename Derived>
9968StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
9969 OMPMasterTaskLoopSimdDirective *
D) {
9970 DeclarationNameInfo DirName;
9971 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9972 OMPD_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9973 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9974 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9978template <
typename Derived>
9979StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
9980 OMPMaskedTaskLoopSimdDirective *
D) {
9981 DeclarationNameInfo DirName;
9982 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9983 OMPD_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9984 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9985 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9989template <
typename Derived>
9990StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
9991 OMPParallelMasterTaskLoopDirective *
D) {
9992 DeclarationNameInfo DirName;
9993 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9994 OMPD_parallel_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9995 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9996 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10000template <
typename Derived>
10001StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
10002 OMPParallelMaskedTaskLoopDirective *
D) {
10003 DeclarationNameInfo DirName;
10004 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10005 OMPD_parallel_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
10006 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10007 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10011template <
typename Derived>
10013TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
10014 OMPParallelMasterTaskLoopSimdDirective *
D) {
10015 DeclarationNameInfo DirName;
10016 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10017 OMPD_parallel_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10018 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10019 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10023template <
typename Derived>
10025TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
10026 OMPParallelMaskedTaskLoopSimdDirective *
D) {
10027 DeclarationNameInfo DirName;
10028 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10029 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
10030 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10031 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10035template <
typename Derived>
10036StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
10037 OMPDistributeDirective *
D) {
10038 DeclarationNameInfo DirName;
10039 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10041 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10042 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10046template <
typename Derived>
10047StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
10048 OMPDistributeParallelForDirective *
D) {
10049 DeclarationNameInfo DirName;
10050 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10051 OMPD_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10052 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10053 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10057template <
typename Derived>
10059TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
10060 OMPDistributeParallelForSimdDirective *
D) {
10061 DeclarationNameInfo DirName;
10062 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10063 OMPD_distribute_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10064 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10065 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10069template <
typename Derived>
10070StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
10071 OMPDistributeSimdDirective *
D) {
10072 DeclarationNameInfo DirName;
10073 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10074 OMPD_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10075 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10076 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10080template <
typename Derived>
10081StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
10082 OMPTargetParallelForSimdDirective *
D) {
10083 DeclarationNameInfo DirName;
10084 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10085 OMPD_target_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
10086 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10087 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10091template <
typename Derived>
10092StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
10093 OMPTargetSimdDirective *
D) {
10094 DeclarationNameInfo DirName;
10095 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10096 OMPD_target_simd, DirName,
nullptr,
D->
getBeginLoc());
10097 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10098 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10102template <
typename Derived>
10103StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
10104 OMPTeamsDistributeDirective *
D) {
10105 DeclarationNameInfo DirName;
10106 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10107 OMPD_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10108 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10109 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10113template <
typename Derived>
10114StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
10115 OMPTeamsDistributeSimdDirective *
D) {
10116 DeclarationNameInfo DirName;
10117 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10118 OMPD_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10119 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10120 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10124template <
typename Derived>
10125StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
10126 OMPTeamsDistributeParallelForSimdDirective *
D) {
10127 DeclarationNameInfo DirName;
10128 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10129 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10131 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10132 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10136template <
typename Derived>
10137StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
10138 OMPTeamsDistributeParallelForDirective *
D) {
10139 DeclarationNameInfo DirName;
10140 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10141 OMPD_teams_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
10142 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10143 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10147template <
typename Derived>
10148StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
10149 OMPTargetTeamsDirective *
D) {
10150 DeclarationNameInfo DirName;
10151 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10152 OMPD_target_teams, DirName,
nullptr,
D->
getBeginLoc());
10153 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10154 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10158template <
typename Derived>
10159StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
10160 OMPTargetTeamsDistributeDirective *
D) {
10161 DeclarationNameInfo DirName;
10162 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10163 OMPD_target_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
10164 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10165 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10169template <
typename Derived>
10171TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
10172 OMPTargetTeamsDistributeParallelForDirective *
D) {
10173 DeclarationNameInfo DirName;
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10177 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10178 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10182template <
typename Derived>
10184 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
10185 OMPTargetTeamsDistributeParallelForSimdDirective *
D) {
10186 DeclarationNameInfo DirName;
10187 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10188 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10190 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10191 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10195template <
typename Derived>
10197TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
10198 OMPTargetTeamsDistributeSimdDirective *
D) {
10199 DeclarationNameInfo DirName;
10200 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10201 OMPD_target_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
10202 auto Res = getDerived().TransformOMPExecutableDirective(
D);
10203 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10207template <
typename Derived>
10209TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *
D) {
10210 DeclarationNameInfo DirName;
10211 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10213 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10214 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10218template <
typename Derived>
10220TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *
D) {
10221 DeclarationNameInfo DirName;
10222 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10224 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10225 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10229template <
typename Derived>
10231TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *
D) {
10232 DeclarationNameInfo DirName;
10233 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10235 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10236 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10240template <
typename Derived>
10241StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
10242 OMPGenericLoopDirective *
D) {
10243 DeclarationNameInfo DirName;
10244 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10246 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10247 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10251template <
typename Derived>
10252StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
10253 OMPTeamsGenericLoopDirective *
D) {
10254 DeclarationNameInfo DirName;
10255 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10257 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10258 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10262template <
typename Derived>
10263StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
10264 OMPTargetTeamsGenericLoopDirective *
D) {
10265 DeclarationNameInfo DirName;
10266 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10267 OMPD_target_teams_loop, DirName,
nullptr,
D->
getBeginLoc());
10268 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10269 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10273template <
typename Derived>
10274StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
10275 OMPParallelGenericLoopDirective *
D) {
10276 DeclarationNameInfo DirName;
10277 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10278 OMPD_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10279 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10280 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10284template <
typename Derived>
10286TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
10287 OMPTargetParallelGenericLoopDirective *
D) {
10288 DeclarationNameInfo DirName;
10289 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10290 OMPD_target_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10291 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10292 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10299template <
typename Derived>
10300OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
10301 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10302 if (Cond.isInvalid())
10304 return getDerived().RebuildOMPIfClause(
10305 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10306 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10309template <
typename Derived>
10310OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
10311 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10312 if (Cond.isInvalid())
10314 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10315 C->getLParenLoc(),
C->getEndLoc());
10318template <
typename Derived>
10320TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
10321 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10322 if (NumThreads.isInvalid())
10324 return getDerived().RebuildOMPNumThreadsClause(
10325 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10328template <
typename Derived>
10330TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
10331 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10334 return getDerived().RebuildOMPSafelenClause(
10335 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10338template <
typename Derived>
10340TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
10341 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10344 return getDerived().RebuildOMPAllocatorClause(
10345 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10348template <
typename Derived>
10350TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
10351 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10354 return getDerived().RebuildOMPSimdlenClause(
10355 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10358template <
typename Derived>
10359OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
10361 TransformedSizes.reserve(
C->getNumSizes());
10363 for (Expr *
E :
C->getSizesRefs()) {
10365 TransformedSizes.push_back(
nullptr);
10374 TransformedSizes.push_back(
T.get());
10377 if (!Changed && !getDerived().AlwaysRebuild())
10379 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10380 C->getLParenLoc(),
C->getEndLoc());
10383template <
typename Derived>
10385TreeTransform<Derived>::TransformOMPPermutationClause(OMPPermutationClause *
C) {
10387 TransformedArgs.reserve(
C->getNumLoops());
10389 for (Expr *
E :
C->getArgsRefs()) {
10391 TransformedArgs.push_back(
nullptr);
10400 TransformedArgs.push_back(
T.get());
10403 if (!Changed && !getDerived().AlwaysRebuild())
10405 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10406 C->getLParenLoc(),
C->getEndLoc());
10409template <
typename Derived>
10410OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10411 if (!getDerived().AlwaysRebuild())
10413 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10416template <
typename Derived>
10418TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10419 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10422 Expr *Factor =
T.get();
10423 bool Changed = Factor !=
C->getFactor();
10425 if (!Changed && !getDerived().AlwaysRebuild())
10427 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10431template <
typename Derived>
10433TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10434 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10437 return getDerived().RebuildOMPCollapseClause(
10438 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10441template <
typename Derived>
10443TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10444 return getDerived().RebuildOMPDefaultClause(
10445 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10446 C->getLParenLoc(),
C->getEndLoc());
10449template <
typename Derived>
10451TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10452 return getDerived().RebuildOMPProcBindClause(
10453 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10454 C->getLParenLoc(),
C->getEndLoc());
10457template <
typename Derived>
10459TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10460 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10463 return getDerived().RebuildOMPScheduleClause(
10464 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10465 C->getScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10466 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10467 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10470template <
typename Derived>
10472TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10474 if (
auto *
Num =
C->getNumForLoops()) {
10475 E = getDerived().TransformExpr(
Num);
10479 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10480 C->getLParenLoc(),
E.get());
10483template <
typename Derived>
10485TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10487 if (Expr *Evt =
C->getEventHandler()) {
10488 E = getDerived().TransformExpr(Evt);
10492 return getDerived().RebuildOMPDetachClause(
E.get(),
C->getBeginLoc(),
10493 C->getLParenLoc(),
C->getEndLoc());
10496template <
typename Derived>
10498TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10503template <
typename Derived>
10505TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10510template <
typename Derived>
10512TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10517template <
typename Derived>
10518OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10523template <
typename Derived>
10524OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10529template <
typename Derived>
10531TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10536template <
typename Derived>
10538TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10543template <
typename Derived>
10545TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10550template <
typename Derived>
10551OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10556template <
typename Derived>
10558TreeTransform<Derived>::TransformOMPAbsentClause(OMPAbsentClause *
C) {
10562template <
typename Derived>
10563OMPClause *TreeTransform<Derived>::TransformOMPHoldsClause(OMPHoldsClause *
C) {
10564 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10567 return getDerived().RebuildOMPHoldsClause(
E.get(),
C->getBeginLoc(),
10568 C->getLParenLoc(),
C->getEndLoc());
10571template <
typename Derived>
10573TreeTransform<Derived>::TransformOMPContainsClause(OMPContainsClause *
C) {
10577template <
typename Derived>
10579TreeTransform<Derived>::TransformOMPNoOpenMPClause(OMPNoOpenMPClause *
C) {
10582template <
typename Derived>
10583OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPRoutinesClause(
10584 OMPNoOpenMPRoutinesClause *
C) {
10587template <
typename Derived>
10588OMPClause *TreeTransform<Derived>::TransformOMPNoParallelismClause(
10589 OMPNoParallelismClause *
C) {
10593template <
typename Derived>
10595TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10600template <
typename Derived>
10602TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10607template <
typename Derived>
10609TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10614template <
typename Derived>
10616TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10621template <
typename Derived>
10623TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10628template <
typename Derived>
10629OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10634template <
typename Derived>
10636TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10641template <
typename Derived>
10642OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10647template <
typename Derived>
10649TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10654template <
typename Derived>
10655OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10656 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10657 if (IVR.isInvalid())
10660 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10661 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10662 for (Expr *
E : llvm::drop_begin(
C->varlist())) {
10663 ExprResult ER = getDerived().TransformExpr(cast<Expr>(
E));
10664 if (ER.isInvalid())
10666 InteropInfo.PreferTypes.push_back(ER.get());
10668 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10669 C->getBeginLoc(),
C->getLParenLoc(),
10670 C->getVarLoc(),
C->getEndLoc());
10673template <
typename Derived>
10674OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10675 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10676 if (ER.isInvalid())
10678 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10679 C->getLParenLoc(),
C->getVarLoc(),
10683template <
typename Derived>
10685TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10687 if (Expr *IV =
C->getInteropVar()) {
10688 ER = getDerived().TransformExpr(IV);
10689 if (ER.isInvalid())
10692 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10693 C->getLParenLoc(),
C->getVarLoc(),
10697template <
typename Derived>
10699TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10700 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10701 if (Cond.isInvalid())
10703 return getDerived().RebuildOMPNovariantsClause(
10704 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10707template <
typename Derived>
10709TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10710 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10711 if (Cond.isInvalid())
10713 return getDerived().RebuildOMPNocontextClause(
10714 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10717template <
typename Derived>
10719TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10720 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10721 if (ThreadID.isInvalid())
10723 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10724 C->getLParenLoc(),
C->getEndLoc());
10727template <
typename Derived>
10728OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10729 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10732 return getDerived().RebuildOMPAlignClause(
E.get(),
C->getBeginLoc(),
10733 C->getLParenLoc(),
C->getEndLoc());
10736template <
typename Derived>
10737OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10738 OMPUnifiedAddressClause *
C) {
10739 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10742template <
typename Derived>
10743OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10744 OMPUnifiedSharedMemoryClause *
C) {
10746 "unified_shared_memory clause cannot appear in dependent context");
10749template <
typename Derived>
10750OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10751 OMPReverseOffloadClause *
C) {
10752 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10755template <
typename Derived>
10756OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10757 OMPDynamicAllocatorsClause *
C) {
10759 "dynamic_allocators clause cannot appear in dependent context");
10762template <
typename Derived>
10763OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10764 OMPAtomicDefaultMemOrderClause *
C) {
10766 "atomic_default_mem_order clause cannot appear in dependent context");
10769template <
typename Derived>
10770OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10771 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10772 C->getBeginLoc(),
C->getLParenLoc(),
10776template <
typename Derived>
10778TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10779 return getDerived().RebuildOMPSeverityClause(
10780 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10781 C->getLParenLoc(),
C->getEndLoc());
10784template <
typename Derived>
10786TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10787 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10790 return getDerived().RebuildOMPMessageClause(
10791 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10795template <
typename Derived>
10797TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10799 Vars.reserve(
C->varlist_size());
10800 for (
auto *VE :
C->varlist()) {
10801 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10802 if (EVar.isInvalid())
10804 Vars.push_back(EVar.get());
10806 return getDerived().RebuildOMPPrivateClause(
10807 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10810template <
typename Derived>
10811OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10812 OMPFirstprivateClause *
C) {
10814 Vars.reserve(
C->varlist_size());
10815 for (
auto *VE :
C->varlist()) {
10816 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10817 if (EVar.isInvalid())
10819 Vars.push_back(EVar.get());
10821 return getDerived().RebuildOMPFirstprivateClause(
10822 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10825template <
typename Derived>
10827TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10829 Vars.reserve(
C->varlist_size());
10830 for (
auto *VE :
C->varlist()) {
10831 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10832 if (EVar.isInvalid())
10834 Vars.push_back(EVar.get());
10836 return getDerived().RebuildOMPLastprivateClause(
10837 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10838 C->getLParenLoc(),
C->getEndLoc());
10841template <
typename Derived>
10843TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10845 Vars.reserve(
C->varlist_size());
10846 for (
auto *VE :
C->varlist()) {
10847 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10848 if (EVar.isInvalid())
10850 Vars.push_back(EVar.get());
10852 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10853 C->getLParenLoc(),
C->getEndLoc());
10856template <
typename Derived>
10858TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10860 Vars.reserve(
C->varlist_size());
10861 for (
auto *VE :
C->varlist()) {
10862 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10863 if (EVar.isInvalid())
10865 Vars.push_back(EVar.get());
10867 CXXScopeSpec ReductionIdScopeSpec;
10868 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10870 DeclarationNameInfo NameInfo =
C->getNameInfo();
10871 if (NameInfo.getName()) {
10872 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10873 if (!NameInfo.getName())
10879 for (
auto *
E :
C->reduction_ops()) {
10882 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10883 UnresolvedSet<8> Decls;
10884 for (
auto *
D : ULE->decls()) {
10886 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10887 Decls.addDecl(InstD, InstD->getAccess());
10891 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10892 true, Decls.begin(), Decls.end(),
10895 UnresolvedReductions.push_back(
nullptr);
10897 return getDerived().RebuildOMPReductionClause(
10898 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10899 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10900 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10903template <
typename Derived>
10904OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10905 OMPTaskReductionClause *
C) {
10907 Vars.reserve(
C->varlist_size());
10908 for (
auto *VE :
C->varlist()) {
10909 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10910 if (EVar.isInvalid())
10912 Vars.push_back(EVar.get());
10914 CXXScopeSpec ReductionIdScopeSpec;
10915 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10917 DeclarationNameInfo NameInfo =
C->getNameInfo();
10918 if (NameInfo.getName()) {
10919 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10920 if (!NameInfo.getName())
10926 for (
auto *
E :
C->reduction_ops()) {
10929 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10930 UnresolvedSet<8> Decls;
10931 for (
auto *
D : ULE->decls()) {
10933 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10934 Decls.addDecl(InstD, InstD->getAccess());
10938 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10939 true, Decls.begin(), Decls.end(),
10942 UnresolvedReductions.push_back(
nullptr);
10944 return getDerived().RebuildOMPTaskReductionClause(
10945 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10946 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10949template <
typename Derived>
10951TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10953 Vars.reserve(
C->varlist_size());
10954 for (
auto *VE :
C->varlist()) {
10955 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10956 if (EVar.isInvalid())
10958 Vars.push_back(EVar.get());
10960 CXXScopeSpec ReductionIdScopeSpec;
10961 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10963 DeclarationNameInfo NameInfo =
C->getNameInfo();
10964 if (NameInfo.getName()) {
10965 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10966 if (!NameInfo.getName())
10972 for (
auto *
E :
C->reduction_ops()) {
10975 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10976 UnresolvedSet<8> Decls;
10977 for (
auto *
D : ULE->decls()) {
10979 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10980 Decls.addDecl(InstD, InstD->getAccess());
10984 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10985 true, Decls.begin(), Decls.end(),
10988 UnresolvedReductions.push_back(
nullptr);
10990 return getDerived().RebuildOMPInReductionClause(
10991 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10992 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10995template <
typename Derived>
10997TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
10999 Vars.reserve(
C->varlist_size());
11000 for (
auto *VE :
C->varlist()) {
11001 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11002 if (EVar.isInvalid())
11004 Vars.push_back(EVar.get());
11006 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11007 if (Step.isInvalid())
11009 return getDerived().RebuildOMPLinearClause(
11010 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11011 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11015template <
typename Derived>
11017TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
11019 Vars.reserve(
C->varlist_size());
11020 for (
auto *VE :
C->varlist()) {
11021 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11022 if (EVar.isInvalid())
11024 Vars.push_back(EVar.get());
11026 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11027 if (Alignment.isInvalid())
11029 return getDerived().RebuildOMPAlignedClause(
11030 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11031 C->getColonLoc(),
C->getEndLoc());
11034template <
typename Derived>
11036TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
11038 Vars.reserve(
C->varlist_size());
11039 for (
auto *VE :
C->varlist()) {
11040 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11041 if (EVar.isInvalid())
11043 Vars.push_back(EVar.get());
11045 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11046 C->getLParenLoc(),
C->getEndLoc());
11049template <
typename Derived>
11051TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
11053 Vars.reserve(
C->varlist_size());
11054 for (
auto *VE :
C->varlist()) {
11055 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11056 if (EVar.isInvalid())
11058 Vars.push_back(EVar.get());
11060 return getDerived().RebuildOMPCopyprivateClause(
11061 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11064template <
typename Derived>
11065OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
11067 Vars.reserve(
C->varlist_size());
11068 for (
auto *VE :
C->varlist()) {
11069 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11070 if (EVar.isInvalid())
11072 Vars.push_back(EVar.get());
11074 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11075 C->getLParenLoc(),
C->getEndLoc());
11078template <
typename Derived>
11080TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
11081 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11084 return getDerived().RebuildOMPDepobjClause(
E.get(),
C->getBeginLoc(),
11085 C->getLParenLoc(),
C->getEndLoc());
11088template <
typename Derived>
11090TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
11092 Expr *DepModifier =
C->getModifier();
11094 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11095 if (DepModRes.isInvalid())
11097 DepModifier = DepModRes.
get();
11099 Vars.reserve(
C->varlist_size());
11100 for (
auto *VE :
C->varlist()) {
11101 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11102 if (EVar.isInvalid())
11104 Vars.push_back(EVar.get());
11106 return getDerived().RebuildOMPDependClause(
11107 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11108 C->getOmpAllMemoryLoc()},
11109 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11112template <
typename Derived>
11114TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
11115 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11118 return getDerived().RebuildOMPDeviceClause(
11119 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11120 C->getModifierLoc(),
C->getEndLoc());
11123template <
typename Derived,
class T>
11130 Vars.reserve(
C->varlist_size());
11131 for (
auto *VE :
C->varlist()) {
11135 Vars.push_back(EVar.
get());
11139 if (
C->getMapperQualifierLoc()) {
11140 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11141 C->getMapperQualifierLoc());
11145 MapperIdScopeSpec.
Adopt(QualifierLoc);
11146 MapperIdInfo =
C->getMapperIdInfo();
11147 if (MapperIdInfo.
getName()) {
11148 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11154 for (
auto *
E :
C->mapperlists()) {
11157 auto *ULE = cast<UnresolvedLookupExpr>(
E);
11159 for (
auto *
D : ULE->decls()) {
11167 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
11170 UnresolvedMappers.push_back(
nullptr);
11176template <
typename Derived>
11177OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11178 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11180 Expr *IteratorModifier =
C->getIteratorModifier();
11181 if (IteratorModifier) {
11182 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11183 if (MapModRes.isInvalid())
11185 IteratorModifier = MapModRes.
get();
11187 CXXScopeSpec MapperIdScopeSpec;
11188 DeclarationNameInfo MapperIdInfo;
11190 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
11191 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11193 return getDerived().RebuildOMPMapClause(
11194 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11195 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11196 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11199template <
typename Derived>
11201TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
11202 Expr *Allocator =
C->getAllocator();
11204 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11205 if (AllocatorRes.isInvalid())
11207 Allocator = AllocatorRes.get();
11210 Vars.reserve(
C->varlist_size());
11211 for (
auto *VE :
C->varlist()) {
11212 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11213 if (EVar.isInvalid())
11215 Vars.push_back(EVar.get());
11217 return getDerived().RebuildOMPAllocateClause(
11218 Allocator,
C->getAllocatorModifier(), Vars,
C->getBeginLoc(),
11219 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11222template <
typename Derived>
11224TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
11226 Vars.reserve(
C->varlist_size());
11227 for (
auto *VE :
C->varlist()) {
11228 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11229 if (EVar.isInvalid())
11231 Vars.push_back(EVar.get());
11233 return getDerived().RebuildOMPNumTeamsClause(
11234 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11237template <
typename Derived>
11239TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
11241 Vars.reserve(
C->varlist_size());
11242 for (
auto *VE :
C->varlist()) {
11243 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11244 if (EVar.isInvalid())
11246 Vars.push_back(EVar.get());
11248 return getDerived().RebuildOMPThreadLimitClause(
11249 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11252template <
typename Derived>
11254TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
11255 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11258 return getDerived().RebuildOMPPriorityClause(
11259 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11262template <
typename Derived>
11264TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
11265 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11268 return getDerived().RebuildOMPGrainsizeClause(
11269 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11270 C->getModifierLoc(),
C->getEndLoc());
11273template <
typename Derived>
11275TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
11276 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11279 return getDerived().RebuildOMPNumTasksClause(
11280 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11281 C->getModifierLoc(),
C->getEndLoc());
11284template <
typename Derived>
11285OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
11286 ExprResult E = getDerived().TransformExpr(
C->getHint());
11289 return getDerived().RebuildOMPHintClause(
E.get(),
C->getBeginLoc(),
11290 C->getLParenLoc(),
C->getEndLoc());
11293template <
typename Derived>
11294OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
11295 OMPDistScheduleClause *
C) {
11296 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11299 return getDerived().RebuildOMPDistScheduleClause(
11300 C->getDistScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11301 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11304template <
typename Derived>
11306TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
11309 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
11310 C->getDefaultmapKind(),
11313 C->getDefaultmapModifierLoc(),
11314 C->getDefaultmapKindLoc(),
11318template <
typename Derived>
11319OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
11320 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11322 CXXScopeSpec MapperIdScopeSpec;
11323 DeclarationNameInfo MapperIdInfo;
11325 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
11326 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11328 return getDerived().RebuildOMPToClause(
11329 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11330 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11333template <
typename Derived>
11334OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
11335 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11337 CXXScopeSpec MapperIdScopeSpec;
11338 DeclarationNameInfo MapperIdInfo;
11340 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
11341 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11343 return getDerived().RebuildOMPFromClause(
11344 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11345 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11348template <
typename Derived>
11349OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
11350 OMPUseDevicePtrClause *
C) {
11352 Vars.reserve(
C->varlist_size());
11353 for (
auto *VE :
C->varlist()) {
11354 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11355 if (EVar.isInvalid())
11357 Vars.push_back(EVar.get());
11359 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11360 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11363template <
typename Derived>
11364OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
11365 OMPUseDeviceAddrClause *
C) {
11367 Vars.reserve(
C->varlist_size());
11368 for (
auto *VE :
C->varlist()) {
11369 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11370 if (EVar.isInvalid())
11372 Vars.push_back(EVar.get());
11374 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11375 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11378template <
typename Derived>
11380TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
11382 Vars.reserve(
C->varlist_size());
11383 for (
auto *VE :
C->varlist()) {
11384 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11385 if (EVar.isInvalid())
11387 Vars.push_back(EVar.get());
11389 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11390 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11393template <
typename Derived>
11394OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
11395 OMPHasDeviceAddrClause *
C) {
11397 Vars.reserve(
C->varlist_size());
11398 for (
auto *VE :
C->varlist()) {
11399 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11400 if (EVar.isInvalid())
11402 Vars.push_back(EVar.get());
11404 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11405 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11408template <
typename Derived>
11410TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
11412 Vars.reserve(
C->varlist_size());
11413 for (
auto *VE :
C->varlist()) {
11414 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11415 if (EVar.isInvalid())
11417 Vars.push_back(EVar.get());
11419 return getDerived().RebuildOMPNontemporalClause(
11420 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11423template <
typename Derived>
11425TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
11427 Vars.reserve(
C->varlist_size());
11428 for (
auto *VE :
C->varlist()) {
11429 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11430 if (EVar.isInvalid())
11432 Vars.push_back(EVar.get());
11434 return getDerived().RebuildOMPInclusiveClause(
11435 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11438template <
typename Derived>
11440TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
11442 Vars.reserve(
C->varlist_size());
11443 for (
auto *VE :
C->varlist()) {
11444 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11445 if (EVar.isInvalid())
11447 Vars.push_back(EVar.get());
11449 return getDerived().RebuildOMPExclusiveClause(
11450 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11453template <
typename Derived>
11454OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11455 OMPUsesAllocatorsClause *
C) {
11457 Data.reserve(
C->getNumberOfAllocators());
11458 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
11459 OMPUsesAllocatorsClause::Data
D =
C->getAllocatorData(I);
11460 ExprResult Allocator = getDerived().TransformExpr(
D.Allocator);
11461 if (Allocator.isInvalid())
11464 if (Expr *AT =
D.AllocatorTraits) {
11465 AllocatorTraits = getDerived().TransformExpr(AT);
11466 if (AllocatorTraits.isInvalid())
11469 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11470 NewD.Allocator = Allocator.get();
11471 NewD.AllocatorTraits = AllocatorTraits.get();
11472 NewD.LParenLoc =
D.LParenLoc;
11473 NewD.RParenLoc =
D.RParenLoc;
11475 return getDerived().RebuildOMPUsesAllocatorsClause(
11476 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11479template <
typename Derived>
11481TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11483 Locators.reserve(
C->varlist_size());
11485 if (Expr *Modifier =
C->getModifier()) {
11486 ModifierRes = getDerived().TransformExpr(Modifier);
11487 if (ModifierRes.isInvalid())
11490 for (Expr *
E :
C->varlist()) {
11491 ExprResult Locator = getDerived().TransformExpr(
E);
11492 if (Locator.isInvalid())
11494 Locators.push_back(Locator.get());
11496 return getDerived().RebuildOMPAffinityClause(
11497 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11498 ModifierRes.get(), Locators);
11501template <
typename Derived>
11502OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11503 return getDerived().RebuildOMPOrderClause(
11504 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11505 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11508template <
typename Derived>
11509OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11510 return getDerived().RebuildOMPBindClause(
11511 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11512 C->getLParenLoc(),
C->getEndLoc());
11515template <
typename Derived>
11516OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11517 OMPXDynCGroupMemClause *
C) {
11519 if (
Size.isInvalid())
11521 return getDerived().RebuildOMPXDynCGroupMemClause(
11522 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11525template <
typename Derived>
11527TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11529 Vars.reserve(
C->varlist_size());
11530 for (
auto *VE :
C->varlist()) {
11531 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11532 if (EVar.isInvalid())
11534 Vars.push_back(EVar.get());
11536 return getDerived().RebuildOMPDoacrossClause(
11537 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11538 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11541template <
typename Derived>
11543TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11545 for (
auto *A :
C->getAttrs())
11546 NewAttrs.push_back(getDerived().TransformAttr(A));
11547 return getDerived().RebuildOMPXAttributeClause(
11548 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11551template <
typename Derived>
11552OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11553 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11560template <
typename Derived>
11561class OpenACCClauseTransform final
11562 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11563 TreeTransform<Derived> &Self;
11565 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11566 OpenACCClause *NewClause =
nullptr;
11570 for (Expr *CurVar : VarList) {
11571 ExprResult Res = Self.TransformExpr(CurVar);
11573 if (!Res.isUsable())
11576 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getClauseKind(),
11579 if (Res.isUsable())
11580 InstantiatedVarList.push_back(Res.get());
11583 return InstantiatedVarList;
11587 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11589 SemaOpenACC::OpenACCParsedClause &PC)
11590 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11592 OpenACCClause *CreatedClause()
const {
return NewClause; }
11594#define VISIT_CLAUSE(CLAUSE_NAME) \
11595 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11596#include "clang/Basic/OpenACCClauses.def"
11599template <
typename Derived>
11600void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11601 const OpenACCDefaultClause &
C) {
11610template <
typename Derived>
11611void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11612 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11613 assert(Cond &&
"If constructed with invalid Condition");
11614 Sema::ConditionResult Res =
Self.TransformCondition(
11617 if (Res.isInvalid() || !Res.get().second)
11628template <
typename Derived>
11629void OpenACCClauseTransform<Derived>::VisitSelfClause(
11630 const OpenACCSelfClause &
C) {
11632 if (
C.hasConditionExpr()) {
11633 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11634 Sema::ConditionResult Res =
11635 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11638 if (Res.isInvalid() || !Res.get().second)
11650template <
typename Derived>
11651void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11652 const OpenACCNumGangsClause &
C) {
11655 for (Expr *CurIntExpr :
C.getIntExprs()) {
11658 if (!Res.isUsable())
11663 C.getBeginLoc(), Res.get());
11664 if (!Res.isUsable())
11667 InstantiatedIntExprs.push_back(Res.get());
11677template <
typename Derived>
11678void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11679 const OpenACCPrivateClause &
C) {
11689template <
typename Derived>
11690void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11691 const OpenACCFirstPrivateClause &
C) {
11701template <
typename Derived>
11702void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11703 const OpenACCNoCreateClause &
C) {
11713template <
typename Derived>
11714void OpenACCClauseTransform<Derived>::VisitPresentClause(
11715 const OpenACCPresentClause &
C) {
11725template <
typename Derived>
11726void OpenACCClauseTransform<Derived>::VisitCopyClause(
11727 const OpenACCCopyClause &
C) {
11737template <
typename Derived>
11738void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11739 const OpenACCCopyInClause &
C) {
11750template <
typename Derived>
11751void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11752 const OpenACCCopyOutClause &
C) {
11754 false,
C.isZero());
11763template <
typename Derived>
11764void OpenACCClauseTransform<Derived>::VisitCreateClause(
11765 const OpenACCCreateClause &
C) {
11767 false,
C.isZero());
11775template <
typename Derived>
11776void OpenACCClauseTransform<Derived>::VisitAttachClause(
11777 const OpenACCAttachClause &
C) {
11781 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11782 return Self.getSema().OpenACC().CheckVarIsPointerType(
11783 OpenACCClauseKind::Attach, E);
11784 }), VarList.end());
11794template <
typename Derived>
11795void OpenACCClauseTransform<Derived>::VisitDetachClause(
11796 const OpenACCDetachClause &
C) {
11801 std::remove_if(VarList.begin(), VarList.end(),
11803 return Self.getSema().OpenACC().CheckVarIsPointerType(
11804 OpenACCClauseKind::Detach, E);
11816template <
typename Derived>
11817void OpenACCClauseTransform<Derived>::VisitDeleteClause(
11818 const OpenACCDeleteClause &
C) {
11827template <
typename Derived>
11828void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
11829 const OpenACCUseDeviceClause &
C) {
11838template <
typename Derived>
11839void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
11840 const OpenACCDevicePtrClause &
C) {
11844 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11845 return Self.getSema().OpenACC().CheckVarIsPointerType(
11846 OpenACCClauseKind::DevicePtr, E);
11847 }), VarList.end());
11857template <
typename Derived>
11858void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
11859 const OpenACCNumWorkersClause &
C) {
11860 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11861 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
11864 if (!Res.isUsable())
11869 C.getBeginLoc(), Res.get());
11870 if (!Res.isUsable())
11880template <
typename Derived>
11881void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
11882 const OpenACCDeviceNumClause &
C) {
11883 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11884 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
11887 if (!Res.isUsable())
11892 C.getBeginLoc(), Res.get());
11893 if (!Res.isUsable())
11903template <
typename Derived>
11904void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
11905 const OpenACCVectorLengthClause &
C) {
11906 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11907 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
11910 if (!Res.isUsable())
11915 C.getBeginLoc(), Res.get());
11916 if (!Res.isUsable())
11926template <
typename Derived>
11927void OpenACCClauseTransform<Derived>::VisitAsyncClause(
11928 const OpenACCAsyncClause &
C) {
11929 if (
C.hasIntExpr()) {
11930 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
11931 if (!Res.isUsable())
11936 C.getBeginLoc(), Res.get());
11937 if (!Res.isUsable())
11950template <
typename Derived>
11951void OpenACCClauseTransform<Derived>::VisitWorkerClause(
11952 const OpenACCWorkerClause &
C) {
11953 if (
C.hasIntExpr()) {
11957 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
11958 if (!Res.isUsable())
11963 C.getBeginLoc(), Res.get());
11964 if (!Res.isUsable())
11977template <
typename Derived>
11978void OpenACCClauseTransform<Derived>::VisitVectorClause(
11979 const OpenACCVectorClause &
C) {
11980 if (
C.hasIntExpr()) {
11984 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
11985 if (!Res.isUsable())
11990 C.getBeginLoc(), Res.get());
11991 if (!Res.isUsable())
12004template <
typename Derived>
12005void OpenACCClauseTransform<Derived>::VisitWaitClause(
12006 const OpenACCWaitClause &
C) {
12007 if (!
C.getLParenLoc().isInvalid()) {
12008 Expr *DevNumExpr =
nullptr;
12012 if (
C.getDevNumExpr()) {
12014 if (!Res.isUsable())
12018 C.getBeginLoc(), Res.get());
12019 if (!Res.isUsable())
12022 DevNumExpr = Res.get();
12026 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12028 if (!Res.isUsable())
12032 C.getBeginLoc(), Res.get());
12033 if (!Res.isUsable())
12036 InstantiatedQueueIdExprs.push_back(Res.get());
12040 std::move(InstantiatedQueueIdExprs));
12050template <
typename Derived>
12051void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12052 const OpenACCDeviceTypeClause &
C) {
12055 Self.getSema().getASTContext(),
C.getClauseKind(),
12057 C.getArchitectures(), ParsedClause.
getEndLoc());
12060template <
typename Derived>
12061void OpenACCClauseTransform<Derived>::VisitAutoClause(
12062 const OpenACCAutoClause &
C) {
12069template <
typename Derived>
12070void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12071 const OpenACCIndependentClause &
C) {
12077template <
typename Derived>
12078void OpenACCClauseTransform<Derived>::VisitSeqClause(
12079 const OpenACCSeqClause &
C) {
12084template <
typename Derived>
12085void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12086 const OpenACCFinalizeClause &
C) {
12092template <
typename Derived>
12093void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12094 const OpenACCIfPresentClause &
C) {
12100template <
typename Derived>
12101void OpenACCClauseTransform<Derived>::VisitReductionClause(
12102 const OpenACCReductionClause &
C) {
12106 for (Expr *Var : TransformedVars) {
12109 if (Res.isUsable())
12110 ValidVars.push_back(Res.get());
12113 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12116 C.getReductionOp(), ValidVars, ParsedClause.
getEndLoc());
12119template <
typename Derived>
12120void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12121 const OpenACCCollapseClause &
C) {
12122 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12123 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12127 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12129 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12132 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12134 if (!NewLoopCount.isUsable())
12144template <
typename Derived>
12145void OpenACCClauseTransform<Derived>::VisitTileClause(
12146 const OpenACCTileClause &
C) {
12150 for (Expr *
E :
C.getSizeExprs()) {
12153 if (!NewSizeExpr.isUsable())
12156 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12158 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12160 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12162 if (!NewSizeExpr.isUsable())
12164 TransformedExprs.push_back(NewSizeExpr.get());
12173template <
typename Derived>
12174void OpenACCClauseTransform<Derived>::VisitGangClause(
12175 const OpenACCGangClause &
C) {
12179 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12180 ExprResult ER =
Self.TransformExpr(
const_cast<Expr *
>(
C.getExpr(I).second));
12181 if (!ER.isUsable())
12184 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12186 C.getExpr(I).first, ER.get());
12187 if (!ER.isUsable())
12189 TransformedGangKinds.push_back(
C.getExpr(I).first);
12190 TransformedIntExprs.push_back(ER.get());
12193 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12196 TransformedGangKinds, TransformedIntExprs, ParsedClause.
getEndLoc());
12199template <
typename Derived>
12200OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12204 SemaOpenACC::OpenACCParsedClause ParsedClause(
12205 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12206 ParsedClause.
setEndLoc(OldClause->getEndLoc());
12208 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12211 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12213 Transform.Visit(OldClause);
12215 return Transform.CreatedClause();
12218template <
typename Derived>
12220TreeTransform<Derived>::TransformOpenACCClauseList(
12223 for (
const auto *Clause : OldClauses) {
12224 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12225 TransformedClauses, DirKind, Clause))
12226 TransformedClauses.push_back(TransformedClause);
12228 return TransformedClauses;
12231template <
typename Derived>
12232StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
12233 OpenACCComputeConstruct *
C) {
12234 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12237 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12240 if (getSema().OpenACC().ActOnStartStmtDirective(
12241 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12245 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12246 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12247 C->clauses(), TransformedClauses);
12248 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12249 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12250 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12252 return getDerived().RebuildOpenACCComputeConstruct(
12253 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12254 C->getEndLoc(), TransformedClauses, StrBlock);
12257template <
typename Derived>
12259TreeTransform<Derived>::TransformOpenACCLoopConstruct(OpenACCLoopConstruct *
C) {
12261 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12264 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12267 if (getSema().OpenACC().ActOnStartStmtDirective(
12268 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12272 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12273 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12274 C->clauses(), TransformedClauses);
12276 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12277 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12279 return getDerived().RebuildOpenACCLoopConstruct(
12280 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12281 TransformedClauses,
Loop);
12284template <
typename Derived>
12285StmtResult TreeTransform<Derived>::TransformOpenACCCombinedConstruct(
12286 OpenACCCombinedConstruct *
C) {
12287 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12290 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12293 if (getSema().OpenACC().ActOnStartStmtDirective(
12294 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12298 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12299 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12300 C->clauses(), TransformedClauses);
12302 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12303 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12305 return getDerived().RebuildOpenACCCombinedConstruct(
12306 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12307 C->getEndLoc(), TransformedClauses,
Loop);
12310template <
typename Derived>
12312TreeTransform<Derived>::TransformOpenACCDataConstruct(OpenACCDataConstruct *
C) {
12313 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12316 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12318 if (getSema().OpenACC().ActOnStartStmtDirective(
12319 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12322 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12323 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12324 C->clauses(), TransformedClauses);
12325 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12326 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12327 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12329 return getDerived().RebuildOpenACCDataConstruct(
12330 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12331 TransformedClauses, StrBlock);
12334template <
typename Derived>
12335StmtResult TreeTransform<Derived>::TransformOpenACCEnterDataConstruct(
12336 OpenACCEnterDataConstruct *
C) {
12337 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12340 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12342 if (getSema().OpenACC().ActOnStartStmtDirective(
12343 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12346 return getDerived().RebuildOpenACCEnterDataConstruct(
12347 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12348 TransformedClauses);
12351template <
typename Derived>
12352StmtResult TreeTransform<Derived>::TransformOpenACCExitDataConstruct(
12353 OpenACCExitDataConstruct *
C) {
12354 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12357 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12359 if (getSema().OpenACC().ActOnStartStmtDirective(
12360 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12363 return getDerived().RebuildOpenACCExitDataConstruct(
12364 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12365 TransformedClauses);
12368template <
typename Derived>
12369StmtResult TreeTransform<Derived>::TransformOpenACCHostDataConstruct(
12370 OpenACCHostDataConstruct *
C) {
12371 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12374 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12376 if (getSema().OpenACC().ActOnStartStmtDirective(
12377 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12380 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(
12381 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12382 C->clauses(), TransformedClauses);
12383 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12384 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12385 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12387 return getDerived().RebuildOpenACCHostDataConstruct(
12388 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12389 TransformedClauses, StrBlock);
12392template <
typename Derived>
12394TreeTransform<Derived>::TransformOpenACCInitConstruct(OpenACCInitConstruct *
C) {
12395 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12398 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12400 if (getSema().OpenACC().ActOnStartStmtDirective(
12401 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12404 return getDerived().RebuildOpenACCInitConstruct(
12405 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12406 TransformedClauses);
12409template <
typename Derived>
12410StmtResult TreeTransform<Derived>::TransformOpenACCShutdownConstruct(
12411 OpenACCShutdownConstruct *
C) {
12412 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12415 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12417 if (getSema().OpenACC().ActOnStartStmtDirective(
12418 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12421 return getDerived().RebuildOpenACCShutdownConstruct(
12422 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12423 TransformedClauses);
12426template <
typename Derived>
12428TreeTransform<Derived>::TransformOpenACCWaitConstruct(OpenACCWaitConstruct *
C) {
12429 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12432 if (
C->hasDevNumExpr()) {
12433 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12435 if (DevNumExpr.isUsable())
12436 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12438 C->getBeginLoc(), DevNumExpr.get());
12443 for (Expr *QE :
C->getQueueIdExprs()) {
12444 assert(QE &&
"Null queue id expr?");
12445 ExprResult NewEQ = getDerived().TransformExpr(QE);
12447 if (!NewEQ.isUsable())
12451 C->getBeginLoc(), NewEQ.get());
12452 if (NewEQ.isUsable())
12453 QueueIdExprs.push_back(NewEQ.get());
12457 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12460 if (getSema().OpenACC().ActOnStartStmtDirective(
12461 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12464 return getDerived().RebuildOpenACCWaitConstruct(
12465 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12466 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12467 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12470template <
typename Derived>
12471ExprResult TreeTransform<Derived>::TransformOpenACCAsteriskSizeExpr(
12472 OpenACCAsteriskSizeExpr *
E) {
12473 if (getDerived().AlwaysRebuild())
12474 return getDerived().RebuildOpenACCAsteriskSizeExpr(
E->getLocation());
12482template<
typename Derived>
12484TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *
E) {
12485 return TransformExpr(
E->getSubExpr());
12488template <
typename Derived>
12489ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
12490 SYCLUniqueStableNameExpr *
E) {
12494 TypeSourceInfo *NewT = getDerived().TransformType(
E->getTypeSourceInfo());
12499 if (!getDerived().AlwaysRebuild() &&
E->getTypeSourceInfo() == NewT)
12502 return getDerived().RebuildSYCLUniqueStableNameExpr(
12503 E->getLocation(),
E->getLParenLocation(),
E->getRParenLocation(), NewT);
12506template<
typename Derived>
12508TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *
E) {
12512 return getDerived().RebuildPredefinedExpr(
E->getLocation(),
12513 E->getIdentKind());
12516template<
typename Derived>
12518TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *
E) {
12519 NestedNameSpecifierLoc QualifierLoc;
12520 if (
E->getQualifierLoc()) {
12522 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
12528 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getLocation(),
12533 NamedDecl *
Found = ND;
12534 if (
E->getFoundDecl() !=
E->getDecl()) {
12535 Found = cast_or_null<NamedDecl>(
12536 getDerived().TransformDecl(
E->getLocation(),
E->getFoundDecl()));
12541 DeclarationNameInfo NameInfo =
E->getNameInfo();
12542 if (NameInfo.getName()) {
12543 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12544 if (!NameInfo.getName())
12548 if (!getDerived().AlwaysRebuild() &&
12549 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12550 QualifierLoc ==
E->getQualifierLoc() && ND ==
E->getDecl() &&
12551 Found ==
E->getFoundDecl() &&
12552 NameInfo.getName() ==
E->getDecl()->getDeclName() &&
12553 !
E->hasExplicitTemplateArgs()) {
12562 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
12563 if (
E->hasExplicitTemplateArgs()) {
12564 TemplateArgs = &TransArgs;
12565 TransArgs.setLAngleLoc(
E->getLAngleLoc());
12566 TransArgs.setRAngleLoc(
E->getRAngleLoc());
12567 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
12568 E->getNumTemplateArgs(),
12573 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
12574 Found, TemplateArgs);
12577template<
typename Derived>
12579TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *
E) {
12583template <
typename Derived>
12584ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
12585 FixedPointLiteral *
E) {
12589template<
typename Derived>
12591TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *
E) {
12595template<
typename Derived>
12597TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *
E) {
12601template<
typename Derived>
12603TreeTransform<Derived>::TransformStringLiteral(StringLiteral *
E) {
12607template<
typename Derived>
12609TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *
E) {
12613template<
typename Derived>
12615TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *
E) {
12616 return getDerived().TransformCallExpr(
E);
12619template<
typename Derived>
12621TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *
E) {
12623 TypeSourceInfo *ControllingType =
nullptr;
12624 if (
E->isExprPredicate())
12625 ControllingExpr = getDerived().TransformExpr(
E->getControllingExpr());
12627 ControllingType = getDerived().TransformType(
E->getControllingType());
12629 if (ControllingExpr.isInvalid() && !ControllingType)
12635 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
12637 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
12640 AssocTypes.push_back(AssocType);
12642 AssocTypes.push_back(
nullptr);
12646 getDerived().TransformExpr(Assoc.getAssociationExpr());
12647 if (AssocExpr.isInvalid())
12649 AssocExprs.push_back(AssocExpr.get());
12652 if (!ControllingType)
12653 return getDerived().RebuildGenericSelectionExpr(
E->getGenericLoc(),
12654 E->getDefaultLoc(),
12656 ControllingExpr.get(),
12659 return getDerived().RebuildGenericSelectionExpr(
12660 E->getGenericLoc(),
E->getDefaultLoc(),
E->getRParenLoc(),
12661 ControllingType, AssocTypes, AssocExprs);
12664template<
typename Derived>
12666TreeTransform<Derived>::TransformParenExpr(ParenExpr *
E) {
12667 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
12668 if (SubExpr.isInvalid())
12671 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getSubExpr())
12674 return getDerived().RebuildParenExpr(SubExpr.get(),
E->getLParen(),
12681template<
typename Derived>
12685 return getDerived().TransformDependentScopeDeclRefExpr(
12686 DRE,
true,
nullptr);
12688 return getDerived().TransformUnresolvedLookupExpr(
12691 return getDerived().TransformExpr(
E);
12694template<
typename Derived>
12698 if (
E->getOpcode() == UO_AddrOf)
12699 SubExpr = TransformAddressOfOperand(
E->getSubExpr());
12701 SubExpr = TransformExpr(
E->getSubExpr());
12705 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getSubExpr())
12708 return getDerived().RebuildUnaryOperator(
E->getOperatorLoc(),
12713template<
typename Derived>
12715TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *
E) {
12717 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
12727 bool ExprChanged =
false;
12728 typedef Sema::OffsetOfComponent Component;
12730 for (
unsigned I = 0, N =
E->getNumComponents(); I != N; ++I) {
12731 const OffsetOfNode &ON =
E->getComponent(I);
12733 Comp.isBrackets =
true;
12734 Comp.LocStart = ON.getSourceRange().getBegin();
12735 Comp.LocEnd = ON.getSourceRange().getEnd();
12736 switch (ON.getKind()) {
12738 Expr *FromIndex =
E->getIndexExpr(ON.getArrayExprIndex());
12739 ExprResult Index = getDerived().TransformExpr(FromIndex);
12740 if (Index.isInvalid())
12743 ExprChanged = ExprChanged || Index.get() != FromIndex;
12744 Comp.isBrackets =
true;
12745 Comp.U.E = Index.get();
12751 Comp.isBrackets =
false;
12752 Comp.U.IdentInfo = ON.getFieldName();
12753 if (!
Comp.U.IdentInfo)
12763 Components.push_back(Comp);
12767 if (!getDerived().AlwaysRebuild() &&
12768 Type ==
E->getTypeSourceInfo() &&
12773 return getDerived().RebuildOffsetOfExpr(
E->getOperatorLoc(), Type,
12774 Components,
E->getRParenLoc());
12777template<
typename Derived>
12779TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *
E) {
12780 assert((!
E->getSourceExpr() || getDerived().AlreadyTransformed(
E->
getType())) &&
12781 "opaque value expression requires transformation");
12785template<
typename Derived>
12787TreeTransform<Derived>::TransformTypoExpr(TypoExpr *
E) {
12791template <
typename Derived>
12792ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *
E) {
12795 for (Expr *
C :
E->subExpressions()) {
12797 if (NewC.isInvalid())
12799 Children.push_back(NewC.get());
12803 if (!getDerived().AlwaysRebuild() && !Changed)
12809template<
typename Derived>
12811TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *
E) {
12819 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
12820 if (result.isInvalid())
return ExprError();
12825 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
12831template<
typename Derived>
12833TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
12834 UnaryExprOrTypeTraitExpr *
E) {
12835 if (
E->isArgumentType()) {
12836 TypeSourceInfo *OldT =
E->getArgumentTypeInfo();
12838 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12842 if (!getDerived().AlwaysRebuild() && OldT == NewT)
12845 return getDerived().RebuildUnaryExprOrTypeTrait(NewT,
E->getOperatorLoc(),
12859 TypeSourceInfo *RecoveryTSI =
nullptr;
12861 auto *PE = dyn_cast<ParenExpr>(
E->getArgumentExpr());
12863 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
12864 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
12865 PE, DRE,
false, &RecoveryTSI);
12867 SubExpr = getDerived().TransformExpr(
E->getArgumentExpr());
12870 return getDerived().RebuildUnaryExprOrTypeTrait(
12872 }
else if (SubExpr.isInvalid())
12875 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getArgumentExpr())
12878 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
12879 E->getOperatorLoc(),
12884template<
typename Derived>
12886TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *
E) {
12887 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12888 if (LHS.isInvalid())
12891 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
12892 if (RHS.isInvalid())
12896 if (!getDerived().AlwaysRebuild() &&
12897 LHS.get() ==
E->getLHS() &&
12898 RHS.get() ==
E->getRHS())
12901 return getDerived().RebuildArraySubscriptExpr(
12903 E->getLHS()->
getBeginLoc(), RHS.get(),
E->getRBracketLoc());
12906template <
typename Derived>
12908TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *
E) {
12910 if (
Base.isInvalid())
12913 ExprResult RowIdx = getDerived().TransformExpr(
E->getRowIdx());
12914 if (RowIdx.isInvalid())
12917 ExprResult ColumnIdx = getDerived().TransformExpr(
E->getColumnIdx());
12918 if (ColumnIdx.isInvalid())
12921 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
12922 RowIdx.get() ==
E->getRowIdx() && ColumnIdx.get() ==
E->getColumnIdx())
12925 return getDerived().RebuildMatrixSubscriptExpr(
12926 Base.get(), RowIdx.get(), ColumnIdx.get(),
E->getRBracketLoc());
12929template <
typename Derived>
12931TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *
E) {
12933 if (
Base.isInvalid())
12937 if (
E->getLowerBound()) {
12938 LowerBound = getDerived().TransformExpr(
E->getLowerBound());
12939 if (LowerBound.isInvalid())
12944 if (
E->getLength()) {
12945 Length = getDerived().TransformExpr(
E->getLength());
12946 if (Length.isInvalid())
12951 if (
E->isOMPArraySection()) {
12952 if (Expr *Str =
E->getStride()) {
12953 Stride = getDerived().TransformExpr(Str);
12954 if (Stride.isInvalid())
12959 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
12960 LowerBound.get() ==
E->getLowerBound() &&
12961 Length.get() ==
E->getLength() &&
12962 (
E->isOpenACCArraySection() || Stride.get() ==
E->getStride()))
12965 return getDerived().RebuildArraySectionExpr(
12967 LowerBound.get(),
E->getColonLocFirst(),
12968 E->isOMPArraySection() ?
E->getColonLocSecond() : SourceLocation{},
12969 Length.get(), Stride.get(),
E->getRBracketLoc());
12972template <
typename Derived>
12974TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *
E) {
12976 if (
Base.isInvalid())
12980 bool ErrorFound =
false;
12981 for (Expr *
Dim :
E->getDimensions()) {
12983 if (DimRes.isInvalid()) {
12987 Dims.push_back(DimRes.get());
12992 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(),
E->getLParenLoc(),
12993 E->getRParenLoc(), Dims,
12994 E->getBracketsRanges());
12997template <
typename Derived>
12999TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *
E) {
13000 unsigned NumIterators =
E->numOfIterators();
13003 bool ErrorFound =
false;
13004 bool NeedToRebuild = getDerived().AlwaysRebuild();
13005 for (
unsigned I = 0; I < NumIterators; ++I) {
13006 auto *
D = cast<VarDecl>(
E->getIteratorDecl(I));
13007 Data[I].DeclIdent =
D->getIdentifier();
13011 "Implicit type must be int.");
13013 TypeSourceInfo *TSI = getDerived().TransformType(
D->getTypeSourceInfo());
13014 QualType
DeclTy = getDerived().TransformType(
D->getType());
13017 OMPIteratorExpr::IteratorRange
Range =
E->getIteratorRange(I);
13021 ErrorFound = ErrorFound ||
13022 !(!
D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
13023 !
Data[I].Type.get().isNull())) ||
13028 Data[I].Range.End = End.get();
13029 Data[I].Range.Step = Step.get();
13030 Data[I].AssignLoc =
E->getAssignLoc(I);
13031 Data[I].ColonLoc =
E->getColonLoc(I);
13032 Data[I].SecColonLoc =
E->getSecondColonLoc(I);
13035 (
D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
13036 D->getType().getTypePtrOrNull()) ||
13042 if (!NeedToRebuild)
13045 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13046 E->getIteratorKwLoc(),
E->getLParenLoc(),
E->getRParenLoc(),
Data);
13047 if (!Res.isUsable())
13049 auto *IE = cast<OMPIteratorExpr>(Res.get());
13050 for (
unsigned I = 0; I < NumIterators; ++I)
13051 getDerived().transformedLocalDecl(
E->getIteratorDecl(I),
13052 IE->getIteratorDecl(I));
13056template<
typename Derived>
13058TreeTransform<Derived>::TransformCallExpr(CallExpr *
E) {
13065 bool ArgChanged =
false;
13067 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13071 if (!getDerived().AlwaysRebuild() &&
13072 Callee.get() ==
E->getCallee() &&
13077 SourceLocation FakeLParenLoc
13080 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13081 if (
E->hasStoredFPFeatures()) {
13082 FPOptionsOverride NewOverrides =
E->getFPFeatures();
13083 getSema().CurFPFeatures =
13084 NewOverrides.applyOverrides(getSema().getLangOpts());
13085 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13088 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13090 E->getRParenLoc());
13093template<
typename Derived>
13095TreeTransform<Derived>::TransformMemberExpr(MemberExpr *
E) {
13097 if (
Base.isInvalid())
13100 NestedNameSpecifierLoc QualifierLoc;
13101 if (
E->hasQualifier()) {
13103 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
13108 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
13111 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getMemberLoc(),
13112 E->getMemberDecl()));
13116 NamedDecl *FoundDecl =
E->getFoundDecl();
13117 if (FoundDecl ==
E->getMemberDecl()) {
13120 FoundDecl = cast_or_null<NamedDecl>(
13121 getDerived().TransformDecl(
E->getMemberLoc(), FoundDecl));
13126 if (!getDerived().AlwaysRebuild() &&
13127 Base.get() ==
E->getBase() &&
13128 QualifierLoc ==
E->getQualifierLoc() &&
13129 Member ==
E->getMemberDecl() &&
13130 FoundDecl ==
E->getFoundDecl() &&
13131 !
E->hasExplicitTemplateArgs()) {
13135 if (!(isa<CXXThisExpr>(
E->getBase()) &&
13136 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13137 cast<ValueDecl>(
Member)))) {
13145 TemplateArgumentListInfo TransArgs;
13146 if (
E->hasExplicitTemplateArgs()) {
13147 TransArgs.setLAngleLoc(
E->getLAngleLoc());
13148 TransArgs.setRAngleLoc(
E->getRAngleLoc());
13149 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
13150 E->getNumTemplateArgs(),
13156 SourceLocation FakeOperatorLoc =
13163 NamedDecl *FirstQualifierInScope =
nullptr;
13164 DeclarationNameInfo MemberNameInfo =
E->getMemberNameInfo();
13165 if (MemberNameInfo.getName()) {
13166 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13167 if (!MemberNameInfo.getName())
13171 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13178 (
E->hasExplicitTemplateArgs()
13179 ? &TransArgs :
nullptr),
13180 FirstQualifierInScope);
13183template<
typename Derived>
13185TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *
E) {
13186 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13187 if (LHS.isInvalid())
13191 getDerived().TransformInitializer(
E->getRHS(),
false);
13192 if (RHS.isInvalid())
13195 if (!getDerived().AlwaysRebuild() &&
13196 LHS.get() ==
E->getLHS() &&
13197 RHS.get() ==
E->getRHS())
13200 if (
E->isCompoundAssignmentOp())
13202 return getDerived().RebuildBinaryOperator(
13203 E->getOperatorLoc(),
E->getOpcode(), LHS.get(), RHS.get());
13204 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13205 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13206 getSema().CurFPFeatures =
13207 NewOverrides.applyOverrides(getSema().getLangOpts());
13208 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13209 return getDerived().RebuildBinaryOperator(
E->getOperatorLoc(),
E->getOpcode(),
13210 LHS.get(), RHS.get());
13213template <
typename Derived>
13214ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
13215 CXXRewrittenBinaryOperator *
E) {
13216 CXXRewrittenBinaryOperator::DecomposedForm Decomp =
E->getDecomposedForm();
13218 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13219 if (LHS.isInvalid())
13222 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13223 if (RHS.isInvalid())
13228 UnresolvedSet<2> UnqualLookups;
13229 bool ChangedAnyLookups =
false;
13230 Expr *PossibleBinOps[] = {
E->getSemanticForm(),
13231 const_cast<Expr *
>(Decomp.InnerBinOp)};
13232 for (Expr *PossibleBinOp : PossibleBinOps) {
13233 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13236 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13237 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
13242 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13243 E->getOperatorLoc(),
Callee->getFoundDecl()));
13247 ChangedAnyLookups =
true;
13248 UnqualLookups.addDecl(
Found);
13251 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13252 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13258 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13263 return getDerived().RebuildCXXRewrittenBinaryOperator(
13264 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13267template<
typename Derived>
13269TreeTransform<Derived>::TransformCompoundAssignOperator(
13270 CompoundAssignOperator *
E) {
13271 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13272 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13273 getSema().CurFPFeatures =
13274 NewOverrides.applyOverrides(getSema().getLangOpts());
13275 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13276 return getDerived().TransformBinaryOperator(
E);
13279template<
typename Derived>
13281TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
13285 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13286 if (commonExpr.isInvalid())
13289 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13290 if (rhs.isInvalid())
13293 if (!getDerived().AlwaysRebuild() &&
13294 commonExpr.get() == e->getCommon() &&
13295 rhs.get() == e->getFalseExpr())
13298 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13299 e->getQuestionLoc(),
13305template<
typename Derived>
13307TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *
E) {
13308 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13309 if (Cond.isInvalid())
13312 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13313 if (LHS.isInvalid())
13316 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13317 if (RHS.isInvalid())
13320 if (!getDerived().AlwaysRebuild() &&
13321 Cond.get() ==
E->getCond() &&
13322 LHS.get() ==
E->getLHS() &&
13323 RHS.get() ==
E->getRHS())
13326 return getDerived().RebuildConditionalOperator(Cond.get(),
13327 E->getQuestionLoc(),
13333template<
typename Derived>
13335TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *
E) {
13338 return getDerived().TransformExpr(
E->getSubExprAsWritten());
13341template<
typename Derived>
13343TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *
E) {
13344 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeInfoAsWritten());
13349 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13350 if (SubExpr.isInvalid())
13353 if (!getDerived().AlwaysRebuild() &&
13354 Type ==
E->getTypeInfoAsWritten() &&
13355 SubExpr.get() ==
E->getSubExpr())
13358 return getDerived().RebuildCStyleCastExpr(
E->getLParenLoc(),
13364template<
typename Derived>
13366TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *
E) {
13367 TypeSourceInfo *OldT =
E->getTypeSourceInfo();
13368 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
13373 if (
Init.isInvalid())
13376 if (!getDerived().AlwaysRebuild() &&
13378 Init.get() ==
E->getInitializer())
13385 return getDerived().RebuildCompoundLiteralExpr(
13386 E->getLParenLoc(), NewT,
13390template<
typename Derived>
13392TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *
E) {
13394 if (
Base.isInvalid())
13397 if (!getDerived().AlwaysRebuild() &&
13398 Base.get() ==
E->getBase())
13402 SourceLocation FakeOperatorLoc =
13404 return getDerived().RebuildExtVectorElementExpr(
13405 Base.get(), FakeOperatorLoc,
E->isArrow(),
E->getAccessorLoc(),
13409template<
typename Derived>
13411TreeTransform<Derived>::TransformInitListExpr(InitListExpr *
E) {
13412 if (InitListExpr *Syntactic =
E->getSyntacticForm())
13415 bool InitChanged =
false;
13417 EnterExpressionEvaluationContext Context(
13421 if (getDerived().TransformExprs(
E->getInits(),
E->getNumInits(),
false,
13422 Inits, &InitChanged))
13425 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13432 return getDerived().RebuildInitList(
E->getLBraceLoc(), Inits,
13433 E->getRBraceLoc());
13436template<
typename Derived>
13438TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *
E) {
13443 if (
Init.isInvalid())
13448 bool ExprChanged =
false;
13449 for (
const DesignatedInitExpr::Designator &
D :
E->designators()) {
13450 if (
D.isFieldDesignator()) {
13451 if (
D.getFieldDecl()) {
13452 FieldDecl *
Field = cast_or_null<FieldDecl>(
13453 getDerived().TransformDecl(
D.getFieldLoc(),
D.getFieldDecl()));
13454 if (Field !=
D.getFieldDecl())
13457 ExprChanged =
true;
13458 if (
Field->isAnonymousStructOrUnion())
13464 ExprChanged =
true;
13467 D.getFieldName(),
D.getDotLoc(),
D.getFieldLoc()));
13471 if (
D.isArrayDesignator()) {
13472 ExprResult Index = getDerived().TransformExpr(
E->getArrayIndex(
D));
13473 if (Index.isInvalid())
13476 Desig.AddDesignator(
13479 ExprChanged = ExprChanged ||
Init.get() !=
E->getArrayIndex(
D);
13480 ArrayExprs.push_back(Index.get());
13484 assert(
D.isArrayRangeDesignator() &&
"New kind of designator?");
13486 = getDerived().TransformExpr(
E->getArrayRangeStart(
D));
13487 if (Start.isInvalid())
13490 ExprResult End = getDerived().TransformExpr(
E->getArrayRangeEnd(
D));
13491 if (End.isInvalid())
13495 Start.get(), End.get(),
D.getLBracketLoc(),
D.getEllipsisLoc()));
13497 ExprChanged = ExprChanged || Start.get() !=
E->getArrayRangeStart(
D) ||
13498 End.get() !=
E->getArrayRangeEnd(
D);
13500 ArrayExprs.push_back(Start.get());
13501 ArrayExprs.push_back(End.get());
13504 if (!getDerived().AlwaysRebuild() &&
13505 Init.get() ==
E->getInit() &&
13509 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13510 E->getEqualOrColonLoc(),
13511 E->usesGNUSyntax(),
Init.get());
13516template<
typename Derived>
13518TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
13519 DesignatedInitUpdateExpr *
E) {
13520 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13525template<
typename Derived>
13527TreeTransform<Derived>::TransformNoInitExpr(
13529 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13533template<
typename Derived>
13535TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *
E) {
13536 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13540template<
typename Derived>
13542TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *
E) {
13543 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13547template<
typename Derived>
13549TreeTransform<Derived>::TransformImplicitValueInitExpr(
13550 ImplicitValueInitExpr *
E) {
13551 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
13555 QualType
T = getDerived().TransformType(
E->
getType());
13559 if (!getDerived().AlwaysRebuild() &&
13563 return getDerived().RebuildImplicitValueInitExpr(
T);
13566template<
typename Derived>
13568TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *
E) {
13569 TypeSourceInfo *TInfo = getDerived().TransformType(
E->getWrittenTypeInfo());
13573 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
13574 if (SubExpr.isInvalid())
13577 if (!getDerived().AlwaysRebuild() &&
13578 TInfo ==
E->getWrittenTypeInfo() &&
13579 SubExpr.get() ==
E->getSubExpr())
13582 return getDerived().RebuildVAArgExpr(
E->getBuiltinLoc(), SubExpr.get(),
13583 TInfo,
E->getRParenLoc());
13586template<
typename Derived>
13588TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *
E) {
13589 bool ArgumentChanged =
false;
13591 if (TransformExprs(
E->getExprs(),
E->getNumExprs(),
true, Inits,
13595 return getDerived().RebuildParenListExpr(
E->getLParenLoc(),
13597 E->getRParenLoc());
13605template<
typename Derived>
13607TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *
E) {
13608 Decl *LD = getDerived().TransformDecl(
E->getLabel()->getLocation(),
13613 return getDerived().RebuildAddrLabelExpr(
E->getAmpAmpLoc(),
E->getLabelLoc(),
13614 cast<LabelDecl>(LD));
13617template<
typename Derived>
13619TreeTransform<Derived>::TransformStmtExpr(StmtExpr *
E) {
13622 = getDerived().TransformCompoundStmt(
E->getSubStmt(),
true);
13623 if (SubStmt.isInvalid()) {
13628 unsigned OldDepth =
E->getTemplateDepth();
13629 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13631 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13632 SubStmt.get() ==
E->getSubStmt()) {
13638 return getDerived().RebuildStmtExpr(
E->getLParenLoc(), SubStmt.get(),
13639 E->getRParenLoc(), NewDepth);
13642template<
typename Derived>
13644TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *
E) {
13645 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
13646 if (Cond.isInvalid())
13649 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
13650 if (LHS.isInvalid())
13653 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
13654 if (RHS.isInvalid())
13657 if (!getDerived().AlwaysRebuild() &&
13658 Cond.get() ==
E->getCond() &&
13659 LHS.get() ==
E->getLHS() &&
13660 RHS.get() ==
E->getRHS())
13663 return getDerived().RebuildChooseExpr(
E->getBuiltinLoc(),
13664 Cond.get(), LHS.get(), RHS.get(),
13665 E->getRParenLoc());
13668template<
typename Derived>
13670TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *
E) {
13674template<
typename Derived>
13676TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *
E) {
13677 switch (
E->getOperator()) {
13681 case OO_Array_Delete:
13682 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
13687 assert(
E->getNumArgs() >= 1 &&
"Object call is missing arguments");
13696 static_cast<Expr *
>(
Object.get())->getEndLoc());
13700 if (getDerived().TransformExprs(
E->getArgs() + 1,
E->getNumArgs() - 1,
true,
13704 if (
E->getOperator() == OO_Subscript)
13705 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
13708 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
13712#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
13716#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
13717#include "clang/Basic/OperatorKinds.def"
13719 case OO_Conditional:
13720 llvm_unreachable(
"conditional operator is not actually overloadable");
13724 llvm_unreachable(
"not an overloaded operator?");
13728 if (
E->getNumArgs() == 1 &&
E->getOperator() == OO_Amp)
13729 First = getDerived().TransformAddressOfOperand(
E->getArg(0));
13731 First = getDerived().TransformExpr(
E->getArg(0));
13732 if (
First.isInvalid())
13736 if (
E->getNumArgs() == 2) {
13738 getDerived().TransformInitializer(
E->getArg(1),
false);
13739 if (Second.isInvalid())
13743 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
13744 FPOptionsOverride NewOverrides(
E->getFPFeatures());
13745 getSema().CurFPFeatures =
13746 NewOverrides.applyOverrides(getSema().getLangOpts());
13747 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13749 Expr *
Callee =
E->getCallee();
13750 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
13751 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
13753 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
13756 return getDerived().RebuildCXXOperatorCallExpr(
13757 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13758 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
13761 UnresolvedSet<1> Functions;
13762 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
13763 Callee = ICE->getSubExprAsWritten();
13764 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
13765 ValueDecl *VD = cast_or_null<ValueDecl>(
13766 getDerived().TransformDecl(DR->getLocation(), DR));
13770 if (!isa<CXXMethodDecl>(VD))
13771 Functions.addDecl(VD);
13773 return getDerived().RebuildCXXOperatorCallExpr(
13774 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
13775 false, Functions,
First.get(), Second.get());
13778template<
typename Derived>
13780TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *
E) {
13781 return getDerived().TransformCallExpr(
E);
13784template <
typename Derived>
13785ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *
E) {
13787 getSema().CurContext !=
E->getParentContext();
13789 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
13792 return getDerived().RebuildSourceLocExpr(
E->getIdentKind(),
E->
getType(),
13794 getSema().CurContext);
13797template <
typename Derived>
13798ExprResult TreeTransform<Derived>::TransformEmbedExpr(EmbedExpr *
E) {
13802template<
typename Derived>
13804TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *
E) {
13811 ExprResult EC = getDerived().TransformCallExpr(
E->getConfig());
13812 if (EC.isInvalid())
13816 bool ArgChanged =
false;
13818 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13822 if (!getDerived().AlwaysRebuild() &&
13823 Callee.get() ==
E->getCallee() &&
13828 SourceLocation FakeLParenLoc
13830 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13832 E->getRParenLoc(), EC.get());
13835template<
typename Derived>
13843 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13847 if (!getDerived().AlwaysRebuild() &&
13848 Type ==
E->getTypeInfoAsWritten() &&
13849 SubExpr.
get() ==
E->getSubExpr())
13851 return getDerived().RebuildCXXNamedCastExpr(
13852 E->getOperatorLoc(),
E->
getStmtClass(),
E->getAngleBrackets().getBegin(),
13853 Type,
E->getAngleBrackets().getEnd(),
13855 E->getAngleBrackets().getEnd(), SubExpr.
get(),
E->getRParenLoc());
13858template<
typename Derived>
13867 if (Sub.isInvalid())
13870 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
13874template<
typename Derived>
13876TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *
E) {
13877 return getDerived().TransformCXXNamedCastExpr(
E);
13880template<
typename Derived>
13882TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *
E) {
13883 return getDerived().TransformCXXNamedCastExpr(
E);
13886template<
typename Derived>
13888TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
13889 CXXReinterpretCastExpr *
E) {
13890 return getDerived().TransformCXXNamedCastExpr(
E);
13893template<
typename Derived>
13895TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *
E) {
13896 return getDerived().TransformCXXNamedCastExpr(
E);
13899template<
typename Derived>
13901TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *
E) {
13902 return getDerived().TransformCXXNamedCastExpr(
E);
13905template<
typename Derived>
13907TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
13908 CXXFunctionalCastExpr *
E) {
13909 TypeSourceInfo *
Type =
13910 getDerived().TransformTypeWithDeducedTST(
E->getTypeInfoAsWritten());
13915 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13916 if (SubExpr.isInvalid())
13919 if (!getDerived().AlwaysRebuild() &&
13920 Type ==
E->getTypeInfoAsWritten() &&
13921 SubExpr.get() ==
E->getSubExpr())
13924 return getDerived().RebuildCXXFunctionalCastExpr(Type,
13928 E->isListInitialization());
13931template<
typename Derived>
13933TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *
E) {
13934 if (
E->isTypeOperand()) {
13935 TypeSourceInfo *TInfo
13936 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
13940 if (!getDerived().AlwaysRebuild() &&
13941 TInfo ==
E->getTypeOperandSourceInfo())
13951 Expr *Op =
E->getExprOperand();
13954 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
13955 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
13958 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
13961 ExprResult SubExpr = getDerived().TransformExpr(Op);
13962 if (SubExpr.isInvalid())
13965 if (!getDerived().AlwaysRebuild() &&
13966 SubExpr.get() ==
E->getExprOperand())
13973template<
typename Derived>
13975TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *
E) {
13976 if (
E->isTypeOperand()) {
13977 TypeSourceInfo *TInfo
13978 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
13982 if (!getDerived().AlwaysRebuild() &&
13983 TInfo ==
E->getTypeOperandSourceInfo())
13993 ExprResult SubExpr = getDerived().TransformExpr(
E->getExprOperand());
13994 if (SubExpr.isInvalid())
13997 if (!getDerived().AlwaysRebuild() &&
13998 SubExpr.get() ==
E->getExprOperand())
14005template<
typename Derived>
14007TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *
E) {
14011template<
typename Derived>
14013TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
14014 CXXNullPtrLiteralExpr *
E) {
14018template<
typename Derived>
14020TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *
E) {
14031 QualType
T = [&]() {
14032 auto &S = getSema();
14033 if (
E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14036 return getDerived().TransformType(
E->
getType());
14040 if (!getDerived().AlwaysRebuild() &&
T ==
E->
getType()) {
14043 getSema().MarkThisReferenced(
E);
14047 return getDerived().RebuildCXXThisExpr(
E->
getBeginLoc(),
T,
E->isImplicit());
14050template<
typename Derived>
14052TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *
E) {
14053 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
14054 if (SubExpr.isInvalid())
14057 if (!getDerived().AlwaysRebuild() &&
14058 SubExpr.get() ==
E->getSubExpr())
14061 return getDerived().RebuildCXXThrowExpr(
E->getThrowLoc(), SubExpr.get(),
14062 E->isThrownVariableInScope());
14065template<
typename Derived>
14067TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *
E) {
14068 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
14069 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getParam()));
14074 if (
E->hasRewrittenInit()) {
14075 InitRes = getDerived().TransformExpr(
E->getRewrittenExpr());
14076 if (InitRes.isInvalid())
14080 if (!getDerived().AlwaysRebuild() && Param ==
E->getParam() &&
14082 InitRes.get() ==
E->getRewrittenExpr())
14085 return getDerived().RebuildCXXDefaultArgExpr(
E->getUsedLocation(), Param,
14089template<
typename Derived>
14091TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *
E) {
14092 FieldDecl *
Field = cast_or_null<FieldDecl>(
14093 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getField()));
14097 if (!getDerived().AlwaysRebuild() && Field ==
E->getField() &&
14101 return getDerived().RebuildCXXDefaultInitExpr(
E->
getExprLoc(), Field);
14104template<
typename Derived>
14106TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
14107 CXXScalarValueInitExpr *
E) {
14108 TypeSourceInfo *
T = getDerived().TransformType(
E->getTypeSourceInfo());
14112 if (!getDerived().AlwaysRebuild() &&
14113 T ==
E->getTypeSourceInfo())
14116 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14117 T->getTypeLoc().getEndLoc(),
14118 E->getRParenLoc());
14121template<
typename Derived>
14123TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *
E) {
14125 TypeSourceInfo *AllocTypeInfo =
14126 getDerived().TransformTypeWithDeducedTST(
E->getAllocatedTypeSourceInfo());
14127 if (!AllocTypeInfo)
14131 std::optional<Expr *> ArraySize;
14132 if (
E->isArray()) {
14134 if (std::optional<Expr *> OldArraySize =
E->getArraySize()) {
14135 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14136 if (NewArraySize.isInvalid())
14139 ArraySize = NewArraySize.get();
14143 bool ArgumentChanged =
false;
14145 if (getDerived().TransformExprs(
E->getPlacementArgs(),
14146 E->getNumPlacementArgs(),
true,
14147 PlacementArgs, &ArgumentChanged))
14151 Expr *OldInit =
E->getInitializer();
14154 NewInit = getDerived().TransformInitializer(OldInit,
true);
14155 if (NewInit.isInvalid())
14159 FunctionDecl *OperatorNew =
nullptr;
14160 if (
E->getOperatorNew()) {
14161 OperatorNew = cast_or_null<FunctionDecl>(
14162 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorNew()));
14167 FunctionDecl *OperatorDelete =
nullptr;
14168 if (
E->getOperatorDelete()) {
14169 OperatorDelete = cast_or_null<FunctionDecl>(
14170 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14171 if (!OperatorDelete)
14175 if (!getDerived().AlwaysRebuild() &&
14176 AllocTypeInfo ==
E->getAllocatedTypeSourceInfo() &&
14177 ArraySize ==
E->getArraySize() &&
14178 NewInit.get() == OldInit &&
14179 OperatorNew ==
E->getOperatorNew() &&
14180 OperatorDelete ==
E->getOperatorDelete() &&
14181 !ArgumentChanged) {
14186 if (OperatorDelete)
14189 if (
E->isArray() && !
E->getAllocatedType()->isDependentType()) {
14190 QualType ElementType
14192 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
14193 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
14203 QualType AllocType = AllocTypeInfo->
getType();
14213 }
else if (
const ConstantArrayType *ConsArrayT
14214 = dyn_cast<ConstantArrayType>(ArrayT)) {
14218 AllocType = ConsArrayT->getElementType();
14219 }
else if (
const DependentSizedArrayType *DepArrayT
14220 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14221 if (DepArrayT->getSizeExpr()) {
14222 ArraySize = DepArrayT->getSizeExpr();
14223 AllocType = DepArrayT->getElementType();
14228 return getDerived().RebuildCXXNewExpr(
14232 AllocTypeInfo, ArraySize,
E->getDirectInitRange(), NewInit.get());
14235template<
typename Derived>
14237TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *
E) {
14243 FunctionDecl *OperatorDelete =
nullptr;
14244 if (
E->getOperatorDelete()) {
14245 OperatorDelete = cast_or_null<FunctionDecl>(
14246 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
14247 if (!OperatorDelete)
14251 if (!getDerived().AlwaysRebuild() &&
14252 Operand.get() ==
E->getArgument() &&
14253 OperatorDelete ==
E->getOperatorDelete()) {
14256 if (OperatorDelete)
14261 E->getDestroyedType());
14262 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
14263 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
14272 return getDerived().RebuildCXXDeleteExpr(
14276template<
typename Derived>
14278TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
14279 CXXPseudoDestructorExpr *
E) {
14281 if (
Base.isInvalid())
14285 bool MayBePseudoDestructor =
false;
14287 E->getOperatorLoc(),
14288 E->isArrow()? tok::arrow : tok::period,
14290 MayBePseudoDestructor);
14291 if (
Base.isInvalid())
14294 QualType ObjectType = ObjectTypePtr.get();
14295 NestedNameSpecifierLoc QualifierLoc =
E->getQualifierLoc();
14296 if (QualifierLoc) {
14298 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14303 SS.Adopt(QualifierLoc);
14305 PseudoDestructorTypeStorage Destroyed;
14306 if (
E->getDestroyedTypeInfo()) {
14307 TypeSourceInfo *DestroyedTypeInfo
14308 = getDerived().TransformTypeInObjectScope(
E->getDestroyedTypeInfo(),
14309 ObjectType,
nullptr, SS);
14310 if (!DestroyedTypeInfo)
14312 Destroyed = DestroyedTypeInfo;
14313 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14316 Destroyed = PseudoDestructorTypeStorage(
E->getDestroyedTypeIdentifier(),
14317 E->getDestroyedTypeLoc());
14321 *
E->getDestroyedTypeIdentifier(),
E->getDestroyedTypeLoc(),
14322 nullptr, SS, ObjectTypePtr,
false);
14328 E->getDestroyedTypeLoc());
14331 TypeSourceInfo *ScopeTypeInfo =
nullptr;
14332 if (
E->getScopeTypeInfo()) {
14333 CXXScopeSpec EmptySS;
14334 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14335 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
14336 if (!ScopeTypeInfo)
14340 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14341 E->getOperatorLoc(),
14345 E->getColonColonLoc(),
14350template <
typename Derived>
14355 bool AllEmptyPacks =
true;
14356 for (
auto *OldD : Old->
decls()) {
14357 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
14361 if (isa<UsingShadowDecl>(OldD))
14370 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
14372 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14373 Decls = UPD->expansions();
14376 for (
auto *
D : Decls) {
14377 if (
auto *UD = dyn_cast<UsingDecl>(
D)) {
14378 for (
auto *SD : UD->shadows())
14385 AllEmptyPacks &= Decls.empty();
14394 if (AllEmptyPacks && !RequiresADL) {
14395 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
14396 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
14406 getSema().FilterAcceptableTemplateNames(R,
14413 diag::err_template_kw_refers_to_non_template)
14417 diag::note_template_kw_refers_to_non_template)
14426template <
typename Derived>
14429 return TransformUnresolvedLookupExpr(Old,
false);
14432template <
typename Derived>
14435 bool IsAddressOfOperand) {
14440 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14447 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14451 SS.
Adopt(QualifierLoc);
14455 CXXRecordDecl *NamingClass
14456 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14459 if (!NamingClass) {
14464 R.setNamingClass(NamingClass);
14485 SS, TemplateKWLoc, R,
14492 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14495 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14499template<
typename Derived>
14501TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *
E) {
14502 bool ArgChanged =
false;
14504 for (
unsigned I = 0, N =
E->getNumArgs(); I != N; ++I) {
14505 TypeSourceInfo *From =
E->getArg(I);
14506 TypeLoc FromTL = From->getTypeLoc();
14507 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
14508 TypeLocBuilder TLB;
14509 TLB.reserve(FromTL.getFullDataSize());
14510 QualType To = getDerived().TransformType(TLB, FromTL);
14514 if (To == From->getType())
14515 Args.push_back(From);
14517 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14526 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
14527 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14533 bool Expand =
true;
14534 bool RetainExpansion =
false;
14535 std::optional<unsigned> OrigNumExpansions =
14536 ExpansionTL.getTypePtr()->getNumExpansions();
14537 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14538 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
14539 PatternTL.getSourceRange(),
14541 Expand, RetainExpansion,
14549 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14551 TypeLocBuilder TLB;
14552 TLB.reserve(From->getTypeLoc().getFullDataSize());
14554 QualType To = getDerived().TransformType(TLB, PatternTL);
14558 To = getDerived().RebuildPackExpansionType(To,
14559 PatternTL.getSourceRange(),
14560 ExpansionTL.getEllipsisLoc(),
14565 PackExpansionTypeLoc ToExpansionTL
14566 = TLB.push<PackExpansionTypeLoc>(To);
14567 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14568 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14574 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14575 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
14576 TypeLocBuilder TLB;
14577 TLB.reserve(PatternTL.getFullDataSize());
14578 QualType To = getDerived().TransformType(TLB, PatternTL);
14582 if (To->containsUnexpandedParameterPack()) {
14583 To = getDerived().RebuildPackExpansionType(To,
14584 PatternTL.getSourceRange(),
14585 ExpansionTL.getEllipsisLoc(),
14590 PackExpansionTypeLoc ToExpansionTL
14591 = TLB.push<PackExpansionTypeLoc>(To);
14592 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14595 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14598 if (!RetainExpansion)
14603 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14605 TypeLocBuilder TLB;
14606 TLB.reserve(From->getTypeLoc().getFullDataSize());
14608 QualType To = getDerived().TransformType(TLB, PatternTL);
14612 To = getDerived().RebuildPackExpansionType(To,
14613 PatternTL.getSourceRange(),
14614 ExpansionTL.getEllipsisLoc(),
14619 PackExpansionTypeLoc ToExpansionTL
14620 = TLB.push<PackExpansionTypeLoc>(To);
14621 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
14622 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14625 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14628 return getDerived().RebuildTypeTrait(
E->getTrait(),
E->
getBeginLoc(), Args,
14632template<
typename Derived>
14634TreeTransform<Derived>::TransformConceptSpecializationExpr(
14635 ConceptSpecializationExpr *
E) {
14636 const ASTTemplateArgumentListInfo *Old =
E->getTemplateArgsAsWritten();
14637 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
14638 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14639 Old->NumTemplateArgs, TransArgs))
14642 return getDerived().RebuildConceptSpecializationExpr(
14643 E->getNestedNameSpecifierLoc(),
E->getTemplateKWLoc(),
14644 E->getConceptNameInfo(),
E->getFoundDecl(),
E->getNamedConcept(),
14648template<
typename Derived>
14650TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *
E) {
14653 Sema::ExtParameterInfoBuilder ExtParamInfos;
14657 EnterExpressionEvaluationContext Ctx(
14662 getSema().Context, getSema().CurContext,
14665 Sema::ContextRAII SavedContext(getSema(), Body,
false);
14667 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
14668 E->getRequiresKWLoc(),
E->getRBraceLoc(),
E, Body,
14669 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
14671 for (ParmVarDecl *Param : TransParams)
14673 Param->setDeclContext(Body);
14679 if (!TypeParamResult.isUnset())
14680 return TypeParamResult;
14683 if (getDerived().TransformRequiresExprRequirements(
E->getRequirements(),
14687 for (concepts::Requirement *Req : TransReqs) {
14688 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
14689 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
14690 ER->getReturnTypeRequirement()
14691 .getTypeConstraintTemplateParameterList()->getParam(0)
14692 ->setDeclContext(Body);
14697 return getDerived().RebuildRequiresExpr(
14698 E->getRequiresKWLoc(), Body,
E->getLParenLoc(), TransParams,
14699 E->getRParenLoc(), TransReqs,
E->getRBraceLoc());
14702template<
typename Derived>
14708 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
14709 TransReq = getDerived().TransformTypeRequirement(TypeReq);
14710 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
14711 TransReq = getDerived().TransformExprRequirement(ExprReq);
14713 TransReq = getDerived().TransformNestedRequirement(
14714 cast<concepts::NestedRequirement>(Req));
14717 Transformed.push_back(TransReq);
14722template<
typename Derived>
14727 if (getDerived().AlwaysRebuild())
14728 return getDerived().RebuildTypeRequirement(
14735 return getDerived().RebuildTypeRequirement(TransType);
14738template<
typename Derived>
14741 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
14750 TransExpr = TransExprRes.
get();
14753 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
14755 if (RetReq.isEmpty())
14756 TransRetReq.emplace();
14757 else if (RetReq.isSubstitutionFailure())
14758 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
14759 else if (RetReq.isTypeConstraint()) {
14761 RetReq.getTypeConstraintTemplateParameterList();
14763 getDerived().TransformTemplateParameterList(OrigTPL);
14766 TransRetReq.emplace(TPL);
14768 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
14769 if (
Expr *
E = TransExpr.dyn_cast<
Expr *>())
14770 return getDerived().RebuildExprRequirement(
E, Req->
isSimple(),
14772 std::move(*TransRetReq));
14773 return getDerived().RebuildExprRequirement(
14774 cast<concepts::Requirement::SubstitutionDiagnostic *>(TransExpr),
14778template<
typename Derived>
14783 if (getDerived().AlwaysRebuild())
14784 return getDerived().RebuildNestedRequirement(
14792 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
14795template<
typename Derived>
14798 TypeSourceInfo *
T = getDerived().TransformType(
E->getQueriedTypeSourceInfo());
14802 if (!getDerived().AlwaysRebuild() &&
14803 T ==
E->getQueriedTypeSourceInfo())
14810 SubExpr = getDerived().TransformExpr(
E->getDimensionExpression());
14814 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getDimensionExpression())
14818 return getDerived().RebuildArrayTypeTrait(
E->getTrait(),
E->
getBeginLoc(),
T,
14822template<
typename Derived>
14824TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *
E) {
14829 SubExpr = getDerived().TransformExpr(
E->getQueriedExpression());
14830 if (SubExpr.isInvalid())
14833 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getQueriedExpression())
14837 return getDerived().RebuildExpressionTrait(
E->getTrait(),
E->
getBeginLoc(),
14841template <
typename Derived>
14845 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
14846 DRE, AddrTaken, RecoveryTSI);
14853 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
14855 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
14859template <
typename Derived>
14862 return TransformDependentScopeDeclRefExpr(
E,
false,
14866template <
typename Derived>
14870 assert(
E->getQualifierLoc());
14872 getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
14882 getDerived().TransformDeclarationNameInfo(
E->getNameInfo());
14886 if (!
E->hasExplicitTemplateArgs()) {
14887 if (!getDerived().AlwaysRebuild() && QualifierLoc ==
E->getQualifierLoc() &&
14890 NameInfo.
getName() ==
E->getDeclName())
14893 return getDerived().RebuildDependentScopeDeclRefExpr(
14894 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
14895 IsAddressOfOperand, RecoveryTSI);
14898 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
14899 if (getDerived().TransformTemplateArguments(
14900 E->getTemplateArgs(),
E->getNumTemplateArgs(), TransArgs))
14903 return getDerived().RebuildDependentScopeDeclRefExpr(
14904 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
14908template<
typename Derived>
14910TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *
E) {
14914 if (getDerived().AllowSkippingCXXConstructExpr() &&
14915 ((
E->getNumArgs() == 1 ||
14916 (
E->getNumArgs() > 1 && getDerived().DropCallArgument(
E->getArg(1)))) &&
14917 (!getDerived().DropCallArgument(
E->getArg(0))) &&
14918 !
E->isListInitialization()))
14919 return getDerived().TransformInitializer(
E->getArg(0),
14922 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
14924 QualType
T = getDerived().TransformType(
E->
getType());
14928 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14929 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14933 bool ArgumentChanged =
false;
14936 EnterExpressionEvaluationContext Context(
14938 E->isListInitialization());
14939 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14944 if (!getDerived().AlwaysRebuild() &&
14946 Constructor ==
E->getConstructor() &&
14947 !ArgumentChanged) {
14954 return getDerived().RebuildCXXConstructExpr(
14956 E->hadMultipleCandidates(),
E->isListInitialization(),
14957 E->isStdInitListInitialization(),
E->requiresZeroInitialization(),
14958 E->getConstructionKind(),
E->getParenOrBraceRange());
14961template<
typename Derived>
14962ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
14963 CXXInheritedCtorInitExpr *
E) {
14964 QualType
T = getDerived().TransformType(
E->
getType());
14968 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14969 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14973 if (!getDerived().AlwaysRebuild() &&
14975 Constructor ==
E->getConstructor()) {
14982 return getDerived().RebuildCXXInheritedCtorInitExpr(
14983 T,
E->getLocation(), Constructor,
14984 E->constructsVBase(),
E->inheritedFromVBase());
14991template<
typename Derived>
14993TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *
E) {
14994 if (
auto *Dtor =
E->getTemporary()->getDestructor())
14996 const_cast<CXXDestructorDecl *
>(Dtor));
14997 return getDerived().TransformExpr(
E->getSubExpr());
15005template<
typename Derived>
15007TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *
E) {
15008 return getDerived().TransformExpr(
E->getSubExpr());
15011template<
typename Derived>
15013TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
15014 CXXTemporaryObjectExpr *
E) {
15015 TypeSourceInfo *
T =
15016 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15020 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
15021 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
15025 bool ArgumentChanged =
false;
15027 Args.reserve(
E->getNumArgs());
15029 EnterExpressionEvaluationContext Context(
15031 E->isListInitialization());
15032 if (TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
15036 if (
E->isListInitialization() && !
E->isStdInitListInitialization()) {
15038 if (Res.isInvalid())
15040 Args = {Res.get()};
15044 if (!getDerived().AlwaysRebuild() &&
15045 T ==
E->getTypeSourceInfo() &&
15046 Constructor ==
E->getConstructor() &&
15047 !ArgumentChanged) {
15053 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
15054 return getDerived().RebuildCXXTemporaryObjectExpr(
15055 T, LParenLoc, Args,
E->
getEndLoc(),
E->isListInitialization());
15058template<
typename Derived>
15060TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *
E) {
15063 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15064 struct TransformedInitCapture {
15066 SourceLocation EllipsisLoc;
15071 InitCaptures.resize(
E->explicit_capture_end() -
E->explicit_capture_begin());
15073 CEnd =
E->capture_end();
15075 if (!
E->isInitCapture(
C))
15078 TransformedInitCapture &
Result = InitCaptures[
C -
E->capture_begin()];
15079 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15081 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
15082 std::optional<unsigned> NumExpansions) {
15083 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15086 if (NewExprInitResult.isInvalid()) {
15087 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
15090 Expr *NewExprInit = NewExprInitResult.get();
15092 QualType NewInitCaptureType =
15093 getSema().buildLambdaInitCaptureInitialization(
15094 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15095 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15096 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
15099 Result.Expansions.push_back(
15100 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15104 if (OldVD->isParameterPack()) {
15105 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
15107 .castAs<PackExpansionTypeLoc>();
15113 bool Expand =
true;
15114 bool RetainExpansion =
false;
15115 std::optional<unsigned> OrigNumExpansions =
15116 ExpansionTL.getTypePtr()->getNumExpansions();
15117 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15118 if (getDerived().TryExpandParameterPacks(
15119 ExpansionTL.getEllipsisLoc(),
15120 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
15121 RetainExpansion, NumExpansions))
15123 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15124 "capture since it cannot be extended");
15126 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15127 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15128 SubstInitCapture(SourceLocation(), std::nullopt);
15131 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15132 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15135 SubstInitCapture(SourceLocation(), std::nullopt);
15139 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
15140 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
15151 DeclContext *DC = getSema().CurContext;
15169 while (DC->isRequiresExprBody())
15170 DC = DC->getParent();
15171 if ((getSema().isUnevaluatedContext() ||
15172 getSema().isConstantEvaluatedContext()) &&
15173 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15176 CXXRecordDecl *OldClass =
E->getLambdaClass();
15177 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
15178 E->getIntroducerRange(),
nullptr, DependencyKind,
15179 E->getCaptureDefault());
15180 getDerived().transformedLocalDecl(OldClass, {
Class});
15182 CXXMethodDecl *NewCallOperator =
15183 getSema().CreateLambdaCallOperator(
E->getIntroducerRange(),
Class);
15186 getSema().buildLambdaScope(LSI, NewCallOperator,
E->getIntroducerRange(),
15187 E->getCaptureDefault(),
E->getCaptureDefaultLoc(),
15188 E->hasExplicitParameters(),
E->isMutable());
15191 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
15198 CEnd =
E->capture_end();
15202 if (
C->isImplicit())
15206 if (
C->capturesThis()) {
15212 Sema::CXXThisScopeRAII ThisScope(
15214 dyn_cast_if_present<CXXRecordDecl>(
15215 getSema().getFunctionLevelDeclContext()),
15217 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15224 if (
C->capturesVLAType())
15228 if (
E->isInitCapture(
C)) {
15229 TransformedInitCapture &NewC = InitCaptures[
C -
E->capture_begin()];
15231 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
15234 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15236 QualType InitQualType = Info.second;
15237 if (
Init.isInvalid() || InitQualType.isNull()) {
15241 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15242 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15243 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15244 getSema().CurContext);
15249 NewVDs.push_back(NewVD);
15250 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15255 if (NewC.EllipsisLoc.isInvalid())
15256 LSI->ContainsUnexpandedParameterPack |=
15257 Init.get()->containsUnexpandedParameterPack();
15263 getDerived().transformedLocalDecl(OldVD, NewVDs);
15267 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15275 SourceLocation EllipsisLoc;
15276 if (
C->isPackExpansion()) {
15278 bool ShouldExpand =
false;
15279 bool RetainExpansion =
false;
15280 std::optional<unsigned> NumExpansions;
15281 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
15284 ShouldExpand, RetainExpansion,
15290 if (ShouldExpand) {
15294 auto *Pack = cast<VarDecl>(
C->getCapturedVar());
15295 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15296 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15297 VarDecl *CapturedVar
15298 = cast_or_null<VarDecl>(getDerived().TransformDecl(
C->getLocation(),
15300 if (!CapturedVar) {
15306 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15314 EllipsisLoc =
C->getEllipsisLoc();
15318 auto *CapturedVar = cast_or_null<ValueDecl>(
15319 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15320 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15327 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15328 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15331 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15334 getSema().finishLambdaExplicitCaptures(LSI);
15338 auto TPL = getDerived().TransformTemplateParameterList(
15339 E->getTemplateParameterList());
15340 LSI->GLTemplateParameterList = TPL;
15342 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15344 LSI->ContainsUnexpandedParameterPack |=
15345 TPL->containsUnexpandedParameterPack();
15348 TypeLocBuilder NewCallOpTLBuilder;
15349 TypeLoc OldCallOpTypeLoc =
15350 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15351 QualType NewCallOpType =
15352 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15353 if (NewCallOpType.isNull())
15355 LSI->ContainsUnexpandedParameterPack |=
15356 NewCallOpType->containsUnexpandedParameterPack();
15357 TypeSourceInfo *NewCallOpTSI =
15358 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15362 auto FPTL = NewCallOpTSI->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>();
15363 assert(FPTL &&
"Not a FunctionProtoType?");
15365 getSema().CompleteLambdaCallOperator(
15366 NewCallOperator,
E->getCallOperator()->getLocation(),
15367 E->getCallOperator()->getInnerLocStart(),
15368 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
15369 E->getCallOperator()->getConstexprKind(),
15370 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15371 E->hasExplicitResultType());
15373 getDerived().transformAttrs(
E->getCallOperator(), NewCallOperator);
15374 getDerived().transformedLocalDecl(
E->getCallOperator(), {NewCallOperator});
15378 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
15380 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15381 if (getDerived().ReplacingOriginal()) {
15382 Numbering = OldClass->getLambdaNumbering();
15385 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15390 getSema().PushExpressionEvaluationContext(
15391 E->getCallOperator()->isConsteval() ?
15394 getSema().currentEvaluationContext().InImmediateEscalatingFunctionContext =
15395 getSema().getLangOpts().CPlusPlus20 &&
15396 E->getCallOperator()->isImmediateEscalating();
15398 Sema::CodeSynthesisContext
C;
15401 getSema().pushCodeSynthesisContext(
C);
15407 getSema().popCodeSynthesisContext();
15410 FuncScopeCleanup.disable();
15412 if (Body.isInvalid()) {
15413 SavedContext.pop();
15422 auto LSICopy = *LSI;
15423 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15425 SavedContext.pop();
15460 DependencyKind = getDerived().ComputeLambdaDependency(&LSICopy);
15461 Class->setLambdaDependencyKind(DependencyKind);
15464 Class->setTypeForDecl(
nullptr);
15465 getSema().Context.getTypeDeclType(
Class);
15467 return getDerived().RebuildLambdaExpr(
E->
getBeginLoc(),
15468 Body.get()->getEndLoc(), &LSICopy);
15471template<
typename Derived>
15474 return TransformStmt(S);
15477template<
typename Derived>
15482 CEnd =
E->capture_end();
15486 if (!
C->isImplicit())
15490 if (
C->capturesThis()) {
15491 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15498 if (
C->capturesVLAType())
15501 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15502 assert(!
E->isInitCapture(
C) &&
"implicit init-capture?");
15505 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15506 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15511 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15517template<
typename Derived>
15522 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
15526 bool ArgumentChanged =
false;
15528 Args.reserve(
E->getNumArgs());
15532 E->isListInitialization());
15533 if (getDerived().TransformExprs(
E->arg_begin(),
E->getNumArgs(),
true, Args,
15538 if (!getDerived().AlwaysRebuild() &&
15539 T ==
E->getTypeSourceInfo() &&
15544 return getDerived().RebuildCXXUnresolvedConstructExpr(
15545 T,
E->getLParenLoc(), Args,
E->getRParenLoc(),
E->isListInitialization());
15548template<
typename Derived>
15550TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
15551 CXXDependentScopeMemberExpr *
E) {
15556 QualType ObjectType;
15557 if (!
E->isImplicitAccess()) {
15558 OldBase =
E->getBase();
15559 Base = getDerived().TransformExpr(OldBase);
15560 if (
Base.isInvalid())
15565 bool MayBePseudoDestructor =
false;
15567 E->getOperatorLoc(),
15568 E->isArrow()? tok::arrow : tok::period,
15570 MayBePseudoDestructor);
15571 if (
Base.isInvalid())
15574 ObjectType = ObjectTy.get();
15575 BaseType = ((Expr*)
Base.get())->getType();
15578 BaseType = getDerived().TransformType(
E->getBaseType());
15584 NamedDecl *FirstQualifierInScope
15585 = getDerived().TransformFirstQualifierInScope(
15586 E->getFirstQualifierFoundInScope(),
15589 NestedNameSpecifierLoc QualifierLoc;
15590 if (
E->getQualifier()) {
15592 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc(),
15594 FirstQualifierInScope);
15599 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
15605 DeclarationNameInfo NameInfo
15606 = getDerived().TransformDeclarationNameInfo(
E->getMemberNameInfo());
15607 if (!NameInfo.getName())
15610 if (!
E->hasExplicitTemplateArgs()) {
15613 if (!getDerived().AlwaysRebuild() &&
15614 Base.get() == OldBase &&
15615 BaseType ==
E->getBaseType() &&
15616 QualifierLoc ==
E->getQualifierLoc() &&
15617 NameInfo.getName() ==
E->getMember() &&
15618 FirstQualifierInScope ==
E->getFirstQualifierFoundInScope())
15621 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15624 E->getOperatorLoc(),
15627 FirstQualifierInScope,
15632 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
15633 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
15634 E->getNumTemplateArgs(),
15638 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15641 E->getOperatorLoc(),
15644 FirstQualifierInScope,
15649template <
typename Derived>
15650ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
15651 UnresolvedMemberExpr *Old) {
15655 if (!Old->isImplicitAccess()) {
15656 Base = getDerived().TransformExpr(Old->getBase());
15657 if (
Base.isInvalid())
15660 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
15661 if (
Base.isInvalid())
15663 BaseType =
Base.get()->getType();
15665 BaseType = getDerived().TransformType(Old->getBaseType());
15668 NestedNameSpecifierLoc QualifierLoc;
15669 if (Old->getQualifierLoc()) {
15671 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
15676 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
15681 if (TransformOverloadExprDecls(Old,
false, R))
15685 if (Old->getNamingClass()) {
15686 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
15687 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
15691 R.setNamingClass(NamingClass);
15694 TemplateArgumentListInfo TransArgs;
15695 if (Old->hasExplicitTemplateArgs()) {
15696 TransArgs.setLAngleLoc(Old->getLAngleLoc());
15697 TransArgs.setRAngleLoc(Old->getRAngleLoc());
15698 if (getDerived().TransformTemplateArguments(
15699 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
15707 NamedDecl *FirstQualifierInScope =
nullptr;
15709 return getDerived().RebuildUnresolvedMemberExpr(
15710 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
15711 TemplateKWLoc, FirstQualifierInScope, R,
15712 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
15715template<
typename Derived>
15717TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *
E) {
15720 ExprResult SubExpr = getDerived().TransformExpr(
E->getOperand());
15721 if (SubExpr.isInvalid())
15724 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getOperand())
15727 return getDerived().RebuildCXXNoexceptExpr(
E->
getSourceRange(),SubExpr.get());
15730template<
typename Derived>
15732TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *
E) {
15733 ExprResult Pattern = getDerived().TransformExpr(
E->getPattern());
15734 if (Pattern.isInvalid())
15737 if (!getDerived().AlwaysRebuild() && Pattern.get() ==
E->getPattern())
15740 return getDerived().RebuildPackExpansion(Pattern.get(),
E->getEllipsisLoc(),
15741 E->getNumExpansions());
15744template<
typename Derived>
15746TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *
E) {
15756 TemplateArgument ArgStorage;
15759 if (
E->isPartiallySubstituted()) {
15760 PackArgs =
E->getPartialArguments();
15763 bool ShouldExpand =
false;
15764 bool RetainExpansion =
false;
15765 std::optional<unsigned> NumExpansions;
15766 if (getDerived().TryExpandParameterPacks(
E->getOperatorLoc(),
E->getPackLoc(),
15768 ShouldExpand, RetainExpansion,
15774 if (ShouldExpand) {
15775 auto *Pack =
E->getPack();
15776 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
15777 ArgStorage = getSema().Context.getPackExpansionType(
15779 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
15780 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
15782 auto *VD = cast<ValueDecl>(Pack);
15783 ExprResult DRE = getSema().BuildDeclRefExpr(
15784 VD, VD->getType().getNonLValueExprType(getSema().Context),
15787 if (DRE.isInvalid())
15789 ArgStorage =
new (getSema().Context)
15790 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
15791 E->getPackLoc(), std::nullopt);
15793 PackArgs = ArgStorage;
15798 if (!PackArgs.size()) {
15799 auto *Pack = cast_or_null<NamedDecl>(
15800 getDerived().TransformDecl(
E->getPackLoc(),
E->getPack()));
15803 return getDerived().RebuildSizeOfPackExpr(
15804 E->getOperatorLoc(), Pack,
E->getPackLoc(),
E->getRParenLoc(),
15809 std::optional<unsigned>
Result = 0;
15810 for (
const TemplateArgument &Arg : PackArgs) {
15811 if (!Arg.isPackExpansion()) {
15816 TemplateArgumentLoc ArgLoc;
15817 InventTemplateArgumentLoc(Arg, ArgLoc);
15820 SourceLocation Ellipsis;
15821 std::optional<unsigned> OrigNumExpansions;
15822 TemplateArgumentLoc Pattern =
15823 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
15824 OrigNumExpansions);
15827 TemplateArgumentLoc OutPattern;
15828 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15829 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
15834 std::optional<unsigned> NumExpansions =
15835 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
15836 if (!NumExpansions) {
15849 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
15851 E->getRParenLoc(), *
Result, {});
15853 TemplateArgumentListInfo TransformedPackArgs(
E->getPackLoc(),
15856 TemporaryBase Rebase(*
this,
E->getPackLoc(), getBaseEntity());
15857 typedef TemplateArgumentLocInventIterator<
15858 Derived,
const TemplateArgument*> PackLocIterator;
15859 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
15860 PackLocIterator(*
this, PackArgs.end()),
15861 TransformedPackArgs,
true))
15868 bool PartialSubstitution =
false;
15869 for (
auto &
Loc : TransformedPackArgs.arguments()) {
15870 Args.push_back(
Loc.getArgument());
15871 if (
Loc.getArgument().isPackExpansion())
15872 PartialSubstitution =
true;
15875 if (PartialSubstitution)
15876 return getDerived().RebuildSizeOfPackExpr(
15877 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
15878 std::nullopt, Args);
15880 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
15881 E->getPackLoc(),
E->getRParenLoc(),
15885template <
typename Derived>
15887TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *
E) {
15894 EnterExpressionEvaluationContext ConstantContext(
15896 IndexExpr = getDerived().TransformExpr(
E->getIndexExpr());
15897 if (IndexExpr.isInvalid())
15902 bool FullySubstituted =
true;
15903 if (!
E->expandsToEmptyPack() &&
E->getExpressions().empty()) {
15904 Expr *Pattern =
E->getPackIdExpression();
15906 getSema().collectUnexpandedParameterPacks(
E->getPackIdExpression(),
15908 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15912 bool ShouldExpand =
true;
15913 bool RetainExpansion =
false;
15914 std::optional<unsigned> OrigNumExpansions;
15915 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15916 if (getDerived().TryExpandParameterPacks(
15918 ShouldExpand, RetainExpansion, NumExpansions))
15920 if (!ShouldExpand) {
15921 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15922 ExprResult Pack = getDerived().TransformExpr(Pattern);
15923 if (Pack.isInvalid())
15925 return getDerived().RebuildPackIndexingExpr(
15926 E->getEllipsisLoc(),
E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
15929 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15930 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15931 ExprResult Out = getDerived().TransformExpr(Pattern);
15932 if (Out.isInvalid())
15934 if (Out.get()->containsUnexpandedParameterPack()) {
15935 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
15936 OrigNumExpansions);
15937 if (Out.isInvalid())
15939 FullySubstituted =
false;
15941 ExpandedExprs.push_back(Out.get());
15945 if (RetainExpansion) {
15946 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15948 ExprResult Out = getDerived().TransformExpr(Pattern);
15949 if (Out.isInvalid())
15952 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
15953 OrigNumExpansions);
15954 if (Out.isInvalid())
15956 FullySubstituted =
false;
15957 ExpandedExprs.push_back(Out.get());
15959 }
else if (!
E->expandsToEmptyPack()) {
15960 if (getDerived().TransformExprs(
E->getExpressions().data(),
15961 E->getExpressions().size(),
false,
15966 return getDerived().RebuildPackIndexingExpr(
15967 E->getEllipsisLoc(),
E->getRSquareLoc(),
E->getPackIdExpression(),
15968 IndexExpr.get(), ExpandedExprs, FullySubstituted);
15971template<
typename Derived>
15973TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
15974 SubstNonTypeTemplateParmPackExpr *
E) {
15979template<
typename Derived>
15981TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
15982 SubstNonTypeTemplateParmExpr *
E) {
15987template<
typename Derived>
15989TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *
E) {
15994template<
typename Derived>
15996TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
15997 MaterializeTemporaryExpr *
E) {
15998 return getDerived().TransformExpr(
E->getSubExpr());
16001template<
typename Derived>
16003TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *
E) {
16004 UnresolvedLookupExpr *
Callee =
nullptr;
16005 if (Expr *OldCallee =
E->getCallee()) {
16006 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16007 if (CalleeResult.isInvalid())
16009 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
16012 Expr *Pattern =
E->getPattern();
16015 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16016 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16020 bool Expand =
true;
16021 bool RetainExpansion =
false;
16022 std::optional<unsigned> OrigNumExpansions =
E->getNumExpansions(),
16023 NumExpansions = OrigNumExpansions;
16024 if (getDerived().TryExpandParameterPacks(
E->getEllipsisLoc(),
16027 Expand, RetainExpansion,
16034 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16037 E->getLHS() ? getDerived().TransformExpr(
E->getLHS()) :
ExprResult();
16038 if (LHS.isInvalid())
16042 E->getRHS() ? getDerived().TransformExpr(
E->getRHS()) :
ExprResult();
16043 if (RHS.isInvalid())
16046 if (!getDerived().AlwaysRebuild() &&
16047 LHS.get() ==
E->getLHS() && RHS.get() ==
E->getRHS())
16050 return getDerived().RebuildCXXFoldExpr(
16052 E->getEllipsisLoc(), RHS.get(),
E->
getEndLoc(), NumExpansions);
16058 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
16059 SemaRef.
Diag(
E->getEllipsisLoc(),
16060 clang::diag::err_fold_expression_limit_exceeded)
16061 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16063 SemaRef.
Diag(
E->getEllipsisLoc(), diag::note_bracket_depth);
16072 bool LeftFold =
E->isLeftFold();
16076 if (!LeftFold && RetainExpansion) {
16077 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16079 ExprResult Out = getDerived().TransformExpr(Pattern);
16080 if (Out.isInvalid())
16083 Result = getDerived().RebuildCXXFoldExpr(
16090 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16091 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
16092 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16093 ExprResult Out = getDerived().TransformExpr(Pattern);
16094 if (Out.isInvalid())
16097 if (Out.get()->containsUnexpandedParameterPack()) {
16099 Result = getDerived().RebuildCXXFoldExpr(
16101 E->getOperator(),
E->getEllipsisLoc(),
16103 OrigNumExpansions);
16104 }
else if (
Result.isUsable()) {
16106 Expr *LHS = LeftFold ?
Result.get() : Out.get();
16107 Expr *RHS = LeftFold ? Out.get() :
Result.get();
16109 UnresolvedSet<16> Functions;
16110 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
16111 Result = getDerived().RebuildCXXOperatorCallExpr(
16113 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16114 Functions, LHS, RHS);
16116 Result = getDerived().RebuildBinaryOperator(
E->getEllipsisLoc(),
16117 E->getOperator(), LHS, RHS);
16128 if (LeftFold && RetainExpansion) {
16129 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16131 ExprResult Out = getDerived().TransformExpr(Pattern);
16132 if (Out.isInvalid())
16135 Result = getDerived().RebuildCXXFoldExpr(
16137 E->getEllipsisLoc(), Out.get(),
E->
getEndLoc(), OrigNumExpansions);
16142 if (ParenExpr *PE = dyn_cast_or_null<ParenExpr>(
Result.get()))
16143 PE->setIsProducedByFoldExpansion();
16148 return getDerived().RebuildEmptyCXXFoldExpr(
E->getEllipsisLoc(),
16153template <
typename Derived>
16155TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *
E) {
16158 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16162 return getDerived().RebuildParenListExpr(
E->
getBeginLoc(), TransformedInits,
16166template<
typename Derived>
16168TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
16169 CXXStdInitializerListExpr *
E) {
16170 return getDerived().TransformExpr(
E->getSubExpr());
16173template<
typename Derived>
16175TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *
E) {
16179template<
typename Derived>
16181TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *
E) {
16185template<
typename Derived>
16187TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *
E) {
16188 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
16189 if (SubExpr.isInvalid())
16192 if (!getDerived().AlwaysRebuild() &&
16193 SubExpr.get() ==
E->getSubExpr())
16196 return getDerived().RebuildObjCBoxedExpr(
E->
getSourceRange(), SubExpr.get());
16199template<
typename Derived>
16201TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *
E) {
16204 bool ArgChanged =
false;
16205 if (getDerived().TransformExprs(
E->getElements(),
E->getNumElements(),
16206 false, Elements, &ArgChanged))
16209 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16217template<
typename Derived>
16219TreeTransform<Derived>::TransformObjCDictionaryLiteral(
16220 ObjCDictionaryLiteral *
E) {
16223 bool ArgChanged =
false;
16224 for (
unsigned I = 0, N =
E->getNumElements(); I != N; ++I) {
16225 ObjCDictionaryElement OrigElement =
E->getKeyValueElement(I);
16227 if (OrigElement.isPackExpansion()) {
16230 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16231 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16232 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16236 bool Expand =
true;
16237 bool RetainExpansion =
false;
16238 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
16239 std::optional<unsigned> NumExpansions = OrigNumExpansions;
16240 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16241 OrigElement.Value->getEndLoc());
16242 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
16243 PatternRange, Unexpanded, Expand,
16244 RetainExpansion, NumExpansions))
16251 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16252 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16253 if (Key.isInvalid())
16256 if (Key.get() != OrigElement.Key)
16260 if (
Value.isInvalid())
16263 if (
Value.get() != OrigElement.Value)
16266 ObjCDictionaryElement Expansion = {
16267 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16269 Elements.push_back(Expansion);
16279 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16280 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
16281 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16282 if (Key.isInvalid())
16286 if (
Value.isInvalid())
16289 ObjCDictionaryElement Element = {
16290 Key.get(),
Value.get(), SourceLocation(), NumExpansions
16296 if (Key.get()->containsUnexpandedParameterPack() ||
16297 Value.get()->containsUnexpandedParameterPack())
16298 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16300 Elements.push_back(Element);
16310 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16311 if (Key.isInvalid())
16314 if (Key.get() != OrigElement.Key)
16319 = getDerived().TransformExpr(OrigElement.Value);
16320 if (
Value.isInvalid())
16323 if (
Value.get() != OrigElement.Value)
16326 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
16328 Elements.push_back(Element);
16331 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16334 return getDerived().RebuildObjCDictionaryLiteral(
E->
getSourceRange(),
16338template<
typename Derived>
16340TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *
E) {
16341 TypeSourceInfo *EncodedTypeInfo
16342 = getDerived().TransformType(
E->getEncodedTypeSourceInfo());
16343 if (!EncodedTypeInfo)
16346 if (!getDerived().AlwaysRebuild() &&
16347 EncodedTypeInfo ==
E->getEncodedTypeSourceInfo())
16350 return getDerived().RebuildObjCEncodeExpr(
E->getAtLoc(),
16352 E->getRParenLoc());
16355template<
typename Derived>
16357TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *
E) {
16362 return getDerived().TransformExpr(
E->getSubExpr());
16365template<
typename Derived>
16367TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *
E) {
16368 TypeSourceInfo *TSInfo
16369 = getDerived().TransformType(
E->getTypeInfoAsWritten());
16377 if (!getDerived().AlwaysRebuild() &&
16378 TSInfo ==
E->getTypeInfoAsWritten() &&
16379 Result.get() ==
E->getSubExpr())
16383 E->getLParenLoc(),
E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
16387template <
typename Derived>
16388ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
16389 ObjCAvailabilityCheckExpr *
E) {
16393template<
typename Derived>
16395TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *
E) {
16397 bool ArgChanged =
false;
16399 Args.reserve(
E->getNumArgs());
16400 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
false, Args,
16406 TypeSourceInfo *ReceiverTypeInfo
16407 = getDerived().TransformType(
E->getClassReceiverTypeInfo());
16408 if (!ReceiverTypeInfo)
16412 if (!getDerived().AlwaysRebuild() &&
16413 ReceiverTypeInfo ==
E->getClassReceiverTypeInfo() && !ArgChanged)
16418 E->getSelectorLocs(SelLocs);
16419 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16422 E->getMethodDecl(),
16429 if (!
E->getMethodDecl())
16434 E->getSelectorLocs(SelLocs);
16435 return getDerived().RebuildObjCMessageExpr(
E->getSuperLoc(),
16438 E->getReceiverType(),
16439 E->getMethodDecl(),
16447 "Only class and instance messages may be instantiated");
16449 = getDerived().TransformExpr(
E->getInstanceReceiver());
16450 if (Receiver.isInvalid())
16454 if (!getDerived().AlwaysRebuild() &&
16455 Receiver.get() ==
E->getInstanceReceiver() && !ArgChanged)
16460 E->getSelectorLocs(SelLocs);
16461 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16464 E->getMethodDecl(),
16470template<
typename Derived>
16472TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *
E) {
16476template<
typename Derived>
16478TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *
E) {
16482template<
typename Derived>
16484TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *
E) {
16487 if (
Base.isInvalid())
16493 if (!getDerived().AlwaysRebuild() &&
16494 Base.get() ==
E->getBase())
16497 return getDerived().RebuildObjCIvarRefExpr(
Base.get(),
E->getDecl(),
16499 E->isArrow(),
E->isFreeIvar());
16502template<
typename Derived>
16504TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *
E) {
16507 if (!
E->isObjectReceiver())
16512 if (
Base.isInvalid())
16518 if (!getDerived().AlwaysRebuild() &&
16519 Base.get() ==
E->getBase())
16522 if (
E->isExplicitProperty())
16523 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16524 E->getExplicitProperty(),
16527 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16529 E->getImplicitPropertyGetter(),
16530 E->getImplicitPropertySetter(),
16534template<
typename Derived>
16536TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *
E) {
16539 if (
Base.isInvalid())
16543 ExprResult Key = getDerived().TransformExpr(
E->getKeyExpr());
16544 if (Key.isInvalid())
16548 if (!getDerived().AlwaysRebuild() &&
16549 Key.get() ==
E->getKeyExpr() &&
Base.get() ==
E->getBaseExpr())
16552 return getDerived().RebuildObjCSubscriptRefExpr(
E->getRBracket(),
16553 Base.get(), Key.get(),
16554 E->getAtIndexMethodDecl(),
16555 E->setAtIndexMethodDecl());
16558template<
typename Derived>
16560TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *
E) {
16563 if (
Base.isInvalid())
16567 if (!getDerived().AlwaysRebuild() &&
16568 Base.get() ==
E->getBase())
16571 return getDerived().RebuildObjCIsaExpr(
Base.get(),
E->getIsaMemberLoc(),
16576template<
typename Derived>
16578TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *
E) {
16579 bool ArgumentChanged =
false;
16581 SubExprs.reserve(
E->getNumSubExprs());
16582 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16583 SubExprs, &ArgumentChanged))
16586 if (!getDerived().AlwaysRebuild() &&
16590 return getDerived().RebuildShuffleVectorExpr(
E->getBuiltinLoc(),
16592 E->getRParenLoc());
16595template<
typename Derived>
16597TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *
E) {
16598 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16599 if (SrcExpr.isInvalid())
16602 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
16606 if (!getDerived().AlwaysRebuild() &&
16607 Type ==
E->getTypeSourceInfo() &&
16608 SrcExpr.get() ==
E->getSrcExpr())
16611 return getDerived().RebuildConvertVectorExpr(
E->getBuiltinLoc(),
16612 SrcExpr.get(), Type,
16613 E->getRParenLoc());
16616template<
typename Derived>
16618TreeTransform<Derived>::TransformBlockExpr(BlockExpr *
E) {
16619 BlockDecl *oldBlock =
E->getBlockDecl();
16622 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
16625 blockScope->TheDecl->setBlockMissingReturnType(
16626 oldBlock->blockMissingReturnType());
16631 const FunctionProtoType *exprFunctionType =
E->getFunctionType();
16634 Sema::ExtParameterInfoBuilder extParamInfos;
16635 if (getDerived().TransformFunctionTypeParams(
16636 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
16637 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
16639 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16643 QualType exprResultType =
16644 getDerived().TransformType(exprFunctionType->getReturnType());
16646 auto epi = exprFunctionType->getExtProtoInfo();
16647 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
16650 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
16654 if (!params.empty())
16655 blockScope->TheDecl->setParams(params);
16657 if (!oldBlock->blockMissingReturnType()) {
16658 blockScope->HasImplicitReturnType =
false;
16659 blockScope->ReturnType = exprResultType;
16663 StmtResult body = getDerived().TransformStmt(
E->getBody());
16664 if (body.isInvalid()) {
16665 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
16673 for (
const auto &I : oldBlock->captures()) {
16674 VarDecl *oldCapture = I.getVariable();
16677 if (oldCapture->isParameterPack())
16680 VarDecl *newCapture =
16681 cast<VarDecl>(getDerived().TransformDecl(
E->getCaretLocation(),
16683 assert(blockScope->CaptureMap.count(newCapture));
16689 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
16690 "this pointer isn't captured in the old block");
16698template<
typename Derived>
16700TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *
E) {
16701 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
16702 if (SrcExpr.isInvalid())
16705 QualType
Type = getDerived().TransformType(
E->
getType());
16708 E->getRParenLoc());
16711template<
typename Derived>
16713TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *
E) {
16714 bool ArgumentChanged =
false;
16716 SubExprs.reserve(
E->getNumSubExprs());
16717 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
16718 SubExprs, &ArgumentChanged))
16721 if (!getDerived().AlwaysRebuild() &&
16725 return getDerived().RebuildAtomicExpr(
E->getBuiltinLoc(), SubExprs,
16726 E->getOp(),
E->getRParenLoc());
16733template<
typename Derived>
16737 getDerived().getBaseEntity());
16740template<
typename Derived>
16744 getDerived().getBaseEntity());
16747template<
typename Derived>
16750 bool WrittenAsLValue,
16753 Sigil, getDerived().getBaseEntity());
16756template<
typename Derived>
16762 getDerived().getBaseEntity());
16765template<
typename Derived>
16773 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16777template<
typename Derived>
16789 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
16790 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16795template<
typename Derived>
16802template <
typename Derived>
16805 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16806 if (SizeExpr || !Size)
16808 IndexTypeQuals, BracketsRange,
16809 getDerived().getBaseEntity());
16817 for (
const auto &
T : Types)
16829 IndexTypeQuals, BracketsRange,
16830 getDerived().getBaseEntity());
16833template <
typename Derived>
16836 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16837 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
16838 IndexTypeQuals, BracketsRange);
16841template <
typename Derived>
16845 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
16846 IndexTypeQuals, BracketsRange);
16849template <
typename Derived>
16852 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16853 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
16855 IndexTypeQuals, BracketsRange);
16858template <
typename Derived>
16861 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16862 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
16864 IndexTypeQuals, BracketsRange);
16867template <
typename Derived>
16874template <
typename Derived>
16876 unsigned NumElements,
16882template <
typename Derived>
16889template<
typename Derived>
16891 unsigned NumElements,
16894 NumElements,
true);
16901template<
typename Derived>
16909template <
typename Derived>
16911 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
16916template <
typename Derived>
16924template<
typename Derived>
16930 getDerived().getBaseLocation(),
16931 getDerived().getBaseEntity(),
16935template<
typename Derived>
16940template<
typename Derived>
16943 assert(
D &&
"no decl found");
16947 if (
auto *UPD = dyn_cast<UsingPackDecl>(
D)) {
16951 if (UPD->expansions().empty()) {
16952 getSema().Diag(
Loc, diag::err_using_pack_expansion_empty)
16953 << UPD->isCXXClassMember() << UPD;
16962 for (
auto *
E : UPD->expansions()) {
16968 else if (
T.isNull())
16972 "mismatched resolved types in using pack expansion");
16974 return T.isNull() ? FallbackT :
T;
16975 }
else if (
auto *Using = dyn_cast<UsingDecl>(
D)) {
16976 assert(Using->hasTypename() &&
16977 "UnresolvedUsingTypenameDecl transformed to non-typename using");
16980 assert(++Using->shadow_begin() == Using->shadow_end());
16989 assert(isa<UnresolvedUsingTypenameDecl>(
D) &&
16990 "UnresolvedUsingTypenameDecl transformed to non-using decl");
16992 cast<UnresolvedUsingTypenameDecl>(
D));
16996template <
typename Derived>
17002template<
typename Derived>
17008template <
typename Derived>
17013template <
typename Derived>
17019 FullySubstituted, Expansions);
17022template<
typename Derived>
17029template<
typename Derived>
17037template<
typename Derived>
17043template<
typename Derived>
17051template <
typename Derived>
17062template <
typename Derived>
17068template<
typename Derived>
17077template<
typename Derived>
17085 bool AllowInjectedClassName) {
17089 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17092 AllowInjectedClassName);
17093 return Template.
get();
17096template<
typename Derived>
17103 bool AllowInjectedClassName) {
17106 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17107 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
17109 getSema().ActOnTemplateName(
17111 false, Template, AllowInjectedClassName);
17112 return Template.
get();
17115template <
typename Derived>
17120 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17126 Opc,
First, Second);
17141 if (Op == OO_Subscript) {
17142 if (!
First->getType()->isOverloadableType() &&
17144 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17146 }
else if (Op == OO_Arrow) {
17149 if (
First->getType()->isDependentType())
17153 }
else if (Second ==
nullptr || isPostIncDec) {
17154 if (!
First->getType()->isOverloadableType() ||
17155 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
17162 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17166 !
First->getType()->isOverloadableType() &&
17181 if (!Second || isPostIncDec) {
17191 First, Second, RequiresADL);
17198template<
typename Derived>
17213 ->template getAs<RecordType>())){
17216 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17217 CCLoc, TildeLoc, Destroyed);
17229 if (!ScopeType->getType()->getAs<
TagType>()) {
17230 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17231 diag::err_expected_class_or_namespace)
17232 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
17240 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
17241 OperatorLoc, isArrow,
17249template<
typename Derived>
17257 for (
unsigned I = 0; I < NumParams; ++I) {
17258 if (I != ContextParamPos) {
17264 Params.push_back(std::make_pair(StringRef(), QualType()));
17267 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
17268 S->getCapturedRegionKind(), Params);
17271 Sema::CompoundScopeRAII CompoundScope(getSema());
17272 Body = getDerived().TransformStmt(S->getCapturedStmt());
17275 if (Body.isInvalid()) {
17276 getSema().ActOnCapturedRegionError();
17280 return getSema().ActOnCapturedRegionEnd(Body.get());
17283template <
typename Derived>
17284ExprResult TreeTransform<Derived>::TransformHLSLOutArgExpr(HLSLOutArgExpr *
E) {
17287 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.
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 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 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 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 SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
OpenACCDirectiveKind getDirectiveKind() const
SourceLocation getEndLoc() const
void setLParenLoc(SourceLocation EndLoc)
void setConditionDetails(Expr *ConditionExpr)
void setCollapseDetails(bool IsForce, Expr *LoopCount)
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
void setDefaultDetails(OpenACCDefaultClauseKind DefKind)
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
void setWaitDetails(Expr *DevNum, SourceLocation QueuesLoc, llvm::SmallVector< Expr * > &&IntExprs)
void setEndLoc(SourceLocation EndLoc)
Expr * getLoopCount() const
void setIntExprDetails(ArrayRef< Expr * > IntExprs)
OpenACCDefaultClauseKind getDefaultClauseKind() const
void ActOnWhileStmt(SourceLocation WhileLoc)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, OpenMPAllocateClauseModifier ACModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' 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 * 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 ...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
bool ContainsUnexpandedParameterPack
Whether 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.
@ 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
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
MutableArrayRef< Expr * > MultiExprArg
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
This structure contains most locations needed for by an OMPVarListClause.
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.