13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
47#include "llvm/ADT/ArrayRef.h"
48#include "llvm/Support/ErrorHandling.h"
52using namespace llvm::omp;
108template<
typename Derived>
113 class ForgetPartiallySubstitutedPackRAII {
118 ForgetPartiallySubstitutedPackRAII(Derived &Self) : Self(Self) {
119 Old = Self.ForgetPartiallySubstitutedPack();
122 ~ForgetPartiallySubstitutedPackRAII() {
123 Self.RememberPartiallySubstitutedPack(Old);
140 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
144 return static_cast<const Derived&
>(*this);
209 OldLocation = Self.getDerived().getBaseLocation();
210 OldEntity = Self.getDerived().getBaseEntity();
213 Self.getDerived().setBase(Location, Entity);
217 Self.getDerived().setBase(OldLocation, OldEntity);
247 return E->isDefaultArgument();
290 bool &ShouldExpand,
bool &RetainExpansion,
291 std::optional<unsigned> &NumExpansions) {
292 ShouldExpand =
false;
407 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
408#include "clang/Basic/AttrList.inc"
418 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
419 const X##Attr *A) { \
420 return getDerived().Transform##X##Attr(A); \
422#include "clang/Basic/AttrList.inc"
468 bool *ArgChanged =
nullptr);
477 llvm::DenseMap<Decl *, Decl *>::iterator Known
480 return Known->second;
508 assert(New.size() == 1 &&
509 "must override transformedLocalDecl if performing pack expansion");
547 NamedDecl *FirstQualifierInScope =
nullptr);
592 NamedDecl *FirstQualifierInScope =
nullptr,
593 bool AllowInjectedClassName =
false);
605 bool Uneval =
false);
628 bool Uneval =
false) {
647 template<
typename InputIterator>
651 bool Uneval =
false);
663#define ABSTRACT_TYPELOC(CLASS, PARENT)
664#define TYPELOC(CLASS, PARENT) \
665 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
666#include "clang/AST/TypeLocNodes.def"
670 bool SuppressObjCLifetime);
674 bool SuppressObjCLifetime);
676 template<
typename Fn>
683 template <
typename Fn>
685 Fn TransformModifiedType);
733 return getDerived().TransformFunctionTypeParams(
734 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
752 KWLoc, Params,
nullptr,
753 nullptr, PTypes, &TransParams, PInfos))
766 std::optional<unsigned> NumExpansions,
767 bool ExpectParameterPack);
794 bool IsAddressOfOperand,
802 bool IsAddressOfOperand);
808#define STMT(Node, Parent) \
809 LLVM_ATTRIBUTE_NOINLINE \
810 StmtResult Transform##Node(Node *S);
811#define VALUESTMT(Node, Parent) \
812 LLVM_ATTRIBUTE_NOINLINE \
813 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
814#define EXPR(Node, Parent) \
815 LLVM_ATTRIBUTE_NOINLINE \
816 ExprResult Transform##Node(Node *E);
817#define ABSTRACT_STMT(Stmt)
818#include "clang/AST/StmtNodes.inc"
820#define GEN_CLANG_CLAUSE_CLASS
821#define CLAUSE_CLASS(Enum, Str, Class) \
822 LLVM_ATTRIBUTE_NOINLINE \
823 OMPClause *Transform##Class(Class *S);
824#include "llvm/Frontend/OpenMP/OMP.inc"
901 const llvm::APInt *Size,
Expr *SizeExpr,
902 unsigned IndexTypeQuals,
SourceRange BracketsRange);
911 const llvm::APInt &Size,
Expr *SizeExpr,
912 unsigned IndexTypeQuals,
922 unsigned IndexTypeQuals,
932 unsigned IndexTypeQuals,
943 unsigned IndexTypeQuals,
981 unsigned NumColumns);
1068 bool FullySubstituted,
1082 TypeConstraintConcept,
1083 TypeConstraintArgs);
1091 Template, Deduced,
false);
1137 bool AllowInjectedClassName) {
1141 SS.
Adopt(QualifierLoc);
1143 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1144 AllowInjectedClassName);
1158 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1175 bool DeducedTSTContext) {
1177 SS.
Adopt(QualifierLoc);
1190 *
Id, IdLoc, DeducedTSTContext);
1208 switch (
Result.getResultKind()) {
1219 llvm_unreachable(
"Tag lookup cannot find non-tags");
1231 switch (
Result.getResultKind()) {
1237 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1238 << SomeDecl << NTK << llvm::to_underlying(Kind);
1244 << llvm::to_underlying(Kind) <<
Id << DC
1253 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1254 SemaRef.
Diag(Tag->getLocation(), diag::note_previous_use);
1271 std::optional<unsigned> NumExpansions) {
1316 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1339 Decl *AssociatedDecl,
unsigned Index,
1342 ArgPack, AssociatedDecl, Index, Final);
1420 Then, ElseLoc, Else);
1474 Inc, RParenLoc, Body);
1519 bool IsVolatile,
unsigned NumOutputs,
1526 NumInputs, Names, Constraints, Exprs,
1527 AsmString, Clobbers, NumLabels, RParenLoc);
1536 StringRef AsmString,
1537 unsigned NumOutputs,
unsigned NumInputs,
1543 NumOutputs, NumInputs,
1544 Constraints, Clobbers, Exprs, EndLoc);
1573 CoawaitLoc, Operand, OpCoawaitLookup);
1577 Suspend.
get(),
true);
1678 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1692 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1794 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1807 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1820 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1871 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1898 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1899 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1913 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1914 ReductionId, UnresolvedReductions);
1929 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1930 ReductionId, UnresolvedReductions);
1943 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1944 StepModifierLoc, EndLoc);
1957 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2017 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2030 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2045 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2046 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2047 ColonLoc, VarList, Locs,
2048 false, UnresolvedMappers);
2061 Allocate, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2084 ThreadLimit, StartLoc, LParenLoc, EndLoc);
2108 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2121 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2156 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2171 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2172 ColonLoc, VarList, Locs, UnresolvedMappers);
2187 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2188 ColonLoc, VarList, Locs, UnresolvedMappers);
2239 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2286 StartLoc, LParenLoc, EndLoc,
Data);
2299 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2311 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2324 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2335 LParenLoc, VarLoc, EndLoc);
2347 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2486 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2526 ForLoc, Element, Collection, RParenLoc);
2544 StartLoc, IdLoc,
Id);
2582 if (RangeStmt->isSingleDecl()) {
2583 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2584 if (RangeVar->isInvalidDecl())
2587 Expr *RangeExpr = RangeVar->getInit();
2594 diag::err_objc_for_range_init_stmt)
2595 <<
Init->getSourceRange();
2598 ForLoc, LoopVar, RangeExpr, RParenLoc);
2605 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2619 QualifierLoc, NameInfo, Nested);
2681 SS.
Adopt(QualifierLoc);
2793 if (IsOMPArraySection)
2795 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2796 Stride, RBracketLoc);
2798 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2799 "Stride/second colon not allowed for OpenACC");
2802 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2814 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2826 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2836 Expr *ExecConfig =
nullptr) {
2838 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2845 nullptr, Callee, LParenLoc, Args, RParenLoc);
2863 if (!
Member->getDeclName()) {
2867 assert(
Member->getType()->isRecordType() &&
2868 "unnamed member not of record type?");
2881 if (!isArrow &&
Base->isPRValue()) {
2890 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2896 SS.
Adopt(QualifierLoc);
2899 if (
Base->containsErrors())
2913 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2914 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2915 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2918 ->getAsCXXRecordDecl()) {
2919 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2922 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2930 FirstQualifierInScope,
2931 R, ExplicitTemplateArgs,
3109 Expr *ControllingExpr,
3114 ControllingExpr, Types, Exprs);
3129 ControllingType, Types, Exprs);
3162 case Stmt::CXXStaticCastExprClass:
3163 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3164 RAngleLoc, LParenLoc,
3165 SubExpr, RParenLoc);
3167 case Stmt::CXXDynamicCastExprClass:
3168 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3169 RAngleLoc, LParenLoc,
3170 SubExpr, RParenLoc);
3172 case Stmt::CXXReinterpretCastExprClass:
3173 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3174 RAngleLoc, LParenLoc,
3178 case Stmt::CXXConstCastExprClass:
3179 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3180 RAngleLoc, LParenLoc,
3181 SubExpr, RParenLoc);
3183 case Stmt::CXXAddrspaceCastExprClass:
3184 return getDerived().RebuildCXXAddrspaceCastExpr(
3185 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3188 llvm_unreachable(
"Invalid C++ named cast");
3266 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3278 bool ListInitialization) {
3282 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3284 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3285 RParenLoc, ListInitialization);
3288 ListInitialization);
3352 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3362 bool IsThrownVariableInScope) {
3372 Expr *RewrittenExpr) {
3374 RewrittenExpr,
getSema().CurContext);
3409 std::optional<Expr *> ArraySize,
3428 bool IsGlobalDelete,
3479 bool IsAddressOfOperand,
3482 SS.
Adopt(QualifierLoc);
3484 if (TemplateArgs || TemplateKWLoc.
isValid())
3486 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3489 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3511 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3512 bool ListInitialization,
bool StdInitListInitialization,
3518 if (Constructor->isInheritingConstructor())
3519 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3522 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3529 HadMultipleCandidates,
3531 StdInitListInitialization,
3532 RequiresZeroInit, ConstructKind,
3540 bool ConstructsVBase,
3541 bool InheritedFromVBase) {
3543 Loc,
T, Constructor, ConstructsVBase, InheritedFromVBase);
3554 bool ListInitialization) {
3556 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3567 bool ListInitialization) {
3569 RParenLoc, ListInitialization);
3586 SS.
Adopt(QualifierLoc);
3589 OperatorLoc, IsArrow,
3591 FirstQualifierInScope,
3593 TemplateArgs,
nullptr);
3609 SS.
Adopt(QualifierLoc);
3612 OperatorLoc, IsArrow,
3614 FirstQualifierInScope,
3615 R, TemplateArgs,
nullptr);
3630 std::optional<unsigned> Length,
3633 RParenLoc, Length, PartialArgs);
3638 Expr *PackIdExpression,
Expr *IndexExpr,
3640 bool EmptyPack =
false) {
3642 IndexExpr, RSquareLoc, ExpandedExprs,
3672 NamedConcept, TALI);
3690 LocalParameters, RParenLoc, Requirements,
3744 Expr **Elements,
unsigned NumElements) {
3754 RB,
Base, Key, getterMethod, setterMethod);
3786 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3801 Sel, Method, LBracLoc,
3802 SelectorLocs, RBracLoc, Args);
3816 nullptr, SuperType, SuperLoc, Sel, Method, LBracLoc,
3817 SelectorLocs, RBracLoc, Args)
3819 Sel, Method, LBracLoc,
3820 SelectorLocs, RBracLoc, Args);
3829 bool IsArrow,
bool IsFreeIvar) {
3838 if (IsFreeIvar &&
Result.isUsable())
3839 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3875 PropertyLoc,
Base));
3907 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3916 CK_BuiltinFnToFnPtr).
get();
3942 std::optional<unsigned> NumExpansions) {
3947 EllipsisLoc, NumExpansions);
3969 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
3990 std::optional<unsigned> NumExpansions) {
4003 std::optional<unsigned> NumExpansions) {
4005 EllipsisLoc, RHS, RParenLoc,
4044 EndLoc, Clauses, StrBlock);
4073 bool DeducibleTSTContext);
4085template <
typename Derived>
4090 switch (S->getStmtClass()) {
4095#define STMT(Node, Parent) \
4096 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4097#define VALUESTMT(Node, Parent) \
4098 case Stmt::Node##Class: \
4099 return getDerived().Transform##Node(cast<Node>(S), SDK);
4100#define ABSTRACT_STMT(Node)
4101#define EXPR(Node, Parent)
4102#include "clang/AST/StmtNodes.inc"
4105#define STMT(Node, Parent)
4106#define ABSTRACT_STMT(Stmt)
4107#define EXPR(Node, Parent) case Stmt::Node##Class:
4108#include "clang/AST/StmtNodes.inc"
4110 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4112 if (SDK == SDK_StmtExprResult)
4113 E = getSema().ActOnStmtExprResult(
E);
4114 return getSema().ActOnExprStmt(
E, SDK == SDK_Discarded);
4121template<
typename Derived>
4126 switch (S->getClauseKind()) {
4129#define GEN_CLANG_CLAUSE_CLASS
4130#define CLAUSE_CLASS(Enum, Str, Class) \
4132 return getDerived().Transform##Class(cast<Class>(S));
4133#include "llvm/Frontend/OpenMP/OMP.inc"
4140template<
typename Derived>
4147#define STMT(Node, Parent) case Stmt::Node##Class: break;
4148#define ABSTRACT_STMT(Stmt)
4149#define EXPR(Node, Parent) \
4150 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4151#include "clang/AST/StmtNodes.inc"
4157template<
typename Derived>
4165 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4166 Init = FE->getSubExpr();
4168 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4174 Init = MTE->getSubExpr();
4177 Init = Binder->getSubExpr();
4180 Init = ICE->getSubExprAsWritten();
4183 dyn_cast<CXXStdInitializerListExpr>(
Init))
4184 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4191 return getDerived().TransformExpr(
Init);
4196 return getDerived().RebuildParenListExpr(
Parens.getBegin(), std::nullopt,
4201 if (isa<ImplicitValueInitExpr>(
Init))
4202 return getDerived().RebuildParenListExpr(
SourceLocation(), std::nullopt,
4207 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4208 return getDerived().TransformExpr(
Init);
4213 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4220 getSema().keepInLifetimeExtendingContext();
4222 bool ArgChanged =
false;
4224 true, NewArgs, &ArgChanged))
4229 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4234 if (
Parens.isInvalid()) {
4237 assert(NewArgs.empty() &&
4238 "no parens or braces but have direct init with arguments?");
4241 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4245template<
typename Derived>
4251 for (
unsigned I = 0; I != NumInputs; ++I) {
4253 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4261 Expr *Pattern = Expansion->getPattern();
4264 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4265 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4270 bool RetainExpansion =
false;
4271 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4272 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4273 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4276 Expand, RetainExpansion,
4285 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4289 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4290 Expansion->getEllipsisLoc(),
4292 if (Out.isInvalid())
4297 Outputs.push_back(Out.get());
4303 if (ArgChanged) *ArgChanged =
true;
4307 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4309 ExprResult Out = getDerived().TransformExpr(Pattern);
4310 if (Out.isInvalid())
4313 if (Out.get()->containsUnexpandedParameterPack()) {
4314 Out = getDerived().RebuildPackExpansion(
4315 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4316 if (Out.isInvalid())
4320 Outputs.push_back(Out.get());
4325 if (RetainExpansion) {
4326 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4328 ExprResult Out = getDerived().TransformExpr(Pattern);
4329 if (Out.isInvalid())
4332 Out = getDerived().RebuildPackExpansion(
4333 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4334 if (Out.isInvalid())
4337 Outputs.push_back(Out.get());
4344 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4345 : getDerived().TransformExpr(Inputs[I]);
4349 if (
Result.get() != Inputs[I] && ArgChanged)
4352 Outputs.push_back(
Result.get());
4358template <
typename Derived>
4362 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4363 getDerived().TransformDefinition(Var->
getLocation(), Var));
4368 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4377 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4384template <
typename Derived>
4392 Qualifier = Qualifier.getPrefix())
4408 SS, FirstQualifierInScope,
false))
4415 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4423 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4438 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4447 FirstQualifierInScope, SS);
4457 diag::warn_cxx98_compat_enum_nested_name_spec);
4460 SS.
Adopt(ETL.getQualifierLoc());
4461 TL = ETL.getNamedTypeLoc();
4480 FirstQualifierInScope =
nullptr;
4486 !getDerived().AlwaysRebuild())
4499template<
typename Derived>
4507 switch (Name.getNameKind()) {
4518 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4519 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4520 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4536 NewTInfo = getDerived().TransformType(OldTInfo);
4544 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4560 llvm_unreachable(
"Unknown name kind.");
4563template<
typename Derived>
4570 bool AllowInjectedClassName) {
4572 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4573 assert(Template &&
"qualified template name must refer to a template");
4576 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4581 if (!getDerived().AlwaysRebuild() &&
4583 TransTemplate == Template)
4586 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4594 FirstQualifierInScope =
nullptr;
4597 if (!getDerived().AlwaysRebuild() &&
4605 if (DTN->isIdentifier()) {
4606 return getDerived().RebuildTemplateName(SS,
4608 *DTN->getIdentifier(),
4611 FirstQualifierInScope,
4612 AllowInjectedClassName);
4615 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4616 DTN->getOperator(), NameLoc,
4617 ObjectType, AllowInjectedClassName);
4621 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4623 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4628 return getDerived().RebuildTemplateName(SS,
false,
4633 = Name.getAsSubstTemplateTemplateParmPack()) {
4634 return getDerived().RebuildTemplateName(
4635 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4636 SubstPack->getIndex(), SubstPack->getFinal());
4640 llvm_unreachable(
"overloaded function decl survived to here");
4643template<
typename Derived>
4647 Output = getSema().getTrivialTemplateArgumentLoc(
4648 Arg,
QualType(), getDerived().getBaseLocation());
4651template <
typename Derived>
4659 llvm_unreachable(
"Unexpected TemplateArgument");
4669 QualType NewT = getDerived().TransformType(
T);
4676 ValueDecl *NewD =
D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4677 getDerived().getBaseLocation(),
D))
4682 if (NewT ==
T &&
D == NewD)
4699 llvm_unreachable(
"unexpected template argument kind");
4709 DI = getDerived().TransformType(DI);
4720 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4726 SS.
Adopt(QualifierLoc);
4727 TemplateName Template = getDerived().TransformTemplateName(
4738 llvm_unreachable(
"Caller should expand pack expansions");
4753 ExprResult E = getDerived().TransformExpr(InputExpr);
4768template<
typename Derived,
typename InputIterator>
4776 typedef typename std::iterator_traits<InputIterator>::difference_type
4806 Self.InventTemplateArgumentLoc(*
Iter,
Result);
4814 return X.Iter == Y.Iter;
4819 return X.Iter != Y.Iter;
4823template<
typename Derived>
4824template<
typename InputIterator>
4841 if (TransformTemplateArguments(PackLocIterator(*
this,
4842 In.getArgument().pack_begin()),
4843 PackLocIterator(*
this,
4844 In.getArgument().pack_end()),
4851 if (In.getArgument().isPackExpansion()) {
4855 std::optional<unsigned> OrigNumExpansions;
4857 = getSema().getTemplateArgumentPackExpansionPattern(
4858 In, Ellipsis, OrigNumExpansions);
4861 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4862 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4867 bool RetainExpansion =
false;
4868 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4869 if (getDerived().TryExpandParameterPacks(Ellipsis,
4883 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
4886 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
4888 if (Out.getArgument().isNull())
4897 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4900 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4903 if (Out.getArgument().containsUnexpandedParameterPack()) {
4904 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4906 if (Out.getArgument().isNull())
4915 if (RetainExpansion) {
4916 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4918 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4921 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4923 if (Out.getArgument().isNull())
4933 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
4947template<
typename Derived>
4949 if (getDerived().AlreadyTransformed(
T))
4955 getDerived().getBaseLocation());
4965template<
typename Derived>
4969 getDerived().getBaseEntity());
4970 if (getDerived().AlreadyTransformed(DI->
getType()))
4985template<
typename Derived>
4988 switch (
T.getTypeLocClass()) {
4989#define ABSTRACT_TYPELOC(CLASS, PARENT)
4990#define TYPELOC(CLASS, PARENT) \
4991 case TypeLoc::CLASS: \
4992 return getDerived().Transform##CLASS##Type(TLB, \
4993 T.castAs<CLASS##TypeLoc>());
4994#include "clang/AST/TypeLocNodes.def"
4997 llvm_unreachable(
"unhandled type loc!");
5000template<
typename Derived>
5002 if (!isa<DependentNameType>(
T))
5003 return TransformType(
T);
5005 if (getDerived().AlreadyTransformed(
T))
5008 getDerived().getBaseLocation());
5009 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5013template<
typename Derived>
5016 if (!isa<DependentNameType>(DI->
getType()))
5017 return TransformType(DI);
5021 getDerived().getBaseEntity());
5022 if (getDerived().AlreadyTransformed(DI->
getType()))
5042 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5051template<
typename Derived>
5056 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5057 auto SuppressObjCLifetime =
5058 T.getType().getLocalQualifiers().hasObjCLifetime();
5060 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5061 SuppressObjCLifetime);
5062 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5063 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5064 TLB, STTP, SuppressObjCLifetime);
5066 Result = getDerived().TransformType(TLB, UnqualTL);
5085template <
typename Derived>
5095 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5126 else if (
T.getObjCLifetime()) {
5131 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5147 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5156template<
typename Derived>
5162 if (getDerived().AlreadyTransformed(TL.
getType()))
5166 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5172template<
typename Derived>
5174TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5175 QualType ObjectType,
5176 NamedDecl *UnqualLookup,
5178 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5181 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5185template <
typename Derived>
5186TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5187 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5189 QualType
T = TL.getType();
5190 assert(!getDerived().AlreadyTransformed(
T));
5195 if (isa<TemplateSpecializationType>(
T)) {
5196 TemplateSpecializationTypeLoc SpecTL =
5197 TL.castAs<TemplateSpecializationTypeLoc>();
5199 TemplateName Template = getDerived().TransformTemplateName(
5200 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5201 ObjectType, UnqualLookup,
true);
5202 if (Template.isNull())
5205 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5207 }
else if (isa<DependentTemplateSpecializationType>(
T)) {
5208 DependentTemplateSpecializationTypeLoc SpecTL =
5209 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5211 TemplateName Template
5212 = getDerived().RebuildTemplateName(SS,
5213 SpecTL.getTemplateKeywordLoc(),
5214 *SpecTL.getTypePtr()->getIdentifier(),
5215 SpecTL.getTemplateNameLoc(),
5216 ObjectType, UnqualLookup,
5218 if (Template.isNull())
5221 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5227 Result = getDerived().TransformType(TLB, TL);
5236template <
class TyLoc>
static inline
5238 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5239 NewT.setNameLoc(
T.getNameLoc());
5243template<
typename Derived>
5244QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5246 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5247 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5248 if (
T.needsExtraLocalData())
5249 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5253template<
typename Derived>
5254QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5260template <
typename Derived>
5261QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5262 AdjustedTypeLoc TL) {
5264 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5267template<
typename Derived>
5268QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5269 DecayedTypeLoc TL) {
5270 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5271 if (OriginalType.isNull())
5274 QualType
Result = TL.getType();
5275 if (getDerived().AlwaysRebuild() ||
5276 OriginalType != TL.getOriginalLoc().getType())
5278 TLB.push<DecayedTypeLoc>(
Result);
5283template <
typename Derived>
5285TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5286 ArrayParameterTypeLoc TL) {
5287 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5288 if (OriginalType.isNull())
5291 QualType
Result = TL.getType();
5292 if (getDerived().AlwaysRebuild() ||
5293 OriginalType != TL.getElementLoc().getType())
5295 TLB.push<ArrayParameterTypeLoc>(
Result);
5300template<
typename Derived>
5301QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5302 PointerTypeLoc TL) {
5303 QualType PointeeType
5304 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5305 if (PointeeType.isNull())
5308 QualType
Result = TL.getType();
5309 if (PointeeType->getAs<ObjCObjectType>()) {
5316 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5317 NewT.setStarLoc(TL.getStarLoc());
5321 if (getDerived().AlwaysRebuild() ||
5322 PointeeType != TL.getPointeeLoc().getType()) {
5323 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5330 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5332 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5333 NewT.setSigilLoc(TL.getSigilLoc());
5337template<
typename Derived>
5339TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5340 BlockPointerTypeLoc TL) {
5341 QualType PointeeType
5342 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5343 if (PointeeType.isNull())
5346 QualType
Result = TL.getType();
5347 if (getDerived().AlwaysRebuild() ||
5348 PointeeType != TL.getPointeeLoc().getType()) {
5349 Result = getDerived().RebuildBlockPointerType(PointeeType,
5355 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5356 NewT.setSigilLoc(TL.getSigilLoc());
5364template<
typename Derived>
5372 if (PointeeType.
isNull())
5376 if (getDerived().AlwaysRebuild() ||
5377 PointeeType !=
T->getPointeeTypeAsWritten()) {
5378 Result = getDerived().RebuildReferenceType(PointeeType,
5379 T->isSpelledAsLValue(),
5392 if (isa<LValueReferenceType>(
Result))
5401template<
typename Derived>
5405 return TransformReferenceType(TLB, TL);
5408template<
typename Derived>
5410TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5411 RValueReferenceTypeLoc TL) {
5412 return TransformReferenceType(TLB, TL);
5415template<
typename Derived>
5417TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5418 MemberPointerTypeLoc TL) {
5419 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5420 if (PointeeType.isNull())
5423 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5424 TypeSourceInfo *NewClsTInfo =
nullptr;
5426 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5431 const MemberPointerType *
T = TL.getTypePtr();
5432 QualType OldClsType = QualType(
T->getClass(), 0);
5433 QualType NewClsType;
5435 NewClsType = NewClsTInfo->getType();
5437 NewClsType = getDerived().TransformType(OldClsType);
5438 if (NewClsType.isNull())
5442 QualType
Result = TL.getType();
5443 if (getDerived().AlwaysRebuild() ||
5445 NewClsType != OldClsType) {
5446 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5454 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5455 if (MPT && PointeeType != MPT->getPointeeType()) {
5456 assert(isa<AdjustedType>(MPT->getPointeeType()));
5457 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5460 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5461 NewTL.setSigilLoc(TL.getSigilLoc());
5462 NewTL.setClassTInfo(NewClsTInfo);
5467template<
typename Derived>
5469TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5470 ConstantArrayTypeLoc TL) {
5471 const ConstantArrayType *
T = TL.getTypePtr();
5472 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5473 if (ElementType.isNull())
5477 Expr *
OldSize = TL.getSizeExpr();
5479 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5480 Expr *NewSize =
nullptr;
5484 NewSize = getDerived().TransformExpr(
OldSize).template getAs<Expr>();
5488 QualType
Result = TL.getType();
5489 if (getDerived().AlwaysRebuild() ||
5490 ElementType !=
T->getElementType() ||
5491 (
T->getSizeExpr() && NewSize !=
OldSize)) {
5492 Result = getDerived().RebuildConstantArrayType(ElementType,
5493 T->getSizeModifier(),
5494 T->getSize(), NewSize,
5495 T->getIndexTypeCVRQualifiers(),
5496 TL.getBracketsRange());
5505 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5506 NewTL.setLBracketLoc(TL.getLBracketLoc());
5507 NewTL.setRBracketLoc(TL.getRBracketLoc());
5508 NewTL.setSizeExpr(NewSize);
5513template<
typename Derived>
5514QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5515 TypeLocBuilder &TLB,
5516 IncompleteArrayTypeLoc TL) {
5517 const IncompleteArrayType *
T = TL.getTypePtr();
5518 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5519 if (ElementType.isNull())
5522 QualType
Result = TL.getType();
5523 if (getDerived().AlwaysRebuild() ||
5524 ElementType !=
T->getElementType()) {
5525 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5526 T->getSizeModifier(),
5527 T->getIndexTypeCVRQualifiers(),
5528 TL.getBracketsRange());
5533 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5534 NewTL.setLBracketLoc(TL.getLBracketLoc());
5535 NewTL.setRBracketLoc(TL.getRBracketLoc());
5536 NewTL.setSizeExpr(
nullptr);
5541template<
typename Derived>
5543TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5544 VariableArrayTypeLoc TL) {
5545 const VariableArrayType *
T = TL.getTypePtr();
5546 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5547 if (ElementType.isNull())
5552 EnterExpressionEvaluationContext Context(
5554 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5556 if (SizeResult.isInvalid())
5560 if (SizeResult.isInvalid())
5563 Expr *
Size = SizeResult.get();
5565 QualType
Result = TL.getType();
5566 if (getDerived().AlwaysRebuild() ||
5567 ElementType !=
T->getElementType() ||
5568 Size !=
T->getSizeExpr()) {
5569 Result = getDerived().RebuildVariableArrayType(ElementType,
5570 T->getSizeModifier(),
5572 T->getIndexTypeCVRQualifiers(),
5573 TL.getBracketsRange());
5580 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5581 NewTL.setLBracketLoc(TL.getLBracketLoc());
5582 NewTL.setRBracketLoc(TL.getRBracketLoc());
5583 NewTL.setSizeExpr(Size);
5588template<
typename Derived>
5590TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5591 DependentSizedArrayTypeLoc TL) {
5592 const DependentSizedArrayType *
T = TL.getTypePtr();
5593 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5594 if (ElementType.isNull())
5602 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5605 Expr *origSize = TL.getSizeExpr();
5606 if (!origSize) origSize =
T->getSizeExpr();
5609 = getDerived().TransformExpr(origSize);
5611 if (sizeResult.isInvalid())
5614 Expr *size = sizeResult.get();
5616 QualType
Result = TL.getType();
5617 if (getDerived().AlwaysRebuild() ||
5618 ElementType !=
T->getElementType() ||
5620 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5621 T->getSizeModifier(),
5623 T->getIndexTypeCVRQualifiers(),
5624 TL.getBracketsRange());
5631 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5632 NewTL.setLBracketLoc(TL.getLBracketLoc());
5633 NewTL.setRBracketLoc(TL.getRBracketLoc());
5634 NewTL.setSizeExpr(size);
5639template <
typename Derived>
5640QualType TreeTransform<Derived>::TransformDependentVectorType(
5641 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5642 const DependentVectorType *
T = TL.getTypePtr();
5643 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5644 if (ElementType.isNull())
5652 if (
Size.isInvalid())
5655 QualType
Result = TL.getType();
5656 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5657 Size.get() !=
T->getSizeExpr()) {
5658 Result = getDerived().RebuildDependentVectorType(
5659 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5665 if (isa<DependentVectorType>(
Result)) {
5666 DependentVectorTypeLoc NewTL =
5667 TLB.push<DependentVectorTypeLoc>(
Result);
5668 NewTL.setNameLoc(TL.getNameLoc());
5670 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5671 NewTL.setNameLoc(TL.getNameLoc());
5677template<
typename Derived>
5678QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5679 TypeLocBuilder &TLB,
5680 DependentSizedExtVectorTypeLoc TL) {
5681 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5684 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5685 if (ElementType.isNull())
5694 if (
Size.isInvalid())
5697 QualType
Result = TL.getType();
5698 if (getDerived().AlwaysRebuild() ||
5699 ElementType !=
T->getElementType() ||
5700 Size.get() !=
T->getSizeExpr()) {
5701 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5703 T->getAttributeLoc());
5709 if (isa<DependentSizedExtVectorType>(
Result)) {
5710 DependentSizedExtVectorTypeLoc NewTL
5711 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5712 NewTL.setNameLoc(TL.getNameLoc());
5714 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5715 NewTL.setNameLoc(TL.getNameLoc());
5721template <
typename Derived>
5723TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5724 ConstantMatrixTypeLoc TL) {
5725 const ConstantMatrixType *
T = TL.getTypePtr();
5726 QualType ElementType = getDerived().TransformType(
T->getElementType());
5727 if (ElementType.isNull())
5730 QualType
Result = TL.getType();
5731 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
5732 Result = getDerived().RebuildConstantMatrixType(
5733 ElementType,
T->getNumRows(),
T->getNumColumns());
5738 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5739 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5740 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5741 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5742 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5747template <
typename Derived>
5748QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5749 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5750 const DependentSizedMatrixType *
T = TL.getTypePtr();
5752 QualType ElementType = getDerived().TransformType(
T->getElementType());
5753 if (ElementType.isNull()) {
5761 Expr *origRows = TL.getAttrRowOperand();
5763 origRows =
T->getRowExpr();
5764 Expr *origColumns = TL.getAttrColumnOperand();
5766 origColumns =
T->getColumnExpr();
5768 ExprResult rowResult = getDerived().TransformExpr(origRows);
5770 if (rowResult.isInvalid())
5773 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5775 if (columnResult.isInvalid())
5778 Expr *rows = rowResult.get();
5779 Expr *columns = columnResult.get();
5781 QualType
Result = TL.getType();
5782 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5783 rows != origRows || columns != origColumns) {
5784 Result = getDerived().RebuildDependentSizedMatrixType(
5785 ElementType, rows, columns,
T->getAttributeLoc());
5793 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5794 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5795 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5796 NewTL.setAttrRowOperand(rows);
5797 NewTL.setAttrColumnOperand(columns);
5801template <
typename Derived>
5802QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5803 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5804 const DependentAddressSpaceType *
T = TL.getTypePtr();
5806 QualType pointeeType = getDerived().TransformType(
T->
getPointeeType());
5808 if (pointeeType.isNull())
5815 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
5817 if (AddrSpace.isInvalid())
5820 QualType
Result = TL.getType();
5821 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
5822 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
5823 Result = getDerived().RebuildDependentAddressSpaceType(
5824 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
5830 if (isa<DependentAddressSpaceType>(
Result)) {
5831 DependentAddressSpaceTypeLoc NewTL =
5832 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
5834 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5835 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
5836 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5839 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(
5840 Result, getDerived().getBaseLocation());
5841 TransformType(TLB, DI->getTypeLoc());
5847template <
typename Derived>
5848QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
5850 const VectorType *
T = TL.getTypePtr();
5851 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5852 if (ElementType.isNull())
5855 QualType
Result = TL.getType();
5856 if (getDerived().AlwaysRebuild() ||
5857 ElementType !=
T->getElementType()) {
5858 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
5859 T->getVectorKind());
5864 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5865 NewTL.setNameLoc(TL.getNameLoc());
5870template<
typename Derived>
5871QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
5872 ExtVectorTypeLoc TL) {
5873 const VectorType *
T = TL.getTypePtr();
5874 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5875 if (ElementType.isNull())
5878 QualType
Result = TL.getType();
5879 if (getDerived().AlwaysRebuild() ||
5880 ElementType !=
T->getElementType()) {
5881 Result = getDerived().RebuildExtVectorType(ElementType,
5882 T->getNumElements(),
5888 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5889 NewTL.setNameLoc(TL.getNameLoc());
5894template <
typename Derived>
5897 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
5901 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
5928 NewDI = getDerived().TransformType(OldDI);
5932 if (NewDI == OldDI && indexAdjustment == 0)
5946 transformedLocalDecl(OldParm, {newParm});
5950template <
typename Derived>
5958 unsigned *LastParamTransformed) {
5959 int indexAdjustment = 0;
5961 unsigned NumParams = Params.size();
5962 for (
unsigned i = 0; i != NumParams; ++i) {
5963 if (LastParamTransformed)
5964 *LastParamTransformed = i;
5966 assert(OldParm->getFunctionScopeIndex() == i);
5968 std::optional<unsigned> NumExpansions;
5970 if (OldParm->isParameterPack()) {
5975 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
5981 bool ShouldExpand =
false;
5982 bool RetainExpansion =
false;
5983 std::optional<unsigned> OrigNumExpansions;
5984 if (Unexpanded.size() > 0) {
5986 NumExpansions = OrigNumExpansions;
5987 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
5988 Pattern.getSourceRange(),
6000 "Could not find parameter packs or undeduced auto type!");
6007 getDerived().ExpandingFunctionParameterPack(OldParm);
6008 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6011 = getDerived().TransformFunctionTypeParam(OldParm,
6019 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6020 OutParamTypes.push_back(NewParm->
getType());
6022 PVars->push_back(NewParm);
6027 if (RetainExpansion) {
6028 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6030 = getDerived().TransformFunctionTypeParam(OldParm,
6038 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6039 OutParamTypes.push_back(NewParm->
getType());
6041 PVars->push_back(NewParm);
6057 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6062 "Parameter pack no longer a parameter pack after "
6065 NewParm = getDerived().TransformFunctionTypeParam(
6066 OldParm, indexAdjustment, std::nullopt,
6074 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6075 OutParamTypes.push_back(NewParm->
getType());
6077 PVars->push_back(NewParm);
6085 bool IsPackExpansion =
false;
6086 std::optional<unsigned> NumExpansions;
6089 = dyn_cast<PackExpansionType>(OldType)) {
6091 QualType Pattern = Expansion->getPattern();
6093 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6096 bool ShouldExpand =
false;
6097 bool RetainExpansion =
false;
6109 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6111 QualType NewType = getDerived().TransformType(Pattern);
6116 NewType = getSema().getASTContext().getPackExpansionType(
6117 NewType, std::nullopt);
6124 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6125 OutParamTypes.push_back(NewType);
6127 PVars->push_back(
nullptr);
6136 if (RetainExpansion) {
6137 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6138 QualType NewType = getDerived().TransformType(Pattern);
6143 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6144 OutParamTypes.push_back(NewType);
6146 PVars->push_back(
nullptr);
6151 OldType = Expansion->getPattern();
6152 IsPackExpansion =
true;
6154 NewType = getDerived().TransformType(OldType);
6156 NewType = getDerived().TransformType(OldType);
6162 if (IsPackExpansion)
6163 NewType = getSema().Context.getPackExpansionType(NewType,
6167 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6168 OutParamTypes.push_back(NewType);
6170 PVars->push_back(
nullptr);
6175 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6177 assert(parm->getFunctionScopeIndex() == i);
6184template<
typename Derived>
6189 return getDerived().TransformFunctionProtoType(
6192 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6193 ExceptionStorage, Changed);
6197template<
typename Derived>
template<
typename Fn>
6200 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6217 if (getDerived().TransformFunctionTypeParams(
6221 ParamTypes, &ParamDecls, ExtParamInfos))
6233 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6235 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6241 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6245 if (getDerived().TransformFunctionTypeParams(
6249 ParamTypes, &ParamDecls, ExtParamInfos))
6255 bool EPIChanged =
false;
6260 if (
auto NewExtParamInfos =
6276 std::optional<FunctionEffectSet> NewFX;
6285 ExprResult NewExpr = getDerived().TransformExpr(CondExpr);
6288 std::optional<FunctionEffectMode> Mode =
6308 "FunctionEffectMode::None shouldn't be possible here");
6314 NewFX->insert(NewEC, Errs);
6315 assert(Errs.empty());
6323 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6325 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6336 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6342template<
typename Derived>
6352 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6354 SemaRef, Method ? Method->getParent() :
nullptr,
6355 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6365 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6388 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6393 bool Expand =
false;
6394 bool RetainExpansion =
false;
6395 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6398 if (getDerived().TryExpandParameterPacks(
6400 RetainExpansion, NumExpansions))
6408 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6413 Exceptions.push_back(
U);
6419 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6422 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6426 Exceptions.push_back(
U);
6435 Exceptions.push_back(
U);
6445template<
typename Derived>
6455 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6456 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6467template <
typename Derived>
6468QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6469 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6470 const UnresolvedUsingType *
T = TL.getTypePtr();
6471 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6475 QualType
Result = TL.getType();
6476 if (getDerived().AlwaysRebuild() ||
D !=
T->getDecl()) {
6477 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(),
D);
6484 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6485 NewTL.setNameLoc(TL.getNameLoc());
6490template <
typename Derived>
6491QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6493 const UsingType *
T = TL.getTypePtr();
6495 auto *
Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6496 TL.getLocalSourceRange().getBegin(),
T->getFoundDecl()));
6500 QualType Underlying = getDerived().TransformType(
T->
desugar());
6501 if (Underlying.isNull())
6504 QualType
Result = TL.getType();
6505 if (getDerived().AlwaysRebuild() ||
Found !=
T->getFoundDecl() ||
6506 Underlying !=
T->getUnderlyingType()) {
6507 Result = getDerived().RebuildUsingType(
Found, Underlying);
6512 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6516template<
typename Derived>
6517QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6518 TypedefTypeLoc TL) {
6519 const TypedefType *
T = TL.getTypePtr();
6520 TypedefNameDecl *Typedef
6521 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6526 QualType
Result = TL.getType();
6527 if (getDerived().AlwaysRebuild() ||
6528 Typedef !=
T->getDecl()) {
6529 Result = getDerived().RebuildTypedefType(Typedef);
6534 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6535 NewTL.setNameLoc(TL.getNameLoc());
6540template<
typename Derived>
6541QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6542 TypeOfExprTypeLoc TL) {
6548 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6556 QualType
Result = TL.getType();
6558 if (getDerived().AlwaysRebuild() ||
E.get() != TL.getUnderlyingExpr()) {
6560 getDerived().RebuildTypeOfExprType(
E.get(), TL.getTypeofLoc(), Kind);
6565 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6566 NewTL.setTypeofLoc(TL.getTypeofLoc());
6567 NewTL.setLParenLoc(TL.getLParenLoc());
6568 NewTL.setRParenLoc(TL.getRParenLoc());
6573template<
typename Derived>
6574QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6576 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6577 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6581 QualType
Result = TL.getType();
6583 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6584 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6589 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6590 NewTL.setTypeofLoc(TL.getTypeofLoc());
6591 NewTL.setLParenLoc(TL.getLParenLoc());
6592 NewTL.setRParenLoc(TL.getRParenLoc());
6593 NewTL.setUnmodifiedTInfo(New_Under_TI);
6598template<
typename Derived>
6599QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6600 DecltypeTypeLoc TL) {
6601 const DecltypeType *
T = TL.getTypePtr();
6608 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6612 E = getSema().ActOnDecltypeExpression(
E.get());
6616 QualType
Result = TL.getType();
6617 if (getDerived().AlwaysRebuild() ||
6618 E.get() !=
T->getUnderlyingExpr()) {
6619 Result = getDerived().RebuildDecltypeType(
E.get(), TL.getDecltypeLoc());
6625 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6626 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6627 NewTL.setRParenLoc(TL.getRParenLoc());
6631template <
typename Derived>
6633TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6634 PackIndexingTypeLoc TL) {
6636 ExprResult IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6637 if (IndexExpr.isInvalid())
6639 QualType Pattern = TL.getPattern();
6641 const PackIndexingType *PIT = TL.getTypePtr();
6645 bool NotYetExpanded = Types.empty();
6646 bool FullySubstituted =
true;
6651 for (
const QualType &
T : Types) {
6653 QualType Transformed = getDerived().TransformType(
T);
6654 if (Transformed.isNull())
6656 SubtitutedTypes.push_back(Transformed);
6661 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
6662 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6665 bool ShouldExpand =
true;
6666 bool RetainExpansion =
false;
6667 std::optional<unsigned> OrigNumExpansions;
6668 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6669 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6670 Unexpanded, ShouldExpand,
6671 RetainExpansion, NumExpansions))
6673 if (!ShouldExpand) {
6674 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6677 TypeSourceInfo *TI =
6679 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6682 if (NotYetExpanded) {
6683 FullySubstituted =
false;
6684 QualType Out = getDerived().RebuildPackIndexingType(
6685 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6690 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6691 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6694 SubtitutedTypes.push_back(Pack);
6697 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6698 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6699 QualType Out = getDerived().TransformType(
T);
6702 SubtitutedTypes.push_back(Out);
6706 if (RetainExpansion) {
6707 FullySubstituted =
false;
6708 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6709 QualType Out = getDerived().TransformType(
T);
6712 SubtitutedTypes.push_back(Out);
6719 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6720 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6722 QualType Out = getDerived().RebuildPackIndexingType(
6723 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6724 FullySubstituted, SubtitutedTypes);
6728 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6729 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6733template<
typename Derived>
6734QualType TreeTransform<Derived>::TransformUnaryTransformType(
6735 TypeLocBuilder &TLB,
6736 UnaryTransformTypeLoc TL) {
6737 QualType
Result = TL.getType();
6738 if (
Result->isDependentType()) {
6739 const UnaryTransformType *
T = TL.getTypePtr();
6741 TypeSourceInfo *NewBaseTSI =
6742 getDerived().TransformType(TL.getUnderlyingTInfo());
6745 QualType NewBase = NewBaseTSI->getType();
6747 Result = getDerived().RebuildUnaryTransformType(NewBase,
6754 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6755 NewTL.setKWLoc(TL.getKWLoc());
6756 NewTL.setParensRange(TL.getParensRange());
6757 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6761template<
typename Derived>
6762QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6763 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6764 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
6767 TemplateName TemplateName = getDerived().TransformTemplateName(
6768 SS,
T->getTemplateName(), TL.getTemplateNameLoc());
6769 if (TemplateName.isNull())
6772 QualType OldDeduced =
T->getDeducedType();
6773 QualType NewDeduced;
6774 if (!OldDeduced.isNull()) {
6775 NewDeduced = getDerived().TransformType(OldDeduced);
6776 if (NewDeduced.isNull())
6780 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6781 TemplateName, NewDeduced);
6785 DeducedTemplateSpecializationTypeLoc NewTL =
6786 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6787 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6792template<
typename Derived>
6793QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6795 const RecordType *
T = TL.getTypePtr();
6797 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6802 QualType
Result = TL.getType();
6803 if (getDerived().AlwaysRebuild() ||
6810 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6811 NewTL.setNameLoc(TL.getNameLoc());
6816template<
typename Derived>
6817QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
6819 const EnumType *
T = TL.getTypePtr();
6821 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6826 QualType
Result = TL.getType();
6827 if (getDerived().AlwaysRebuild() ||
6828 Enum !=
T->getDecl()) {
6834 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
6835 NewTL.setNameLoc(TL.getNameLoc());
6840template<
typename Derived>
6841QualType TreeTransform<Derived>::TransformInjectedClassNameType(
6842 TypeLocBuilder &TLB,
6843 InjectedClassNameTypeLoc TL) {
6844 Decl *
D = getDerived().TransformDecl(TL.getNameLoc(),
6845 TL.getTypePtr()->getDecl());
6846 if (!
D)
return QualType();
6849 TLB.pushTypeSpec(
T).setNameLoc(TL.getNameLoc());
6853template<
typename Derived>
6857 return getDerived().TransformTemplateTypeParmType(
6862template <
typename Derived>
6868template<
typename Derived>
6869QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
6870 TypeLocBuilder &TLB,
6871 SubstTemplateTypeParmTypeLoc TL) {
6872 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
6875 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
6880 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
6881 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
6882 if (Replacement.isNull())
6886 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex());
6889 SubstTemplateTypeParmTypeLoc NewTL
6890 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
6891 NewTL.setNameLoc(TL.getNameLoc());
6896template<
typename Derived>
6900 return getDerived().TransformSubstTemplateTypeParmPackType(
6904template <
typename Derived>
6910template<
typename Derived>
6920 = getDerived().TransformTemplateName(SS,
T->getTemplateName(),
6925 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
6928template<
typename Derived>
6936 if (getDerived().AlwaysRebuild() ||
6938 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
6943 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
6951template <
typename Derived>
6952QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
6954 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
6955 if (ValueType.isNull())
6958 QualType
Result = TL.getType();
6959 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
6960 const PipeType *PT =
Result->castAs<PipeType>();
6961 bool isReadPipe = PT->isReadOnly();
6962 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
6967 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
6968 NewTL.setKWLoc(TL.getKWLoc());
6973template <
typename Derived>
6974QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
6976 const BitIntType *EIT = TL.getTypePtr();
6977 QualType
Result = TL.getType();
6979 if (getDerived().AlwaysRebuild()) {
6980 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
6981 EIT->getNumBits(), TL.getNameLoc());
6986 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
6987 NewTL.setNameLoc(TL.getNameLoc());
6991template <
typename Derived>
6992QualType TreeTransform<Derived>::TransformDependentBitIntType(
6993 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
6994 const DependentBitIntType *EIT = TL.getTypePtr();
6998 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7001 if (BitsExpr.isInvalid())
7004 QualType
Result = TL.getType();
7006 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7007 Result = getDerived().RebuildDependentBitIntType(
7008 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7014 if (isa<DependentBitIntType>(
Result)) {
7015 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
7016 NewTL.setNameLoc(TL.getNameLoc());
7018 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
7019 NewTL.setNameLoc(TL.getNameLoc());
7029 template<
typename ArgLocContainer>
7031 ArgLocContainer *Container;
7056 : Container(&Container), Index(Index) { }
7070 return Container->getArgLoc(Index);
7074 return pointer(Container->getArgLoc(Index));
7079 return X.Container == Y.Container &&
X.Index == Y.Index;
7088template<
typename Derived>
7089QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7091 const AutoType *
T = TL.getTypePtr();
7092 QualType OldDeduced =
T->getDeducedType();
7093 QualType NewDeduced;
7094 if (!OldDeduced.isNull()) {
7095 NewDeduced = getDerived().TransformType(OldDeduced);
7096 if (NewDeduced.isNull())
7100 ConceptDecl *NewCD =
nullptr;
7101 TemplateArgumentListInfo NewTemplateArgs;
7102 NestedNameSpecifierLoc NewNestedNameSpec;
7103 if (
T->isConstrained()) {
7104 assert(TL.getConceptReference());
7105 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7106 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7108 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7109 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7110 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7111 if (getDerived().TransformTemplateArguments(
7112 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7116 if (TL.getNestedNameSpecifierLoc()) {
7118 = getDerived().TransformNestedNameSpecifierLoc(
7119 TL.getNestedNameSpecifierLoc());
7120 if (!NewNestedNameSpec)
7125 QualType
Result = TL.getType();
7126 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7130 NewArgList.reserve(NewTemplateArgs.size());
7131 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7132 NewArgList.push_back(ArgLoc.getArgument());
7133 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7139 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7140 NewTL.setNameLoc(TL.getNameLoc());
7141 NewTL.setRParenLoc(TL.getRParenLoc());
7142 NewTL.setConceptReference(
nullptr);
7144 if (
T->isConstrained()) {
7145 DeclarationNameInfo DNI = DeclarationNameInfo(
7146 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7147 TL.getConceptNameLoc(),
7148 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7150 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7151 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7153 NewTL.setConceptReference(CR);
7159template <
typename Derived>
7161 TypeLocBuilder &TLB,
7162 TemplateSpecializationTypeLoc TL,
7163 TemplateName Template) {
7164 TemplateArgumentListInfo NewTemplateArgs;
7165 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7166 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7167 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7169 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7170 ArgIterator(TL, TL.getNumArgs()),
7177 getDerived().RebuildTemplateSpecializationType(Template,
7178 TL.getTemplateNameLoc(),
7186 if (isa<DependentTemplateSpecializationType>(
Result)) {
7187 DependentTemplateSpecializationTypeLoc NewTL
7188 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7189 NewTL.setElaboratedKeywordLoc(SourceLocation());
7190 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7191 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7192 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7193 NewTL.setLAngleLoc(TL.getLAngleLoc());
7194 NewTL.setRAngleLoc(TL.getRAngleLoc());
7195 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7196 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7200 TemplateSpecializationTypeLoc NewTL
7201 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7202 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7203 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7204 NewTL.setLAngleLoc(TL.getLAngleLoc());
7205 NewTL.setRAngleLoc(TL.getRAngleLoc());
7206 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7207 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7213template <
typename Derived>
7224 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7232 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7234 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7244 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7250 = getDerived().RebuildTemplateSpecializationType(Template,
7262 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7269template<
typename Derived>
7284 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7285 if (NamedT.isNull())
7294 if (
const TemplateSpecializationType *TST =
7295 NamedT->getAs<TemplateSpecializationType>()) {
7296 TemplateName Template = TST->getTemplateName();
7297 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7298 Template.getAsTemplateDecl())) {
7300 diag::err_tag_reference_non_tag)
7302 << llvm::to_underlying(
7304 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7310 if (getDerived().AlwaysRebuild() ||
7312 NamedT !=
T->getNamedType()) {
7315 QualifierLoc, NamedT);
7320 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7322 NewTL.setQualifierLoc(QualifierLoc);
7326template <
typename Derived>
7327template <
typename Fn>
7332 if (modifiedType.
isNull())
7337 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7338 if (oldAttr && !newAttr)
7344 if (getDerived().AlwaysRebuild() ||
7350 if (equivalentType.
isNull())
7359 diag::err_nullability_nonpointer)
7375template <
typename Derived>
7378 return getDerived().TransformAttributedType(
7380 return getDerived().TransformType(TLB, ModifiedLoc);
7384template <
typename Derived>
7393 Expr *NewCount =
nullptr;
7395 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7398 NewCount = CountResult.
get();
7402 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->
desugar() ||
7403 OldCount != NewCount) {
7413template <
typename Derived>
7414QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7415 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7417 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7420template<
typename Derived>
7422TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7424 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7428 QualType
Result = TL.getType();
7429 if (getDerived().AlwaysRebuild() ||
7430 Inner != TL.getInnerLoc().getType()) {
7431 Result = getDerived().RebuildParenType(Inner);
7436 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7437 NewTL.setLParenLoc(TL.getLParenLoc());
7438 NewTL.setRParenLoc(TL.getRParenLoc());
7442template <
typename Derived>
7444TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7445 MacroQualifiedTypeLoc TL) {
7446 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7450 QualType
Result = TL.getType();
7451 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7453 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7458 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7459 NewTL.setExpansionLoc(TL.getExpansionLoc());
7463template<
typename Derived>
7464QualType TreeTransform<Derived>::TransformDependentNameType(
7465 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7466 return TransformDependentNameType(TLB, TL,
false);
7469template<
typename Derived>
7470QualType TreeTransform<Derived>::TransformDependentNameType(
7471 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7472 const DependentNameType *
T = TL.getTypePtr();
7474 NestedNameSpecifierLoc QualifierLoc
7475 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7480 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7481 TL.getElaboratedKeywordLoc(),
7489 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7490 QualType NamedT = ElabT->getNamedType();
7491 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7493 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7494 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7495 NewTL.setQualifierLoc(QualifierLoc);
7497 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7498 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7499 NewTL.setQualifierLoc(QualifierLoc);
7500 NewTL.setNameLoc(TL.getNameLoc());
7505template<
typename Derived>
7508 DependentTemplateSpecializationTypeLoc TL) {
7509 NestedNameSpecifierLoc QualifierLoc;
7510 if (TL.getQualifierLoc()) {
7512 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7518 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7521template<
typename Derived>
7534 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7539 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7547 QualType NamedT = ElabT->getNamedType();
7556 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7563 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7572 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7581 for (
unsigned I = 0,
E = NewTemplateArgs.
size(); I !=
E; ++I)
7587template<
typename Derived>
7596 if (getDerived().AlwaysRebuild() ||
7598 Result = getDerived().RebuildPackExpansionType(Pattern,
7606 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7611template<
typename Derived>
7613TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7614 ObjCInterfaceTypeLoc TL) {
7616 TLB.pushFullCopy(TL);
7617 return TL.getType();
7620template<
typename Derived>
7622TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7623 ObjCTypeParamTypeLoc TL) {
7624 const ObjCTypeParamType *
T = TL.getTypePtr();
7625 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7626 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7630 QualType
Result = TL.getType();
7631 if (getDerived().AlwaysRebuild() ||
7632 OTP !=
T->getDecl()) {
7633 Result = getDerived().RebuildObjCTypeParamType(
7634 OTP, TL.getProtocolLAngleLoc(),
7635 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7636 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7641 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7642 if (TL.getNumProtocols()) {
7643 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7644 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7645 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7646 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7651template<
typename Derived>
7653TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7654 ObjCObjectTypeLoc TL) {
7656 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7657 if (BaseType.isNull())
7660 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7664 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7665 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7666 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7667 QualType TypeArg = TypeArgInfo->getType();
7668 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7672 const auto *PackExpansion = PackExpansionLoc.getType()
7673 ->castAs<PackExpansionType>();
7677 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7681 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7682 bool Expand =
false;
7683 bool RetainExpansion =
false;
7684 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7685 if (getDerived().TryExpandParameterPacks(
7686 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7687 Unexpanded, Expand, RetainExpansion, NumExpansions))
7694 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7696 TypeLocBuilder TypeArgBuilder;
7697 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7698 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7700 if (NewPatternType.isNull())
7704 NewPatternType, NumExpansions);
7705 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7706 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7707 NewTypeArgInfos.push_back(
7708 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7714 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7715 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7717 TypeLocBuilder TypeArgBuilder;
7718 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7720 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7722 if (NewTypeArg.isNull())
7725 NewTypeArgInfos.push_back(
7726 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7732 TypeLocBuilder TypeArgBuilder;
7733 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7734 QualType NewTypeArg =
7735 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7736 if (NewTypeArg.isNull())
7740 if (NewTypeArg == TypeArg) {
7741 NewTypeArgInfos.push_back(TypeArgInfo);
7745 NewTypeArgInfos.push_back(
7746 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7750 QualType
Result = TL.getType();
7751 if (getDerived().AlwaysRebuild() || AnyChanged) {
7753 Result = getDerived().RebuildObjCObjectType(
7754 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7755 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7756 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7757 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7763 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7764 NewT.setHasBaseTypeAsWritten(
true);
7765 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7766 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7767 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7768 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7769 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7770 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7771 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7772 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7776template<
typename Derived>
7778TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
7779 ObjCObjectPointerTypeLoc TL) {
7780 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7781 if (PointeeType.isNull())
7784 QualType
Result = TL.getType();
7785 if (getDerived().AlwaysRebuild() ||
7786 PointeeType != TL.getPointeeLoc().getType()) {
7787 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
7793 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
7794 NewT.setStarLoc(TL.getStarLoc());
7801template<
typename Derived>
7803TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
7807template<
typename Derived>
7810 return getDerived().TransformCompoundStmt(S,
false);
7813template<
typename Derived>
7819 if (S->hasStoredFPFeatures())
7820 getSema().resetFPOptions(
7821 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
7824 bool SubStmtInvalid =
false;
7825 bool SubStmtChanged =
false;
7827 for (
auto *B : S->body()) {
7829 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
7831 if (
Result.isInvalid()) {
7834 if (isa<DeclStmt>(B))
7838 SubStmtInvalid =
true;
7842 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
7843 Statements.push_back(
Result.getAs<Stmt>());
7849 if (!getDerived().AlwaysRebuild() &&
7853 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
7859template<
typename Derived>
7861TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
7868 LHS = getDerived().TransformExpr(S->getLHS());
7870 if (LHS.isInvalid())
7874 RHS = getDerived().TransformExpr(S->getRHS());
7876 if (RHS.isInvalid())
7883 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
7885 S->getEllipsisLoc(),
7888 if (Case.isInvalid())
7893 getDerived().TransformStmt(S->getSubStmt());
7894 if (SubStmt.isInvalid())
7898 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
7901template <
typename Derived>
7902StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
7905 getDerived().TransformStmt(S->getSubStmt());
7906 if (SubStmt.isInvalid())
7910 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
7914template<
typename Derived>
7916TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
7917 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7918 if (SubStmt.isInvalid())
7921 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
7929 if (LD == S->getDecl())
7930 S->getDecl()->setStmt(
nullptr);
7933 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
7934 cast<LabelDecl>(LD), SourceLocation(),
7938template <
typename Derived>
7947 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
7948#include "clang/Basic/AttrList.inc"
7953template <
typename Derived>
7964 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
7965#include "clang/Basic/AttrList.inc"
7967 return TransformAttr(R);
7970template <
typename Derived>
7973 StmtDiscardKind SDK) {
7974 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7978 bool AttrsChanged =
false;
7982 for (
const auto *I : S->getAttrs()) {
7984 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
7985 AttrsChanged |= (I != R);
7990 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
7998 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8002template<
typename Derived>
8004TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
8007 if (
Init.isInvalid())
8010 Sema::ConditionResult Cond;
8011 if (!S->isConsteval()) {
8013 Cond = getDerived().TransformCondition(
8014 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8017 if (Cond.isInvalid())
8022 std::optional<bool> ConstexprConditionValue;
8023 if (S->isConstexpr())
8024 ConstexprConditionValue = Cond.getKnownValue();
8028 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8029 EnterExpressionEvaluationContext Ctx(
8032 S->isNonNegatedConsteval());
8034 Then = getDerived().TransformStmt(S->getThen());
8035 if (Then.isInvalid())
8041 Then =
new (getSema().Context)
8042 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8047 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8048 EnterExpressionEvaluationContext Ctx(
8051 S->isNegatedConsteval());
8053 Else = getDerived().TransformStmt(S->getElse());
8054 if (Else.isInvalid())
8056 }
else if (S->getElse() && ConstexprConditionValue &&
8057 *ConstexprConditionValue) {
8061 Else =
new (getSema().Context)
8062 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8065 if (!getDerived().AlwaysRebuild() &&
8066 Init.get() == S->getInit() &&
8067 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8068 Then.get() == S->getThen() &&
8069 Else.get() == S->getElse())
8072 return getDerived().RebuildIfStmt(
8073 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8074 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8077template<
typename Derived>
8079TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8082 if (
Init.isInvalid())
8086 Sema::ConditionResult Cond = getDerived().TransformCondition(
8087 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8089 if (Cond.isInvalid())
8094 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8095 Init.get(), Cond, S->getRParenLoc());
8100 StmtResult Body = getDerived().TransformStmt(S->getBody());
8101 if (Body.isInvalid())
8105 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8109template<
typename Derived>
8111TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8113 Sema::ConditionResult Cond = getDerived().TransformCondition(
8114 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8116 if (Cond.isInvalid())
8120 StmtResult Body = getDerived().TransformStmt(S->getBody());
8121 if (Body.isInvalid())
8124 if (!getDerived().AlwaysRebuild() &&
8125 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8126 Body.get() == S->getBody())
8129 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8130 Cond, S->getRParenLoc(), Body.get());
8133template<
typename Derived>
8135TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8137 StmtResult Body = getDerived().TransformStmt(S->getBody());
8138 if (Body.isInvalid())
8142 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8143 if (Cond.isInvalid())
8146 if (!getDerived().AlwaysRebuild() &&
8147 Cond.get() == S->getCond() &&
8148 Body.get() == S->getBody())
8151 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8152 S->getWhileLoc(), Cond.get(),
8156template<
typename Derived>
8158TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8159 if (getSema().getLangOpts().OpenMP)
8160 getSema().OpenMP().startOpenMPLoop();
8164 if (
Init.isInvalid())
8169 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8170 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8174 Sema::ConditionResult Cond = getDerived().TransformCondition(
8175 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8177 if (Cond.isInvalid())
8182 if (
Inc.isInvalid())
8185 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8186 if (S->getInc() && !FullInc.get())
8190 StmtResult Body = getDerived().TransformStmt(S->getBody());
8191 if (Body.isInvalid())
8194 if (!getDerived().AlwaysRebuild() &&
8195 Init.get() == S->getInit() &&
8196 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8197 Inc.get() == S->getInc() &&
8198 Body.get() == S->getBody())
8201 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8202 Init.get(), Cond, FullInc,
8203 S->getRParenLoc(), Body.get());
8206template<
typename Derived>
8208TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8209 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8215 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8216 cast<LabelDecl>(LD));
8219template<
typename Derived>
8221TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8227 if (!getDerived().AlwaysRebuild() &&
8228 Target.get() == S->getTarget())
8231 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8235template<
typename Derived>
8237TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8241template<
typename Derived>
8243TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8247template<
typename Derived>
8249TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8257 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8260template<
typename Derived>
8262TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8263 bool DeclChanged =
false;
8265 for (
auto *
D : S->decls()) {
8270 if (Transformed !=
D)
8273 Decls.push_back(Transformed);
8276 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8279 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8282template<
typename Derived>
8284TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8293 bool ExprsChanged =
false;
8296 for (
unsigned I = 0,
E = S->getNumOutputs(); I !=
E; ++I) {
8297 Names.push_back(S->getOutputIdentifier(I));
8300 Constraints.push_back(S->getOutputConstraintLiteral(I));
8303 Expr *OutputExpr = S->getOutputExpr(I);
8308 ExprsChanged |=
Result.get() != OutputExpr;
8310 Exprs.push_back(
Result.get());
8314 for (
unsigned I = 0,
E = S->getNumInputs(); I !=
E; ++I) {
8315 Names.push_back(S->getInputIdentifier(I));
8318 Constraints.push_back(S->getInputConstraintLiteral(I));
8321 Expr *InputExpr = S->getInputExpr(I);
8326 ExprsChanged |=
Result.get() != InputExpr;
8328 Exprs.push_back(
Result.get());
8332 for (
unsigned I = 0,
E = S->getNumLabels(); I !=
E; ++I) {
8333 Names.push_back(S->getLabelIdentifier(I));
8338 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8339 Exprs.push_back(
Result.get());
8341 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8345 for (
unsigned I = 0,
E = S->getNumClobbers(); I !=
E; ++I)
8346 Clobbers.push_back(S->getClobberStringLiteral(I));
8349 AsmString = S->getAsmString();
8350 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8351 S->isVolatile(), S->getNumOutputs(),
8352 S->getNumInputs(), Names.data(),
8353 Constraints, Exprs, AsmString.get(),
8354 Clobbers, S->getNumLabels(),
8358template<
typename Derived>
8360TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8363 bool HadError =
false, HadChange =
false;
8367 TransformedExprs.reserve(SrcExprs.size());
8368 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8370 if (!
Result.isUsable()) {
8373 HadChange |= (
Result.get() != SrcExprs[i]);
8374 TransformedExprs.push_back(
Result.get());
8379 if (!HadChange && !getDerived().AlwaysRebuild())
8382 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8383 AsmToks, S->getAsmString(),
8384 S->getNumOutputs(), S->getNumInputs(),
8385 S->getAllConstraints(), S->getClobbers(),
8386 TransformedExprs, S->getEndLoc());
8390template<
typename Derived>
8392TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8394 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8395 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8396 ScopeInfo->NeedsCoroutineSuspends &&
8397 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8398 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8399 "expected clean scope info");
8403 ScopeInfo->setNeedsCoroutineSuspends(
false);
8416 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8417 ScopeInfo->CoroutinePromise = Promise;
8422 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8423 if (InitSuspend.isInvalid())
8426 getDerived().TransformStmt(S->getFinalSuspendStmt());
8427 if (FinalSuspend.isInvalid() ||
8430 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8431 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8433 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8434 if (BodyRes.isInvalid())
8437 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8438 if (Builder.isInvalid())
8441 Expr *ReturnObject = S->getReturnValueInit();
8442 assert(ReturnObject &&
"the return object is expected to be valid");
8443 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8445 if (Res.isInvalid())
8447 Builder.ReturnValue = Res.get();
8452 if (S->hasDependentPromiseType()) {
8455 if (!Promise->getType()->isDependentType()) {
8456 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8457 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8458 "these nodes should not have been built yet");
8459 if (!Builder.buildDependentStatements())
8463 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8464 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8465 if (Res.isInvalid())
8467 Builder.OnFallthrough = Res.get();
8470 if (
auto *OnException = S->getExceptionHandler()) {
8471 StmtResult Res = getDerived().TransformStmt(OnException);
8472 if (Res.isInvalid())
8474 Builder.OnException = Res.get();
8477 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8478 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8479 if (Res.isInvalid())
8481 Builder.ReturnStmtOnAllocFailure = Res.get();
8485 assert(S->getAllocate() && S->getDeallocate() &&
8486 "allocation and deallocation calls must already be built");
8487 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8488 if (AllocRes.isInvalid())
8490 Builder.Allocate = AllocRes.get();
8492 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8493 if (DeallocRes.isInvalid())
8495 Builder.Deallocate = DeallocRes.get();
8497 if (
auto *ResultDecl = S->getResultDecl()) {
8498 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8499 if (Res.isInvalid())
8501 Builder.ResultDecl = Res.get();
8504 if (
auto *ReturnStmt = S->getReturnStmt()) {
8505 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8506 if (Res.isInvalid())
8508 Builder.ReturnStmt = Res.get();
8512 return getDerived().RebuildCoroutineBodyStmt(Builder);
8515template<
typename Derived>
8517TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8525 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8529template <
typename Derived>
8530ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *
E) {
8542 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8543 getSema().getCurScope(),
E->getKeywordLoc());
8547 return getDerived().RebuildCoawaitExpr(
8549 cast<UnresolvedLookupExpr>(Lookup.get()),
E->isImplicit());
8552template <
typename Derived>
8554TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *
E) {
8555 ExprResult OperandResult = getDerived().TransformInitializer(
E->getOperand(),
8557 if (OperandResult.isInvalid())
8560 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8561 E->getOperatorCoawaitLookup());
8563 if (LookupResult.isInvalid())
8568 return getDerived().RebuildDependentCoawaitExpr(
8569 E->getKeywordLoc(), OperandResult.get(),
8570 cast<UnresolvedLookupExpr>(LookupResult.get()));
8573template<
typename Derived>
8575TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *
E) {
8583 return getDerived().RebuildCoyieldExpr(
E->getKeywordLoc(),
Result.get());
8588template<
typename Derived>
8590TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8592 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8593 if (TryBody.isInvalid())
8597 bool AnyCatchChanged =
false;
8599 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8600 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8601 if (Catch.isInvalid())
8603 if (Catch.get() != S->getCatchStmt(I))
8604 AnyCatchChanged =
true;
8605 CatchStmts.push_back(Catch.get());
8610 if (S->getFinallyStmt()) {
8611 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8612 if (Finally.isInvalid())
8617 if (!getDerived().AlwaysRebuild() &&
8618 TryBody.get() == S->getTryBody() &&
8620 Finally.get() == S->getFinallyStmt())
8624 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8625 CatchStmts, Finally.get());
8628template<
typename Derived>
8630TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8632 VarDecl *Var =
nullptr;
8633 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8634 TypeSourceInfo *TSInfo =
nullptr;
8635 if (FromVar->getTypeSourceInfo()) {
8636 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8643 T = TSInfo->getType();
8645 T = getDerived().TransformType(FromVar->getType());
8650 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8655 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8656 if (Body.isInvalid())
8659 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8664template<
typename Derived>
8666TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8668 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8669 if (Body.isInvalid())
8673 if (!getDerived().AlwaysRebuild() &&
8674 Body.get() == S->getFinallyBody())
8678 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8682template<
typename Derived>
8684TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8686 if (S->getThrowExpr()) {
8687 Operand = getDerived().TransformExpr(S->getThrowExpr());
8692 if (!getDerived().AlwaysRebuild() &&
8693 Operand.get() == S->getThrowExpr())
8696 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8699template<
typename Derived>
8701TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8702 ObjCAtSynchronizedStmt *S) {
8708 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8714 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8715 if (Body.isInvalid())
8719 if (!getDerived().AlwaysRebuild() &&
8720 Object.get() == S->getSynchExpr() &&
8721 Body.get() == S->getSynchBody())
8725 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8726 Object.get(), Body.get());
8729template<
typename Derived>
8731TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8732 ObjCAutoreleasePoolStmt *S) {
8734 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8735 if (Body.isInvalid())
8739 if (!getDerived().AlwaysRebuild() &&
8740 Body.get() == S->getSubStmt())
8744 return getDerived().RebuildObjCAutoreleasePoolStmt(
8745 S->getAtLoc(), Body.get());
8748template<
typename Derived>
8750TreeTransform<Derived>::TransformObjCForCollectionStmt(
8751 ObjCForCollectionStmt *S) {
8754 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
8755 if (Element.isInvalid())
8759 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
8760 if (Collection.isInvalid())
8764 StmtResult Body = getDerived().TransformStmt(S->getBody());
8765 if (Body.isInvalid())
8769 if (!getDerived().AlwaysRebuild() &&
8770 Element.get() == S->getElement() &&
8771 Collection.get() == S->getCollection() &&
8772 Body.get() == S->getBody())
8776 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
8783template <
typename Derived>
8784StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
8786 VarDecl *Var =
nullptr;
8787 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
8789 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
8793 Var = getDerived().RebuildExceptionDecl(
8794 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
8795 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
8796 if (!Var || Var->isInvalidDecl())
8801 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
8802 if (Handler.isInvalid())
8805 if (!getDerived().AlwaysRebuild() && !Var &&
8806 Handler.get() == S->getHandlerBlock())
8809 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
8812template <
typename Derived>
8813StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
8815 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
8816 if (TryBlock.isInvalid())
8820 bool HandlerChanged =
false;
8822 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
8823 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
8824 if (Handler.isInvalid())
8827 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
8828 Handlers.push_back(Handler.getAs<Stmt>());
8831 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
8835 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
8839template<
typename Derived>
8841TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
8842 EnterExpressionEvaluationContext ForRangeInitContext(
8850 auto &LastRecord = getSema().ExprEvalContexts.back();
8851 LastRecord.InLifetimeExtendingContext =
true;
8854 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
8855 if (
Init.isInvalid())
8864 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
8865 auto ForRangeLifetimeExtendTemps =
8866 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
8871 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
8872 if (End.isInvalid())
8875 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8876 if (Cond.isInvalid())
8880 if (Cond.isInvalid())
8886 if (
Inc.isInvalid())
8891 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
8892 if (LoopVar.isInvalid())
8896 if (getDerived().AlwaysRebuild() ||
8897 Init.get() != S->getInit() ||
8898 Range.get() != S->getRangeStmt() ||
8899 Begin.get() != S->getBeginStmt() ||
8900 End.get() != S->getEndStmt() ||
8901 Cond.get() != S->getCond() ||
8902 Inc.get() != S->getInc() ||
8903 LoopVar.get() != S->getLoopVarStmt()) {
8904 NewStmt = getDerived().RebuildCXXForRangeStmt(
8905 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8907 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8908 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
8911 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
8916 StmtResult Body = getDerived().TransformStmt(S->getBody());
8917 if (Body.isInvalid())
8922 if (Body.get() != S->getBody() && NewStmt.get() == S) {
8923 NewStmt = getDerived().RebuildCXXForRangeStmt(
8924 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8926 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8927 if (NewStmt.isInvalid())
8931 if (NewStmt.get() == S)
8934 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
8937template<
typename Derived>
8939TreeTransform<Derived>::TransformMSDependentExistsStmt(
8940 MSDependentExistsStmt *S) {
8942 NestedNameSpecifierLoc QualifierLoc;
8943 if (S->getQualifierLoc()) {
8945 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
8951 DeclarationNameInfo NameInfo = S->getNameInfo();
8952 if (NameInfo.getName()) {
8953 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
8954 if (!NameInfo.getName())
8959 if (!getDerived().AlwaysRebuild() &&
8960 QualifierLoc == S->getQualifierLoc() &&
8961 NameInfo.getName() == S->getNameInfo().getName())
8966 SS.Adopt(QualifierLoc);
8968 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
8970 if (S->isIfExists())
8973 return new (getSema().Context) NullStmt(S->getKeywordLoc());
8976 if (S->isIfNotExists())
8979 return new (getSema().Context) NullStmt(S->getKeywordLoc());
8990 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
8991 if (SubStmt.isInvalid())
8999 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9006template<
typename Derived>
9008TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *
E) {
9009 NestedNameSpecifierLoc QualifierLoc;
9010 if (
E->getQualifierLoc()) {
9012 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
9017 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
9018 getDerived().TransformDecl(
E->getMemberLoc(),
E->getPropertyDecl()));
9023 if (
Base.isInvalid())
9027 MSPropertyRefExpr(
Base.get(), PD,
E->isArrow(),
9029 QualifierLoc,
E->getMemberLoc());
9032template <
typename Derived>
9033ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
9034 MSPropertySubscriptExpr *
E) {
9035 auto BaseRes = getDerived().TransformExpr(
E->getBase());
9036 if (BaseRes.isInvalid())
9038 auto IdxRes = getDerived().TransformExpr(
E->getIdx());
9039 if (IdxRes.isInvalid())
9042 if (!getDerived().AlwaysRebuild() &&
9043 BaseRes.get() ==
E->getBase() &&
9044 IdxRes.get() ==
E->getIdx())
9047 return getDerived().RebuildArraySubscriptExpr(
9048 BaseRes.get(), SourceLocation(), IdxRes.get(),
E->getRBracketLoc());
9051template <
typename Derived>
9052StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
9053 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9054 if (TryBlock.isInvalid())
9057 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9058 if (Handler.isInvalid())
9061 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9062 Handler.get() == S->getHandler())
9065 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9066 TryBlock.get(), Handler.get());
9069template <
typename Derived>
9070StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9072 if (
Block.isInvalid())
9075 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9078template <
typename Derived>
9079StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9080 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9081 if (FilterExpr.isInvalid())
9085 if (
Block.isInvalid())
9088 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9092template <
typename Derived>
9094 if (isa<SEHFinallyStmt>(Handler))
9095 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9097 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9100template<
typename Derived>
9110template <
typename Derived>
9112TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9116 return getDerived().TransformStmt(L->getLoopStmt());
9119template <
typename Derived>
9126 TClauses.reserve(Clauses.size());
9130 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9131 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9132 getDerived().getSema().OpenMP().EndOpenMPClause();
9134 TClauses.push_back(Clause);
9136 TClauses.push_back(
nullptr);
9140 if (
D->hasAssociatedStmt() &&
D->getAssociatedStmt()) {
9141 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9142 D->getDirectiveKind(),
9148 if (
D->getDirectiveKind() == OMPD_atomic ||
9149 D->getDirectiveKind() == OMPD_critical ||
9150 D->getDirectiveKind() == OMPD_section ||
9151 D->getDirectiveKind() == OMPD_master)
9152 CS =
D->getAssociatedStmt();
9154 CS =
D->getRawStmt();
9155 Body = getDerived().TransformStmt(CS);
9157 getSema().getLangOpts().OpenMPIRBuilder)
9158 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9161 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9166 if (TClauses.size() != Clauses.size()) {
9172 if (
D->getDirectiveKind() == OMPD_critical) {
9173 DirName = cast<OMPCriticalDirective>(
D)->getDirectiveName();
9174 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9177 if (
D->getDirectiveKind() == OMPD_cancellation_point) {
9178 CancelRegion = cast<OMPCancellationPointDirective>(
D)->getCancelRegion();
9179 }
else if (
D->getDirectiveKind() == OMPD_cancel) {
9180 CancelRegion = cast<OMPCancelDirective>(
D)->getCancelRegion();
9183 return getDerived().RebuildOMPExecutableDirective(
9184 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9188template <
typename Derived>
9193 << getOpenMPDirectiveName(
D->getDirectiveKind());
9197template <
typename Derived>
9199TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *
D) {
9200 DeclarationNameInfo DirName;
9201 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9203 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9204 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9208template <
typename Derived>
9210TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *
D) {
9211 DeclarationNameInfo DirName;
9212 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9214 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9215 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9219template <
typename Derived>
9221TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *
D) {
9222 DeclarationNameInfo DirName;
9223 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9225 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9226 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9230template <
typename Derived>
9232TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *
D) {
9233 DeclarationNameInfo DirName;
9234 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9236 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9237 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9241template <
typename Derived>
9243TreeTransform<Derived>::TransformOMPReverseDirective(OMPReverseDirective *
D) {
9244 DeclarationNameInfo DirName;
9245 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9247 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9248 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9252template <
typename Derived>
9253StmtResult TreeTransform<Derived>::TransformOMPInterchangeDirective(
9254 OMPInterchangeDirective *
D) {
9255 DeclarationNameInfo DirName;
9256 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9258 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9259 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9263template <
typename Derived>
9265TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *
D) {
9266 DeclarationNameInfo DirName;
9267 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9269 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9270 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9274template <
typename Derived>
9276TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *
D) {
9277 DeclarationNameInfo DirName;
9278 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9280 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9281 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9285template <
typename Derived>
9287TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *
D) {
9288 DeclarationNameInfo DirName;
9289 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9291 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9292 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9296template <
typename Derived>
9298TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *
D) {
9299 DeclarationNameInfo DirName;
9300 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9302 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9303 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9307template <
typename Derived>
9309TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *
D) {
9310 DeclarationNameInfo DirName;
9311 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9313 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9314 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9318template <
typename Derived>
9320TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *
D) {
9321 DeclarationNameInfo DirName;
9322 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9324 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9325 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9329template <
typename Derived>
9331TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *
D) {
9332 DeclarationNameInfo DirName;
9333 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9335 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9336 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9340template <
typename Derived>
9342TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *
D) {
9343 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9344 OMPD_critical,
D->getDirectiveName(),
nullptr,
D->
getBeginLoc());
9345 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9346 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9350template <
typename Derived>
9351StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9352 OMPParallelForDirective *
D) {
9353 DeclarationNameInfo DirName;
9354 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9355 OMPD_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9356 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9357 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9361template <
typename Derived>
9362StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9363 OMPParallelForSimdDirective *
D) {
9364 DeclarationNameInfo DirName;
9365 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9366 OMPD_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9367 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9368 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9372template <
typename Derived>
9373StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9374 OMPParallelMasterDirective *
D) {
9375 DeclarationNameInfo DirName;
9376 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9377 OMPD_parallel_master, DirName,
nullptr,
D->
getBeginLoc());
9378 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9379 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9383template <
typename Derived>
9384StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9385 OMPParallelMaskedDirective *
D) {
9386 DeclarationNameInfo DirName;
9387 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9388 OMPD_parallel_masked, DirName,
nullptr,
D->
getBeginLoc());
9389 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9390 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9394template <
typename Derived>
9395StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9396 OMPParallelSectionsDirective *
D) {
9397 DeclarationNameInfo DirName;
9398 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9399 OMPD_parallel_sections, DirName,
nullptr,
D->
getBeginLoc());
9400 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9401 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9405template <
typename Derived>
9407TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *
D) {
9408 DeclarationNameInfo DirName;
9409 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9411 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9412 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9416template <
typename Derived>
9417StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9418 OMPTaskyieldDirective *
D) {
9419 DeclarationNameInfo DirName;
9420 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9422 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9423 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9427template <
typename Derived>
9429TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *
D) {
9430 DeclarationNameInfo DirName;
9431 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9433 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9434 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9438template <
typename Derived>
9440TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *
D) {
9441 DeclarationNameInfo DirName;
9442 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9444 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9445 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9449template <
typename Derived>
9451TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *
D) {
9452 DeclarationNameInfo DirName;
9453 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9455 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9456 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9460template <
typename Derived>
9461StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9462 OMPTaskgroupDirective *
D) {
9463 DeclarationNameInfo DirName;
9464 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9466 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9467 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9471template <
typename Derived>
9473TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *
D) {
9474 DeclarationNameInfo DirName;
9475 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9477 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9478 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9482template <
typename Derived>
9484TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *
D) {
9485 DeclarationNameInfo DirName;
9486 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9488 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9489 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9493template <
typename Derived>
9495TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *
D) {
9496 DeclarationNameInfo DirName;
9497 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9499 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9500 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9504template <
typename Derived>
9506TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *
D) {
9507 DeclarationNameInfo DirName;
9508 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9510 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9511 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9515template <
typename Derived>
9517TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *
D) {
9518 DeclarationNameInfo DirName;
9519 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9521 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9522 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9526template <
typename Derived>
9528TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *
D) {
9529 DeclarationNameInfo DirName;
9530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9532 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9537template <
typename Derived>
9538StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9539 OMPTargetDataDirective *
D) {
9540 DeclarationNameInfo DirName;
9541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9543 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9548template <
typename Derived>
9549StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9550 OMPTargetEnterDataDirective *
D) {
9551 DeclarationNameInfo DirName;
9552 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9553 OMPD_target_enter_data, DirName,
nullptr,
D->
getBeginLoc());
9554 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9555 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9559template <
typename Derived>
9560StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9561 OMPTargetExitDataDirective *
D) {
9562 DeclarationNameInfo DirName;
9563 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9564 OMPD_target_exit_data, DirName,
nullptr,
D->
getBeginLoc());
9565 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9566 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9570template <
typename Derived>
9571StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9572 OMPTargetParallelDirective *
D) {
9573 DeclarationNameInfo DirName;
9574 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9575 OMPD_target_parallel, DirName,
nullptr,
D->
getBeginLoc());
9576 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9577 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9581template <
typename Derived>
9582StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9583 OMPTargetParallelForDirective *
D) {
9584 DeclarationNameInfo DirName;
9585 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9586 OMPD_target_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9587 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9588 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9592template <
typename Derived>
9593StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9594 OMPTargetUpdateDirective *
D) {
9595 DeclarationNameInfo DirName;
9596 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9597 OMPD_target_update, DirName,
nullptr,
D->
getBeginLoc());
9598 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9599 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9603template <
typename Derived>
9605TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *
D) {
9606 DeclarationNameInfo DirName;
9607 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9609 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9610 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9614template <
typename Derived>
9615StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9616 OMPCancellationPointDirective *
D) {
9617 DeclarationNameInfo DirName;
9618 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9619 OMPD_cancellation_point, DirName,
nullptr,
D->
getBeginLoc());
9620 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9621 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9625template <
typename Derived>
9627TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *
D) {
9628 DeclarationNameInfo DirName;
9629 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9631 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9632 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9636template <
typename Derived>
9638TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *
D) {
9639 DeclarationNameInfo DirName;
9640 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9642 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9643 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9647template <
typename Derived>
9648StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9649 OMPTaskLoopSimdDirective *
D) {
9650 DeclarationNameInfo DirName;
9651 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9652 OMPD_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9653 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9654 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9658template <
typename Derived>
9659StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9660 OMPMasterTaskLoopDirective *
D) {
9661 DeclarationNameInfo DirName;
9662 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9663 OMPD_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9664 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9665 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9669template <
typename Derived>
9670StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
9671 OMPMaskedTaskLoopDirective *
D) {
9672 DeclarationNameInfo DirName;
9673 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9674 OMPD_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9675 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9676 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9680template <
typename Derived>
9681StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
9682 OMPMasterTaskLoopSimdDirective *
D) {
9683 DeclarationNameInfo DirName;
9684 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9685 OMPD_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9686 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9687 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9691template <
typename Derived>
9692StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
9693 OMPMaskedTaskLoopSimdDirective *
D) {
9694 DeclarationNameInfo DirName;
9695 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9696 OMPD_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9697 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9698 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9702template <
typename Derived>
9703StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
9704 OMPParallelMasterTaskLoopDirective *
D) {
9705 DeclarationNameInfo DirName;
9706 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9707 OMPD_parallel_master_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9708 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9709 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9713template <
typename Derived>
9714StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
9715 OMPParallelMaskedTaskLoopDirective *
D) {
9716 DeclarationNameInfo DirName;
9717 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9718 OMPD_parallel_masked_taskloop, DirName,
nullptr,
D->
getBeginLoc());
9719 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9720 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9724template <
typename Derived>
9726TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
9727 OMPParallelMasterTaskLoopSimdDirective *
D) {
9728 DeclarationNameInfo DirName;
9729 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9730 OMPD_parallel_master_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9731 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9732 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9736template <
typename Derived>
9738TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
9739 OMPParallelMaskedTaskLoopSimdDirective *
D) {
9740 DeclarationNameInfo DirName;
9741 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9742 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr,
D->
getBeginLoc());
9743 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9744 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9748template <
typename Derived>
9749StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
9750 OMPDistributeDirective *
D) {
9751 DeclarationNameInfo DirName;
9752 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9754 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9755 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9759template <
typename Derived>
9760StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
9761 OMPDistributeParallelForDirective *
D) {
9762 DeclarationNameInfo DirName;
9763 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9764 OMPD_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9765 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9766 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9770template <
typename Derived>
9772TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
9773 OMPDistributeParallelForSimdDirective *
D) {
9774 DeclarationNameInfo DirName;
9775 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9776 OMPD_distribute_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9777 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9778 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9782template <
typename Derived>
9783StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
9784 OMPDistributeSimdDirective *
D) {
9785 DeclarationNameInfo DirName;
9786 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9787 OMPD_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
9788 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9789 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9793template <
typename Derived>
9794StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
9795 OMPTargetParallelForSimdDirective *
D) {
9796 DeclarationNameInfo DirName;
9797 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9798 OMPD_target_parallel_for_simd, DirName,
nullptr,
D->
getBeginLoc());
9799 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9800 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9804template <
typename Derived>
9805StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
9806 OMPTargetSimdDirective *
D) {
9807 DeclarationNameInfo DirName;
9808 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9810 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9811 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9815template <
typename Derived>
9816StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
9817 OMPTeamsDistributeDirective *
D) {
9818 DeclarationNameInfo DirName;
9819 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9820 OMPD_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
9821 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9822 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9826template <
typename Derived>
9827StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
9828 OMPTeamsDistributeSimdDirective *
D) {
9829 DeclarationNameInfo DirName;
9830 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9831 OMPD_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
9832 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9833 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9837template <
typename Derived>
9838StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
9839 OMPTeamsDistributeParallelForSimdDirective *
D) {
9840 DeclarationNameInfo DirName;
9841 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9842 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
9844 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9845 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9849template <
typename Derived>
9850StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
9851 OMPTeamsDistributeParallelForDirective *
D) {
9852 DeclarationNameInfo DirName;
9853 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9854 OMPD_teams_distribute_parallel_for, DirName,
nullptr,
D->
getBeginLoc());
9855 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9856 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9860template <
typename Derived>
9861StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
9862 OMPTargetTeamsDirective *
D) {
9863 DeclarationNameInfo DirName;
9864 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9865 OMPD_target_teams, DirName,
nullptr,
D->
getBeginLoc());
9866 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9867 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9871template <
typename Derived>
9872StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
9873 OMPTargetTeamsDistributeDirective *
D) {
9874 DeclarationNameInfo DirName;
9875 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9876 OMPD_target_teams_distribute, DirName,
nullptr,
D->
getBeginLoc());
9877 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9878 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9882template <
typename Derived>
9884TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
9885 OMPTargetTeamsDistributeParallelForDirective *
D) {
9886 DeclarationNameInfo DirName;
9887 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9888 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
9890 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9897 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
9898 OMPTargetTeamsDistributeParallelForSimdDirective *
D) {
9899 DeclarationNameInfo DirName;
9900 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9901 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
9903 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9904 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9908template <
typename Derived>
9910TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
9911 OMPTargetTeamsDistributeSimdDirective *
D) {
9912 DeclarationNameInfo DirName;
9913 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9914 OMPD_target_teams_distribute_simd, DirName,
nullptr,
D->
getBeginLoc());
9915 auto Res = getDerived().TransformOMPExecutableDirective(
D);
9916 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9920template <
typename Derived>
9922TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *
D) {
9923 DeclarationNameInfo DirName;
9924 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9926 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9927 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9931template <
typename Derived>
9933TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *
D) {
9934 DeclarationNameInfo DirName;
9935 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9937 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9938 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9942template <
typename Derived>
9944TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *
D) {
9945 DeclarationNameInfo DirName;
9946 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9948 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9949 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9953template <
typename Derived>
9954StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
9955 OMPGenericLoopDirective *
D) {
9956 DeclarationNameInfo DirName;
9957 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9959 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9960 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9964template <
typename Derived>
9965StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
9966 OMPTeamsGenericLoopDirective *
D) {
9967 DeclarationNameInfo DirName;
9968 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9970 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9971 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9975template <
typename Derived>
9976StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
9977 OMPTargetTeamsGenericLoopDirective *
D) {
9978 DeclarationNameInfo DirName;
9979 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9980 OMPD_target_teams_loop, DirName,
nullptr,
D->
getBeginLoc());
9981 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9982 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9986template <
typename Derived>
9987StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
9988 OMPParallelGenericLoopDirective *
D) {
9989 DeclarationNameInfo DirName;
9990 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9991 OMPD_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
9992 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
9993 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9997template <
typename Derived>
9999TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
10000 OMPTargetParallelGenericLoopDirective *
D) {
10001 DeclarationNameInfo DirName;
10002 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10003 OMPD_target_parallel_loop, DirName,
nullptr,
D->
getBeginLoc());
10004 StmtResult Res = getDerived().TransformOMPExecutableDirective(
D);
10005 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10012template <
typename Derived>
10013OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
10014 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10015 if (Cond.isInvalid())
10017 return getDerived().RebuildOMPIfClause(
10018 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10019 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10022template <
typename Derived>
10023OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
10024 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10025 if (Cond.isInvalid())
10027 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10028 C->getLParenLoc(),
C->getEndLoc());
10031template <
typename Derived>
10033TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
10034 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10035 if (NumThreads.isInvalid())
10037 return getDerived().RebuildOMPNumThreadsClause(
10038 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10041template <
typename Derived>
10043TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
10044 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10047 return getDerived().RebuildOMPSafelenClause(
10048 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10051template <
typename Derived>
10053TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
10054 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10057 return getDerived().RebuildOMPAllocatorClause(
10058 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10061template <
typename Derived>
10063TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
10064 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10067 return getDerived().RebuildOMPSimdlenClause(
10068 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10071template <
typename Derived>
10072OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
10074 TransformedSizes.reserve(
C->getNumSizes());
10076 for (Expr *
E :
C->getSizesRefs()) {
10078 TransformedSizes.push_back(
nullptr);
10087 TransformedSizes.push_back(
T.get());
10090 if (!Changed && !getDerived().AlwaysRebuild())
10092 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10093 C->getLParenLoc(),
C->getEndLoc());
10096template <
typename Derived>
10097OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10098 if (!getDerived().AlwaysRebuild())
10100 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10103template <
typename Derived>
10105TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10106 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10109 Expr *Factor =
T.get();
10110 bool Changed = Factor !=
C->getFactor();
10112 if (!Changed && !getDerived().AlwaysRebuild())
10114 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10118template <
typename Derived>
10120TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10121 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10124 return getDerived().RebuildOMPCollapseClause(
10125 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10128template <
typename Derived>
10130TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10131 return getDerived().RebuildOMPDefaultClause(
10132 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10133 C->getLParenLoc(),
C->getEndLoc());
10136template <
typename Derived>
10138TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10139 return getDerived().RebuildOMPProcBindClause(
10140 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10141 C->getLParenLoc(),
C->getEndLoc());
10144template <
typename Derived>
10146TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10147 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10150 return getDerived().RebuildOMPScheduleClause(
10151 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10152 C->getScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10153 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10154 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10157template <
typename Derived>
10159TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10161 if (
auto *Num =
C->getNumForLoops()) {
10162 E = getDerived().TransformExpr(Num);
10166 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10167 C->getLParenLoc(),
E.get());
10170template <
typename Derived>
10172TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10174 if (Expr *Evt =
C->getEventHandler()) {
10175 E = getDerived().TransformExpr(Evt);
10179 return getDerived().RebuildOMPDetachClause(
E.get(),
C->getBeginLoc(),
10180 C->getLParenLoc(),
C->getEndLoc());
10183template <
typename Derived>
10185TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10190template <
typename Derived>
10192TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10197template <
typename Derived>
10199TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10204template <
typename Derived>
10205OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10210template <
typename Derived>
10211OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10216template <
typename Derived>
10218TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10223template <
typename Derived>
10225TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10230template <
typename Derived>
10232TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10237template <
typename Derived>
10238OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10243template <
typename Derived>
10245TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10250template <
typename Derived>
10252TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10257template <
typename Derived>
10259TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10264template <
typename Derived>
10266TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10271template <
typename Derived>
10273TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10278template <
typename Derived>
10279OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10284template <
typename Derived>
10286TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10291template <
typename Derived>
10292OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10297template <
typename Derived>
10299TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10304template <
typename Derived>
10305OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10306 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10307 if (IVR.isInvalid())
10310 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10311 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10312 for (Expr *
E : llvm::drop_begin(
C->varlists())) {
10313 ExprResult ER = getDerived().TransformExpr(cast<Expr>(
E));
10314 if (ER.isInvalid())
10316 InteropInfo.PreferTypes.push_back(ER.get());
10318 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10319 C->getBeginLoc(),
C->getLParenLoc(),
10320 C->getVarLoc(),
C->getEndLoc());
10323template <
typename Derived>
10324OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10325 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10326 if (ER.isInvalid())
10328 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10329 C->getLParenLoc(),
C->getVarLoc(),
10333template <
typename Derived>
10335TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10337 if (Expr *IV =
C->getInteropVar()) {
10338 ER = getDerived().TransformExpr(IV);
10339 if (ER.isInvalid())
10342 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10343 C->getLParenLoc(),
C->getVarLoc(),
10347template <
typename Derived>
10349TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10350 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10351 if (Cond.isInvalid())
10353 return getDerived().RebuildOMPNovariantsClause(
10354 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10357template <
typename Derived>
10359TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10360 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10361 if (Cond.isInvalid())
10363 return getDerived().RebuildOMPNocontextClause(
10364 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10367template <
typename Derived>
10369TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10370 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10371 if (ThreadID.isInvalid())
10373 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10374 C->getLParenLoc(),
C->getEndLoc());
10377template <
typename Derived>
10378OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10379 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10382 return getDerived().RebuildOMPAlignClause(
E.get(),
C->getBeginLoc(),
10383 C->getLParenLoc(),
C->getEndLoc());
10386template <
typename Derived>
10387OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10388 OMPUnifiedAddressClause *
C) {
10389 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10392template <
typename Derived>
10393OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10394 OMPUnifiedSharedMemoryClause *
C) {
10396 "unified_shared_memory clause cannot appear in dependent context");
10399template <
typename Derived>
10400OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10401 OMPReverseOffloadClause *
C) {
10402 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10405template <
typename Derived>
10406OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10407 OMPDynamicAllocatorsClause *
C) {
10409 "dynamic_allocators clause cannot appear in dependent context");
10412template <
typename Derived>
10413OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10414 OMPAtomicDefaultMemOrderClause *
C) {
10416 "atomic_default_mem_order clause cannot appear in dependent context");
10419template <
typename Derived>
10420OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10421 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10422 C->getBeginLoc(),
C->getLParenLoc(),
10426template <
typename Derived>
10428TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10429 return getDerived().RebuildOMPSeverityClause(
10430 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10431 C->getLParenLoc(),
C->getEndLoc());
10434template <
typename Derived>
10436TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10437 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10440 return getDerived().RebuildOMPMessageClause(
10441 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10445template <
typename Derived>
10447TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10449 Vars.reserve(
C->varlist_size());
10450 for (
auto *VE :
C->varlists()) {
10451 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10452 if (EVar.isInvalid())
10454 Vars.push_back(EVar.get());
10456 return getDerived().RebuildOMPPrivateClause(
10457 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10460template <
typename Derived>
10461OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10462 OMPFirstprivateClause *
C) {
10464 Vars.reserve(
C->varlist_size());
10465 for (
auto *VE :
C->varlists()) {
10466 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10467 if (EVar.isInvalid())
10469 Vars.push_back(EVar.get());
10471 return getDerived().RebuildOMPFirstprivateClause(
10472 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10475template <
typename Derived>
10477TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10479 Vars.reserve(
C->varlist_size());
10480 for (
auto *VE :
C->varlists()) {
10481 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10482 if (EVar.isInvalid())
10484 Vars.push_back(EVar.get());
10486 return getDerived().RebuildOMPLastprivateClause(
10487 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10488 C->getLParenLoc(),
C->getEndLoc());
10491template <
typename Derived>
10493TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10495 Vars.reserve(
C->varlist_size());
10496 for (
auto *VE :
C->varlists()) {
10497 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10498 if (EVar.isInvalid())
10500 Vars.push_back(EVar.get());
10502 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10503 C->getLParenLoc(),
C->getEndLoc());
10506template <
typename Derived>
10508TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10510 Vars.reserve(
C->varlist_size());
10511 for (
auto *VE :
C->varlists()) {
10512 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10513 if (EVar.isInvalid())
10515 Vars.push_back(EVar.get());
10517 CXXScopeSpec ReductionIdScopeSpec;
10518 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10520 DeclarationNameInfo NameInfo =
C->getNameInfo();
10521 if (NameInfo.getName()) {
10522 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10523 if (!NameInfo.getName())
10529 for (
auto *
E :
C->reduction_ops()) {
10532 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10533 UnresolvedSet<8> Decls;
10534 for (
auto *
D : ULE->decls()) {
10536 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10537 Decls.addDecl(InstD, InstD->getAccess());
10541 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10542 true, Decls.begin(), Decls.end(),
10545 UnresolvedReductions.push_back(
nullptr);
10547 return getDerived().RebuildOMPReductionClause(
10548 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10549 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10550 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10553template <
typename Derived>
10554OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10555 OMPTaskReductionClause *
C) {
10557 Vars.reserve(
C->varlist_size());
10558 for (
auto *VE :
C->varlists()) {
10559 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10560 if (EVar.isInvalid())
10562 Vars.push_back(EVar.get());
10564 CXXScopeSpec ReductionIdScopeSpec;
10565 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10567 DeclarationNameInfo NameInfo =
C->getNameInfo();
10568 if (NameInfo.getName()) {
10569 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10570 if (!NameInfo.getName())
10576 for (
auto *
E :
C->reduction_ops()) {
10579 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10580 UnresolvedSet<8> Decls;
10581 for (
auto *
D : ULE->decls()) {
10583 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10584 Decls.addDecl(InstD, InstD->getAccess());
10588 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10589 true, Decls.begin(), Decls.end(),
10592 UnresolvedReductions.push_back(
nullptr);
10594 return getDerived().RebuildOMPTaskReductionClause(
10595 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10596 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10599template <
typename Derived>
10601TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10603 Vars.reserve(
C->varlist_size());
10604 for (
auto *VE :
C->varlists()) {
10605 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10606 if (EVar.isInvalid())
10608 Vars.push_back(EVar.get());
10610 CXXScopeSpec ReductionIdScopeSpec;
10611 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10613 DeclarationNameInfo NameInfo =
C->getNameInfo();
10614 if (NameInfo.getName()) {
10615 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10616 if (!NameInfo.getName())
10622 for (
auto *
E :
C->reduction_ops()) {
10625 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10626 UnresolvedSet<8> Decls;
10627 for (
auto *
D : ULE->decls()) {
10629 cast<NamedDecl>(getDerived().TransformDecl(
E->
getExprLoc(),
D));
10630 Decls.addDecl(InstD, InstD->getAccess());
10634 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10635 true, Decls.begin(), Decls.end(),
10638 UnresolvedReductions.push_back(
nullptr);
10640 return getDerived().RebuildOMPInReductionClause(
10641 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10642 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10645template <
typename Derived>
10647TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
10649 Vars.reserve(
C->varlist_size());
10650 for (
auto *VE :
C->varlists()) {
10651 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10652 if (EVar.isInvalid())
10654 Vars.push_back(EVar.get());
10656 ExprResult Step = getDerived().TransformExpr(
C->getStep());
10657 if (Step.isInvalid())
10659 return getDerived().RebuildOMPLinearClause(
10660 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
10661 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
10665template <
typename Derived>
10667TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
10669 Vars.reserve(
C->varlist_size());
10670 for (
auto *VE :
C->varlists()) {
10671 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10672 if (EVar.isInvalid())
10674 Vars.push_back(EVar.get());
10676 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
10677 if (Alignment.isInvalid())
10679 return getDerived().RebuildOMPAlignedClause(
10680 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10681 C->getColonLoc(),
C->getEndLoc());
10684template <
typename Derived>
10686TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
10688 Vars.reserve(
C->varlist_size());
10689 for (
auto *VE :
C->varlists()) {
10690 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10691 if (EVar.isInvalid())
10693 Vars.push_back(EVar.get());
10695 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
10696 C->getLParenLoc(),
C->getEndLoc());
10699template <
typename Derived>
10701TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
10703 Vars.reserve(
C->varlist_size());
10704 for (
auto *VE :
C->varlists()) {
10705 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10706 if (EVar.isInvalid())
10708 Vars.push_back(EVar.get());
10710 return getDerived().RebuildOMPCopyprivateClause(
10711 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10714template <
typename Derived>
10715OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
10717 Vars.reserve(
C->varlist_size());
10718 for (
auto *VE :
C->varlists()) {
10719 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10720 if (EVar.isInvalid())
10722 Vars.push_back(EVar.get());
10724 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
10725 C->getLParenLoc(),
C->getEndLoc());
10728template <
typename Derived>
10730TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
10731 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
10734 return getDerived().RebuildOMPDepobjClause(
E.get(),
C->getBeginLoc(),
10735 C->getLParenLoc(),
C->getEndLoc());
10738template <
typename Derived>
10740TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
10742 Expr *DepModifier =
C->getModifier();
10744 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
10745 if (DepModRes.isInvalid())
10747 DepModifier = DepModRes.
get();
10749 Vars.reserve(
C->varlist_size());
10750 for (
auto *VE :
C->varlists()) {
10751 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10752 if (EVar.isInvalid())
10754 Vars.push_back(EVar.get());
10756 return getDerived().RebuildOMPDependClause(
10757 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
10758 C->getOmpAllMemoryLoc()},
10759 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10762template <
typename Derived>
10764TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
10765 ExprResult E = getDerived().TransformExpr(
C->getDevice());
10768 return getDerived().RebuildOMPDeviceClause(
10769 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10770 C->getModifierLoc(),
C->getEndLoc());
10773template <
typename Derived,
class T>
10780 Vars.reserve(
C->varlist_size());
10781 for (
auto *VE :
C->varlists()) {
10785 Vars.push_back(EVar.
get());
10789 if (
C->getMapperQualifierLoc()) {
10790 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
10791 C->getMapperQualifierLoc());
10795 MapperIdScopeSpec.
Adopt(QualifierLoc);
10796 MapperIdInfo =
C->getMapperIdInfo();
10797 if (MapperIdInfo.
getName()) {
10798 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
10804 for (
auto *
E :
C->mapperlists()) {
10807 auto *ULE = cast<UnresolvedLookupExpr>(
E);
10809 for (
auto *
D : ULE->decls()) {
10817 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
10820 UnresolvedMappers.push_back(
nullptr);
10826template <
typename Derived>
10827OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
10828 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10830 Expr *IteratorModifier =
C->getIteratorModifier();
10831 if (IteratorModifier) {
10832 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
10833 if (MapModRes.isInvalid())
10835 IteratorModifier = MapModRes.
get();
10837 CXXScopeSpec MapperIdScopeSpec;
10838 DeclarationNameInfo MapperIdInfo;
10840 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
10841 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10843 return getDerived().RebuildOMPMapClause(
10844 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
10845 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
10846 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10849template <
typename Derived>
10851TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
10852 Expr *Allocator =
C->getAllocator();
10854 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
10855 if (AllocatorRes.isInvalid())
10857 Allocator = AllocatorRes.get();
10860 Vars.reserve(
C->varlist_size());
10861 for (
auto *VE :
C->varlists()) {
10862 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10863 if (EVar.isInvalid())
10865 Vars.push_back(EVar.get());
10867 return getDerived().RebuildOMPAllocateClause(
10868 Allocator, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10872template <
typename Derived>
10874TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
10875 ExprResult E = getDerived().TransformExpr(
C->getNumTeams());
10878 return getDerived().RebuildOMPNumTeamsClause(
10879 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10882template <
typename Derived>
10884TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
10885 ExprResult E = getDerived().TransformExpr(
C->getThreadLimit());
10888 return getDerived().RebuildOMPThreadLimitClause(
10889 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10892template <
typename Derived>
10894TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
10895 ExprResult E = getDerived().TransformExpr(
C->getPriority());
10898 return getDerived().RebuildOMPPriorityClause(
10899 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10902template <
typename Derived>
10904TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
10905 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
10908 return getDerived().RebuildOMPGrainsizeClause(
10909 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10910 C->getModifierLoc(),
C->getEndLoc());
10913template <
typename Derived>
10915TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
10916 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
10919 return getDerived().RebuildOMPNumTasksClause(
10920 C->getModifier(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10921 C->getModifierLoc(),
C->getEndLoc());
10924template <
typename Derived>
10925OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
10926 ExprResult E = getDerived().TransformExpr(
C->getHint());
10929 return getDerived().RebuildOMPHintClause(
E.get(),
C->getBeginLoc(),
10930 C->getLParenLoc(),
C->getEndLoc());
10933template <
typename Derived>
10934OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
10935 OMPDistScheduleClause *
C) {
10936 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10939 return getDerived().RebuildOMPDistScheduleClause(
10940 C->getDistScheduleKind(),
E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10941 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10944template <
typename Derived>
10946TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
10949 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
10950 C->getDefaultmapKind(),
10953 C->getDefaultmapModifierLoc(),
10954 C->getDefaultmapKindLoc(),
10958template <
typename Derived>
10959OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
10960 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10962 CXXScopeSpec MapperIdScopeSpec;
10963 DeclarationNameInfo MapperIdInfo;
10965 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
10966 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10968 return getDerived().RebuildOMPToClause(
10969 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
10970 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10973template <
typename Derived>
10974OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
10975 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10977 CXXScopeSpec MapperIdScopeSpec;
10978 DeclarationNameInfo MapperIdInfo;
10980 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
10981 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10983 return getDerived().RebuildOMPFromClause(
10984 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
10985 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10988template <
typename Derived>
10989OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
10990 OMPUseDevicePtrClause *
C) {
10992 Vars.reserve(
C->varlist_size());
10993 for (
auto *VE :
C->varlists()) {
10994 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10995 if (EVar.isInvalid())
10997 Vars.push_back(EVar.get());
10999 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11000 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11003template <
typename Derived>
11004OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
11005 OMPUseDeviceAddrClause *
C) {
11007 Vars.reserve(
C->varlist_size());
11008 for (
auto *VE :
C->varlists()) {
11009 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11010 if (EVar.isInvalid())
11012 Vars.push_back(EVar.get());
11014 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11015 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11018template <
typename Derived>
11020TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
11022 Vars.reserve(
C->varlist_size());
11023 for (
auto *VE :
C->varlists()) {
11024 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11025 if (EVar.isInvalid())
11027 Vars.push_back(EVar.get());
11029 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11030 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11033template <
typename Derived>
11034OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
11035 OMPHasDeviceAddrClause *
C) {
11037 Vars.reserve(
C->varlist_size());
11038 for (
auto *VE :
C->varlists()) {
11039 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11040 if (EVar.isInvalid())
11042 Vars.push_back(EVar.get());
11044 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11045 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11048template <
typename Derived>
11050TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
11052 Vars.reserve(
C->varlist_size());
11053 for (
auto *VE :
C->varlists()) {
11054 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11055 if (EVar.isInvalid())
11057 Vars.push_back(EVar.get());
11059 return getDerived().RebuildOMPNontemporalClause(
11060 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11063template <
typename Derived>
11065TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
11067 Vars.reserve(
C->varlist_size());
11068 for (
auto *VE :
C->varlists()) {
11069 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11070 if (EVar.isInvalid())
11072 Vars.push_back(EVar.get());
11074 return getDerived().RebuildOMPInclusiveClause(
11075 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11078template <
typename Derived>
11080TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
11082 Vars.reserve(
C->varlist_size());
11083 for (
auto *VE :
C->varlists()) {
11084 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11085 if (EVar.isInvalid())
11087 Vars.push_back(EVar.get());
11089 return getDerived().RebuildOMPExclusiveClause(
11090 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11093template <
typename Derived>
11094OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11095 OMPUsesAllocatorsClause *
C) {
11097 Data.reserve(
C->getNumberOfAllocators());
11098 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
11099 OMPUsesAllocatorsClause::Data
D =
C->getAllocatorData(I);
11100 ExprResult Allocator = getDerived().TransformExpr(
D.Allocator);
11101 if (Allocator.isInvalid())
11104 if (Expr *AT =
D.AllocatorTraits) {
11105 AllocatorTraits = getDerived().TransformExpr(AT);
11106 if (AllocatorTraits.isInvalid())
11109 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11110 NewD.Allocator = Allocator.get();
11111 NewD.AllocatorTraits = AllocatorTraits.get();
11112 NewD.LParenLoc =
D.LParenLoc;
11113 NewD.RParenLoc =
D.RParenLoc;
11115 return getDerived().RebuildOMPUsesAllocatorsClause(
11116 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11119template <
typename Derived>
11121TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11123 Locators.reserve(
C->varlist_size());
11125 if (Expr *Modifier =
C->getModifier()) {
11126 ModifierRes = getDerived().TransformExpr(Modifier);
11127 if (ModifierRes.isInvalid())
11130 for (Expr *
E :
C->varlists()) {
11131 ExprResult Locator = getDerived().TransformExpr(
E);
11132 if (Locator.isInvalid())
11134 Locators.push_back(Locator.get());
11136 return getDerived().RebuildOMPAffinityClause(
11137 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11138 ModifierRes.get(), Locators);
11141template <
typename Derived>
11142OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11143 return getDerived().RebuildOMPOrderClause(
11144 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11145 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11148template <
typename Derived>
11149OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11150 return getDerived().RebuildOMPBindClause(
11151 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11152 C->getLParenLoc(),
C->getEndLoc());
11155template <
typename Derived>
11156OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11157 OMPXDynCGroupMemClause *
C) {
11159 if (
Size.isInvalid())
11161 return getDerived().RebuildOMPXDynCGroupMemClause(
11162 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11165template <
typename Derived>
11167TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11169 Vars.reserve(
C->varlist_size());
11170 for (
auto *VE :
C->varlists()) {
11171 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11172 if (EVar.isInvalid())
11174 Vars.push_back(EVar.get());
11176 return getDerived().RebuildOMPDoacrossClause(
11177 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11178 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11181template <
typename Derived>
11183TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11185 for (
auto *A :
C->getAttrs())
11186 NewAttrs.push_back(getDerived().TransformAttr(A));
11187 return getDerived().RebuildOMPXAttributeClause(
11188 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11191template <
typename Derived>
11192OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11193 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11200template <
typename Derived>
11201class OpenACCClauseTransform final
11202 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11203 TreeTransform<Derived> &Self;
11205 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11206 OpenACCClause *NewClause =
nullptr;
11210 for (Expr *CurVar : VarList) {
11211 ExprResult Res = Self.TransformExpr(CurVar);
11213 if (!Res.isUsable())
11216 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getClauseKind(),
11219 if (Res.isUsable())
11220 InstantiatedVarList.push_back(Res.get());
11223 return InstantiatedVarList;
11227 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11229 SemaOpenACC::OpenACCParsedClause &PC)
11230 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11232 OpenACCClause *CreatedClause()
const {
return NewClause; }
11234#define VISIT_CLAUSE(CLAUSE_NAME) \
11235 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11236#include "clang/Basic/OpenACCClauses.def"
11239template <
typename Derived>
11240void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11241 const OpenACCDefaultClause &
C) {
11250template <
typename Derived>
11251void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11252 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11253 assert(Cond &&
"If constructed with invalid Condition");
11254 Sema::ConditionResult Res =
Self.TransformCondition(
11257 if (Res.isInvalid() || !Res.get().second)
11268template <
typename Derived>
11269void OpenACCClauseTransform<Derived>::VisitSelfClause(
11270 const OpenACCSelfClause &
C) {
11272 if (
C.hasConditionExpr()) {
11273 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11274 Sema::ConditionResult Res =
11275 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11278 if (Res.isInvalid() || !Res.get().second)
11290template <
typename Derived>
11291void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11292 const OpenACCNumGangsClause &
C) {
11295 for (Expr *CurIntExpr :
C.getIntExprs()) {
11298 if (!Res.isUsable())
11303 C.getBeginLoc(), Res.get());
11304 if (!Res.isUsable())
11307 InstantiatedIntExprs.push_back(Res.get());
11317template <
typename Derived>
11318void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11319 const OpenACCPrivateClause &
C) {
11329template <
typename Derived>
11330void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11331 const OpenACCFirstPrivateClause &
C) {
11341template <
typename Derived>
11342void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11343 const OpenACCNoCreateClause &
C) {
11353template <
typename Derived>
11354void OpenACCClauseTransform<Derived>::VisitPresentClause(
11355 const OpenACCPresentClause &
C) {
11365template <
typename Derived>
11366void OpenACCClauseTransform<Derived>::VisitCopyClause(
11367 const OpenACCCopyClause &
C) {
11377template <
typename Derived>
11378void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11379 const OpenACCCopyInClause &
C) {
11390template <
typename Derived>
11391void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11392 const OpenACCCopyOutClause &
C) {
11394 false,
C.isZero());
11403template <
typename Derived>
11404void OpenACCClauseTransform<Derived>::VisitCreateClause(
11405 const OpenACCCreateClause &
C) {
11407 false,
C.isZero());
11415template <
typename Derived>
11416void OpenACCClauseTransform<Derived>::VisitAttachClause(
11417 const OpenACCAttachClause &
C) {
11421 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11422 return Self.getSema().OpenACC().CheckVarIsPointerType(
11423 OpenACCClauseKind::Attach, E);
11424 }), VarList.end());
11434template <
typename Derived>
11435void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
11436 const OpenACCDevicePtrClause &
C) {
11440 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *
E) {
11441 return Self.getSema().OpenACC().CheckVarIsPointerType(
11442 OpenACCClauseKind::DevicePtr, E);
11443 }), VarList.end());
11453template <
typename Derived>
11454void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
11455 const OpenACCNumWorkersClause &
C) {
11456 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11457 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
11460 if (!Res.isUsable())
11465 C.getBeginLoc(), Res.get());
11466 if (!Res.isUsable())
11476template <
typename Derived>
11477void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
11478 const OpenACCVectorLengthClause &
C) {
11479 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11480 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
11483 if (!Res.isUsable())
11488 C.getBeginLoc(), Res.get());
11489 if (!Res.isUsable())
11499template <
typename Derived>
11500void OpenACCClauseTransform<Derived>::VisitAsyncClause(
11501 const OpenACCAsyncClause &
C) {
11502 if (
C.hasIntExpr()) {
11503 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
11504 if (!Res.isUsable())
11509 C.getBeginLoc(), Res.get());
11510 if (!Res.isUsable())
11522template <
typename Derived>
11523void OpenACCClauseTransform<Derived>::VisitWaitClause(
11524 const OpenACCWaitClause &
C) {
11525 if (!
C.getLParenLoc().isInvalid()) {
11526 Expr *DevNumExpr =
nullptr;
11530 if (
C.getDevNumExpr()) {
11532 if (!Res.isUsable())
11536 C.getBeginLoc(), Res.get());
11537 if (!Res.isUsable())
11540 DevNumExpr = Res.get();
11544 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
11546 if (!Res.isUsable())
11550 C.getBeginLoc(), Res.get());
11551 if (!Res.isUsable())
11554 InstantiatedQueueIdExprs.push_back(Res.get());
11558 std::move(InstantiatedQueueIdExprs));
11568template <
typename Derived>
11569void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
11570 const OpenACCDeviceTypeClause &
C) {
11573 Self.getSema().getASTContext(),
C.getClauseKind(),
11575 C.getArchitectures(), ParsedClause.
getEndLoc());
11578template <
typename Derived>
11579void OpenACCClauseTransform<Derived>::VisitAutoClause(
11580 const OpenACCAutoClause &
C) {
11587template <
typename Derived>
11588void OpenACCClauseTransform<Derived>::VisitIndependentClause(
11589 const OpenACCIndependentClause &
C) {
11595template <
typename Derived>
11596void OpenACCClauseTransform<Derived>::VisitSeqClause(
11597 const OpenACCSeqClause &
C) {
11603template <
typename Derived>
11604void OpenACCClauseTransform<Derived>::VisitReductionClause(
11605 const OpenACCReductionClause &
C) {
11609 for (Expr *Var : TransformedVars) {
11610 ExprResult Res =
Self.getSema().OpenACC().CheckReductionVar(Var);
11611 if (Res.isUsable())
11612 ValidVars.push_back(Res.get());
11617 ParsedClause.
getLParenLoc(),
C.getReductionOp(), ValidVars,
11621template <
typename Derived>
11622OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
11626 SemaOpenACC::OpenACCParsedClause ParsedClause(
11627 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
11628 ParsedClause.
setEndLoc(OldClause->getEndLoc());
11630 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
11633 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
11635 Transform.Visit(OldClause);
11637 return Transform.CreatedClause();
11640template <
typename Derived>
11642TreeTransform<Derived>::TransformOpenACCClauseList(
11645 for (
const auto *Clause : OldClauses) {
11646 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
11647 TransformedClauses, DirKind, Clause))
11648 TransformedClauses.push_back(TransformedClause);
11650 return TransformedClauses;
11653template <
typename Derived>
11654StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
11655 OpenACCComputeConstruct *
C) {
11656 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
11658 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
11663 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
11666 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(getSema().OpenACC(),
11667 C->getDirectiveKind());
11668 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
11669 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
11670 C->getBeginLoc(),
C->getDirectiveKind(), StrBlock);
11672 return getDerived().RebuildOpenACCComputeConstruct(
11673 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
11674 C->getEndLoc(), TransformedClauses, StrBlock);
11677template <
typename Derived>
11679TreeTransform<Derived>::TransformOpenACCLoopConstruct(OpenACCLoopConstruct *
C) {
11681 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
11683 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
11688 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
11692 SemaOpenACC::AssociatedStmtRAII AssocStmtRAII(getSema().OpenACC(),
11693 C->getDirectiveKind());
11695 Loop = getSema().OpenACC().ActOnAssociatedStmt(
C->getBeginLoc(),
11696 C->getDirectiveKind(),
Loop);
11698 return getDerived().RebuildOpenACCLoopConstruct(
11699 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
11700 TransformedClauses,
Loop);
11706template<
typename Derived>
11708TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *
E) {
11709 return TransformExpr(
E->getSubExpr());
11712template <
typename Derived>
11713ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
11714 SYCLUniqueStableNameExpr *
E) {
11718 TypeSourceInfo *NewT = getDerived().TransformType(
E->getTypeSourceInfo());
11723 if (!getDerived().AlwaysRebuild() &&
E->getTypeSourceInfo() == NewT)
11726 return getDerived().RebuildSYCLUniqueStableNameExpr(
11727 E->getLocation(),
E->getLParenLocation(),
E->getRParenLocation(), NewT);
11730template<
typename Derived>
11732TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *
E) {
11736 return getDerived().RebuildPredefinedExpr(
E->getLocation(),
11737 E->getIdentKind());
11740template<
typename Derived>
11742TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *
E) {
11743 NestedNameSpecifierLoc QualifierLoc;
11744 if (
E->getQualifierLoc()) {
11746 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
11752 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getLocation(),
11757 NamedDecl *
Found = ND;
11758 if (
E->getFoundDecl() !=
E->getDecl()) {
11759 Found = cast_or_null<NamedDecl>(
11760 getDerived().TransformDecl(
E->getLocation(),
E->getFoundDecl()));
11765 DeclarationNameInfo NameInfo =
E->getNameInfo();
11766 if (NameInfo.getName()) {
11767 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11768 if (!NameInfo.getName())
11772 if (!getDerived().AlwaysRebuild() &&
11773 !
E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
11774 QualifierLoc ==
E->getQualifierLoc() && ND ==
E->getDecl() &&
11775 Found ==
E->getFoundDecl() &&
11776 NameInfo.getName() ==
E->getDecl()->getDeclName() &&
11777 !
E->hasExplicitTemplateArgs()) {
11786 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
11787 if (
E->hasExplicitTemplateArgs()) {
11788 TemplateArgs = &TransArgs;
11789 TransArgs.setLAngleLoc(
E->getLAngleLoc());
11790 TransArgs.setRAngleLoc(
E->getRAngleLoc());
11791 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
11792 E->getNumTemplateArgs(),
11797 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
11798 Found, TemplateArgs);
11801template<
typename Derived>
11803TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *
E) {
11807template <
typename Derived>
11808ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
11809 FixedPointLiteral *
E) {
11813template<
typename Derived>
11815TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *
E) {
11819template<
typename Derived>
11821TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *
E) {
11825template<
typename Derived>
11827TreeTransform<Derived>::TransformStringLiteral(StringLiteral *
E) {
11831template<
typename Derived>
11833TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *
E) {
11837template<
typename Derived>
11839TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *
E) {
11840 return getDerived().TransformCallExpr(
E);
11843template<
typename Derived>
11845TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *
E) {
11847 TypeSourceInfo *ControllingType =
nullptr;
11848 if (
E->isExprPredicate())
11849 ControllingExpr = getDerived().TransformExpr(
E->getControllingExpr());
11851 ControllingType = getDerived().TransformType(
E->getControllingType());
11853 if (ControllingExpr.isInvalid() && !ControllingType)
11859 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
11861 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
11864 AssocTypes.push_back(AssocType);
11866 AssocTypes.push_back(
nullptr);
11870 getDerived().TransformExpr(Assoc.getAssociationExpr());
11871 if (AssocExpr.isInvalid())
11873 AssocExprs.push_back(AssocExpr.get());
11876 if (!ControllingType)
11877 return getDerived().RebuildGenericSelectionExpr(
E->getGenericLoc(),
11878 E->getDefaultLoc(),
11880 ControllingExpr.get(),
11883 return getDerived().RebuildGenericSelectionExpr(
11884 E->getGenericLoc(),
E->getDefaultLoc(),
E->getRParenLoc(),
11885 ControllingType, AssocTypes, AssocExprs);
11888template<
typename Derived>
11890TreeTransform<Derived>::TransformParenExpr(ParenExpr *
E) {
11891 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
11892 if (SubExpr.isInvalid())
11895 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getSubExpr())
11898 return getDerived().RebuildParenExpr(SubExpr.get(),
E->getLParen(),
11905template<
typename Derived>
11909 return getDerived().TransformDependentScopeDeclRefExpr(
11910 DRE,
true,
nullptr);
11912 return getDerived().TransformUnresolvedLookupExpr(
11915 return getDerived().TransformExpr(
E);
11918template<
typename Derived>
11922 if (
E->getOpcode() == UO_AddrOf)
11923 SubExpr = TransformAddressOfOperand(
E->getSubExpr());
11925 SubExpr = TransformExpr(
E->getSubExpr());
11929 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getSubExpr())
11932 return getDerived().RebuildUnaryOperator(
E->getOperatorLoc(),
11937template<
typename Derived>
11939TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *
E) {
11941 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
11951 bool ExprChanged =
false;
11952 typedef Sema::OffsetOfComponent Component;
11954 for (
unsigned I = 0, N =
E->getNumComponents(); I != N; ++I) {
11955 const OffsetOfNode &ON =
E->getComponent(I);
11957 Comp.isBrackets =
true;
11958 Comp.LocStart = ON.getSourceRange().getBegin();
11959 Comp.LocEnd = ON.getSourceRange().getEnd();
11960 switch (ON.getKind()) {
11962 Expr *FromIndex =
E->getIndexExpr(ON.getArrayExprIndex());
11963 ExprResult Index = getDerived().TransformExpr(FromIndex);
11964 if (Index.isInvalid())
11967 ExprChanged = ExprChanged || Index.get() != FromIndex;
11968 Comp.isBrackets =
true;
11969 Comp.U.E = Index.get();
11975 Comp.isBrackets =
false;
11976 Comp.U.IdentInfo = ON.getFieldName();
11977 if (!
Comp.U.IdentInfo)
11987 Components.push_back(Comp);
11991 if (!getDerived().AlwaysRebuild() &&
11992 Type ==
E->getTypeSourceInfo() &&
11997 return getDerived().RebuildOffsetOfExpr(
E->getOperatorLoc(), Type,
11998 Components,
E->getRParenLoc());
12001template<
typename Derived>
12003TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *
E) {
12004 assert((!
E->getSourceExpr() || getDerived().AlreadyTransformed(
E->
getType())) &&
12005 "opaque value expression requires transformation");
12009template<
typename Derived>
12011TreeTransform<Derived>::TransformTypoExpr(TypoExpr *
E) {
12015template <
typename Derived>
12016ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *
E) {
12019 for (Expr *
C :
E->subExpressions()) {
12021 if (NewC.isInvalid())
12023 Children.push_back(NewC.get());
12027 if (!getDerived().AlwaysRebuild() && !Changed)
12033template<
typename Derived>
12035TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *
E) {
12043 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
12044 if (result.isInvalid())
return ExprError();
12049 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
12055template<
typename Derived>
12057TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
12058 UnaryExprOrTypeTraitExpr *
E) {
12059 if (
E->isArgumentType()) {
12060 TypeSourceInfo *OldT =
E->getArgumentTypeInfo();
12062 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12066 if (!getDerived().AlwaysRebuild() && OldT == NewT)
12069 return getDerived().RebuildUnaryExprOrTypeTrait(NewT,
E->getOperatorLoc(),
12083 TypeSourceInfo *RecoveryTSI =
nullptr;
12085 auto *PE = dyn_cast<ParenExpr>(
E->getArgumentExpr());
12087 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
12088 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
12089 PE, DRE,
false, &RecoveryTSI);
12091 SubExpr = getDerived().TransformExpr(
E->getArgumentExpr());
12094 return getDerived().RebuildUnaryExprOrTypeTrait(
12096 }
else if (SubExpr.isInvalid())
12099 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getArgumentExpr())
12102 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
12103 E->getOperatorLoc(),
12108template<
typename Derived>
12110TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *
E) {
12111 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12112 if (LHS.isInvalid())
12115 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
12116 if (RHS.isInvalid())
12120 if (!getDerived().AlwaysRebuild() &&
12121 LHS.get() ==
E->getLHS() &&
12122 RHS.get() ==
E->getRHS())
12125 return getDerived().RebuildArraySubscriptExpr(
12127 E->getLHS()->
getBeginLoc(), RHS.get(),
E->getRBracketLoc());
12130template <
typename Derived>
12132TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *
E) {
12134 if (
Base.isInvalid())
12137 ExprResult RowIdx = getDerived().TransformExpr(
E->getRowIdx());
12138 if (RowIdx.isInvalid())
12141 ExprResult ColumnIdx = getDerived().TransformExpr(
E->getColumnIdx());
12142 if (ColumnIdx.isInvalid())
12145 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
12146 RowIdx.get() ==
E->getRowIdx() && ColumnIdx.get() ==
E->getColumnIdx())
12149 return getDerived().RebuildMatrixSubscriptExpr(
12150 Base.get(), RowIdx.get(), ColumnIdx.get(),
E->getRBracketLoc());
12153template <
typename Derived>
12155TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *
E) {
12157 if (
Base.isInvalid())
12161 if (
E->getLowerBound()) {
12162 LowerBound = getDerived().TransformExpr(
E->getLowerBound());
12163 if (LowerBound.isInvalid())
12168 if (
E->getLength()) {
12169 Length = getDerived().TransformExpr(
E->getLength());
12170 if (Length.isInvalid())
12175 if (
E->isOMPArraySection()) {
12176 if (Expr *Str =
E->getStride()) {
12177 Stride = getDerived().TransformExpr(Str);
12178 if (Stride.isInvalid())
12183 if (!getDerived().AlwaysRebuild() &&
Base.get() ==
E->getBase() &&
12184 LowerBound.get() ==
E->getLowerBound() &&
12185 Length.get() ==
E->getLength() &&
12186 (
E->isOpenACCArraySection() || Stride.get() ==
E->getStride()))
12189 return getDerived().RebuildArraySectionExpr(
12191 LowerBound.get(),
E->getColonLocFirst(),
12192 E->isOMPArraySection() ?
E->getColonLocSecond() : SourceLocation{},
12193 Length.get(), Stride.get(),
E->getRBracketLoc());
12196template <
typename Derived>
12198TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *
E) {
12200 if (
Base.isInvalid())
12204 bool ErrorFound =
false;
12205 for (Expr *Dim :
E->getDimensions()) {
12206 ExprResult DimRes = getDerived().TransformExpr(Dim);
12207 if (DimRes.isInvalid()) {
12211 Dims.push_back(DimRes.get());
12216 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(),
E->getLParenLoc(),
12217 E->getRParenLoc(), Dims,
12218 E->getBracketsRanges());
12221template <
typename Derived>
12223TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *
E) {
12224 unsigned NumIterators =
E->numOfIterators();
12227 bool ErrorFound =
false;
12228 bool NeedToRebuild = getDerived().AlwaysRebuild();
12229 for (
unsigned I = 0; I < NumIterators; ++I) {
12230 auto *
D = cast<VarDecl>(
E->getIteratorDecl(I));
12231 Data[I].DeclIdent =
D->getIdentifier();
12235 "Implicit type must be int.");
12237 TypeSourceInfo *TSI = getDerived().TransformType(
D->getTypeSourceInfo());
12238 QualType
DeclTy = getDerived().TransformType(
D->getType());
12241 OMPIteratorExpr::IteratorRange
Range =
E->getIteratorRange(I);
12245 ErrorFound = ErrorFound ||
12246 !(!
D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
12247 !
Data[I].Type.get().isNull())) ||
12252 Data[I].Range.End = End.get();
12253 Data[I].Range.Step = Step.get();
12254 Data[I].AssignLoc =
E->getAssignLoc(I);
12255 Data[I].ColonLoc =
E->getColonLoc(I);
12256 Data[I].SecColonLoc =
E->getSecondColonLoc(I);
12259 (
D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
12260 D->getType().getTypePtrOrNull()) ||
12266 if (!NeedToRebuild)
12269 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
12270 E->getIteratorKwLoc(),
E->getLParenLoc(),
E->getRParenLoc(),
Data);
12271 if (!Res.isUsable())
12273 auto *IE = cast<OMPIteratorExpr>(Res.get());
12274 for (
unsigned I = 0; I < NumIterators; ++I)
12275 getDerived().transformedLocalDecl(
E->getIteratorDecl(I),
12276 IE->getIteratorDecl(I));
12280template<
typename Derived>
12282TreeTransform<Derived>::TransformCallExpr(CallExpr *
E) {
12289 bool ArgChanged =
false;
12291 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
12295 if (!getDerived().AlwaysRebuild() &&
12296 Callee.get() ==
E->getCallee() &&
12301 SourceLocation FakeLParenLoc
12304 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12305 if (
E->hasStoredFPFeatures()) {
12306 FPOptionsOverride NewOverrides =
E->getFPFeatures();
12307 getSema().CurFPFeatures =
12308 NewOverrides.applyOverrides(getSema().getLangOpts());
12309 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12312 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
12314 E->getRParenLoc());
12317template<
typename Derived>
12319TreeTransform<Derived>::TransformMemberExpr(MemberExpr *
E) {
12321 if (
Base.isInvalid())
12324 NestedNameSpecifierLoc QualifierLoc;
12325 if (
E->hasQualifier()) {
12327 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
12332 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
12335 = cast_or_null<ValueDecl>(getDerived().TransformDecl(
E->getMemberLoc(),
12336 E->getMemberDecl()));
12340 NamedDecl *FoundDecl =
E->getFoundDecl();
12341 if (FoundDecl ==
E->getMemberDecl()) {
12344 FoundDecl = cast_or_null<NamedDecl>(
12345 getDerived().TransformDecl(
E->getMemberLoc(), FoundDecl));
12350 if (!getDerived().AlwaysRebuild() &&
12351 Base.get() ==
E->getBase() &&
12352 QualifierLoc ==
E->getQualifierLoc() &&
12353 Member ==
E->getMemberDecl() &&
12354 FoundDecl ==
E->getFoundDecl() &&
12355 !
E->hasExplicitTemplateArgs()) {
12359 if (!(isa<CXXThisExpr>(
E->getBase()) &&
12360 getSema().OpenMP().isOpenMPRebuildMemberExpr(
12361 cast<ValueDecl>(
Member)))) {
12369 TemplateArgumentListInfo TransArgs;
12370 if (
E->hasExplicitTemplateArgs()) {
12371 TransArgs.setLAngleLoc(
E->getLAngleLoc());
12372 TransArgs.setRAngleLoc(
E->getRAngleLoc());
12373 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
12374 E->getNumTemplateArgs(),
12380 SourceLocation FakeOperatorLoc =
12387 NamedDecl *FirstQualifierInScope =
nullptr;
12388 DeclarationNameInfo MemberNameInfo =
E->getMemberNameInfo();
12389 if (MemberNameInfo.getName()) {
12390 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
12391 if (!MemberNameInfo.getName())
12395 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
12402 (
E->hasExplicitTemplateArgs()
12403 ? &TransArgs :
nullptr),
12404 FirstQualifierInScope);
12407template<
typename Derived>
12409TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *
E) {
12410 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12411 if (LHS.isInvalid())
12415 getDerived().TransformInitializer(
E->getRHS(),
false);
12416 if (RHS.isInvalid())
12419 if (!getDerived().AlwaysRebuild() &&
12420 LHS.get() ==
E->getLHS() &&
12421 RHS.get() ==
E->getRHS())
12424 if (
E->isCompoundAssignmentOp())
12426 return getDerived().RebuildBinaryOperator(
12427 E->getOperatorLoc(),
E->getOpcode(), LHS.get(), RHS.get());
12428 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12429 FPOptionsOverride NewOverrides(
E->getFPFeatures());
12430 getSema().CurFPFeatures =
12431 NewOverrides.applyOverrides(getSema().getLangOpts());
12432 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12433 return getDerived().RebuildBinaryOperator(
E->getOperatorLoc(),
E->getOpcode(),
12434 LHS.get(), RHS.get());
12437template <
typename Derived>
12438ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
12439 CXXRewrittenBinaryOperator *
E) {
12440 CXXRewrittenBinaryOperator::DecomposedForm Decomp =
E->getDecomposedForm();
12442 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
12443 if (LHS.isInvalid())
12446 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
12447 if (RHS.isInvalid())
12452 UnresolvedSet<2> UnqualLookups;
12453 bool ChangedAnyLookups =
false;
12454 Expr *PossibleBinOps[] = {
E->getSemanticForm(),
12455 const_cast<Expr *
>(Decomp.InnerBinOp)};
12456 for (Expr *PossibleBinOp : PossibleBinOps) {
12457 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
12460 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
12461 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
12466 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
12467 E->getOperatorLoc(),
Callee->getFoundDecl()));
12471 ChangedAnyLookups =
true;
12472 UnqualLookups.addDecl(
Found);
12475 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
12476 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
12482 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
12487 return getDerived().RebuildCXXRewrittenBinaryOperator(
12488 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
12491template<
typename Derived>
12493TreeTransform<Derived>::TransformCompoundAssignOperator(
12494 CompoundAssignOperator *
E) {
12495 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12496 FPOptionsOverride NewOverrides(
E->getFPFeatures());
12497 getSema().CurFPFeatures =
12498 NewOverrides.applyOverrides(getSema().getLangOpts());
12499 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12500 return getDerived().TransformBinaryOperator(
E);
12503template<
typename Derived>
12505TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
12509 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
12510 if (commonExpr.isInvalid())
12513 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
12514 if (rhs.isInvalid())
12517 if (!getDerived().AlwaysRebuild() &&
12518 commonExpr.get() == e->getCommon() &&
12519 rhs.get() == e->getFalseExpr())
12522 return getDerived().RebuildConditionalOperator(commonExpr.get(),
12523 e->getQuestionLoc(),
12529template<
typename Derived>
12531TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *
E) {
12532 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
12533 if (Cond.isInvalid())
12536 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12537 if (LHS.isInvalid())
12540 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
12541 if (RHS.isInvalid())
12544 if (!getDerived().AlwaysRebuild() &&
12545 Cond.get() ==
E->getCond() &&
12546 LHS.get() ==
E->getLHS() &&
12547 RHS.get() ==
E->getRHS())
12550 return getDerived().RebuildConditionalOperator(Cond.get(),
12551 E->getQuestionLoc(),
12557template<
typename Derived>
12559TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *
E) {
12562 return getDerived().TransformExpr(
E->getSubExprAsWritten());
12565template<
typename Derived>
12567TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *
E) {
12568 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeInfoAsWritten());
12573 = getDerived().TransformExpr(
E->getSubExprAsWritten());
12574 if (SubExpr.isInvalid())
12577 if (!getDerived().AlwaysRebuild() &&
12578 Type ==
E->getTypeInfoAsWritten() &&
12579 SubExpr.get() ==
E->getSubExpr())
12582 return getDerived().RebuildCStyleCastExpr(
E->getLParenLoc(),
12588template<
typename Derived>
12590TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *
E) {
12591 TypeSourceInfo *OldT =
E->getTypeSourceInfo();
12592 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12597 if (
Init.isInvalid())
12600 if (!getDerived().AlwaysRebuild() &&
12602 Init.get() ==
E->getInitializer())
12609 return getDerived().RebuildCompoundLiteralExpr(
12610 E->getLParenLoc(), NewT,
12614template<
typename Derived>
12616TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *
E) {
12618 if (
Base.isInvalid())
12621 if (!getDerived().AlwaysRebuild() &&
12622 Base.get() ==
E->getBase())
12626 SourceLocation FakeOperatorLoc =
12628 return getDerived().RebuildExtVectorElementExpr(
12629 Base.get(), FakeOperatorLoc,
E->isArrow(),
E->getAccessorLoc(),
12633template<
typename Derived>
12635TreeTransform<Derived>::TransformInitListExpr(InitListExpr *
E) {
12636 if (InitListExpr *Syntactic =
E->getSyntacticForm())
12639 bool InitChanged =
false;
12641 EnterExpressionEvaluationContext Context(
12645 if (getDerived().TransformExprs(
E->getInits(),
E->getNumInits(),
false,
12646 Inits, &InitChanged))
12649 if (!getDerived().AlwaysRebuild() && !InitChanged) {
12656 return getDerived().RebuildInitList(
E->getLBraceLoc(), Inits,
12657 E->getRBraceLoc());
12660template<
typename Derived>
12662TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *
E) {
12667 if (
Init.isInvalid())
12672 bool ExprChanged =
false;
12673 for (
const DesignatedInitExpr::Designator &
D :
E->designators()) {
12674 if (
D.isFieldDesignator()) {
12675 if (
D.getFieldDecl()) {
12676 FieldDecl *
Field = cast_or_null<FieldDecl>(
12677 getDerived().TransformDecl(
D.getFieldLoc(),
D.getFieldDecl()));
12678 if (Field !=
D.getFieldDecl())
12681 ExprChanged =
true;
12682 if (
Field->isAnonymousStructOrUnion())
12688 ExprChanged =
true;
12691 D.getFieldName(),
D.getDotLoc(),
D.getFieldLoc()));
12695 if (
D.isArrayDesignator()) {
12696 ExprResult Index = getDerived().TransformExpr(
E->getArrayIndex(
D));
12697 if (Index.isInvalid())
12700 Desig.AddDesignator(
12703 ExprChanged = ExprChanged ||
Init.get() !=
E->getArrayIndex(
D);
12704 ArrayExprs.push_back(Index.get());
12708 assert(
D.isArrayRangeDesignator() &&
"New kind of designator?");
12710 = getDerived().TransformExpr(
E->getArrayRangeStart(
D));
12711 if (Start.isInvalid())
12714 ExprResult End = getDerived().TransformExpr(
E->getArrayRangeEnd(
D));
12715 if (End.isInvalid())
12719 Start.get(), End.get(),
D.getLBracketLoc(),
D.getEllipsisLoc()));
12721 ExprChanged = ExprChanged || Start.get() !=
E->getArrayRangeStart(
D) ||
12722 End.get() !=
E->getArrayRangeEnd(
D);
12724 ArrayExprs.push_back(Start.get());
12725 ArrayExprs.push_back(End.get());
12728 if (!getDerived().AlwaysRebuild() &&
12729 Init.get() ==
E->getInit() &&
12733 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
12734 E->getEqualOrColonLoc(),
12735 E->usesGNUSyntax(),
Init.get());
12740template<
typename Derived>
12742TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
12743 DesignatedInitUpdateExpr *
E) {
12744 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
12749template<
typename Derived>
12751TreeTransform<Derived>::TransformNoInitExpr(
12753 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
12757template<
typename Derived>
12759TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *
E) {
12760 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
12764template<
typename Derived>
12766TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *
E) {
12767 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
12771template<
typename Derived>
12773TreeTransform<Derived>::TransformImplicitValueInitExpr(
12774 ImplicitValueInitExpr *
E) {
12775 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
12779 QualType
T = getDerived().TransformType(
E->
getType());
12783 if (!getDerived().AlwaysRebuild() &&
12787 return getDerived().RebuildImplicitValueInitExpr(
T);
12790template<
typename Derived>
12792TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *
E) {
12793 TypeSourceInfo *TInfo = getDerived().TransformType(
E->getWrittenTypeInfo());
12797 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
12798 if (SubExpr.isInvalid())
12801 if (!getDerived().AlwaysRebuild() &&
12802 TInfo ==
E->getWrittenTypeInfo() &&
12803 SubExpr.get() ==
E->getSubExpr())
12806 return getDerived().RebuildVAArgExpr(
E->getBuiltinLoc(), SubExpr.get(),
12807 TInfo,
E->getRParenLoc());
12810template<
typename Derived>
12812TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *
E) {
12813 bool ArgumentChanged =
false;
12815 if (TransformExprs(
E->getExprs(),
E->getNumExprs(),
true, Inits,
12819 return getDerived().RebuildParenListExpr(
E->getLParenLoc(),
12821 E->getRParenLoc());
12829template<
typename Derived>
12831TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *
E) {
12832 Decl *LD = getDerived().TransformDecl(
E->getLabel()->getLocation(),
12837 return getDerived().RebuildAddrLabelExpr(
E->getAmpAmpLoc(),
E->getLabelLoc(),
12838 cast<LabelDecl>(LD));
12841template<
typename Derived>
12843TreeTransform<Derived>::TransformStmtExpr(StmtExpr *
E) {
12846 = getDerived().TransformCompoundStmt(
E->getSubStmt(),
true);
12847 if (SubStmt.isInvalid()) {
12852 unsigned OldDepth =
E->getTemplateDepth();
12853 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
12855 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
12856 SubStmt.get() ==
E->getSubStmt()) {
12862 return getDerived().RebuildStmtExpr(
E->getLParenLoc(), SubStmt.get(),
12863 E->getRParenLoc(), NewDepth);
12866template<
typename Derived>
12868TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *
E) {
12869 ExprResult Cond = getDerived().TransformExpr(
E->getCond());
12870 if (Cond.isInvalid())
12873 ExprResult LHS = getDerived().TransformExpr(
E->getLHS());
12874 if (LHS.isInvalid())
12877 ExprResult RHS = getDerived().TransformExpr(
E->getRHS());
12878 if (RHS.isInvalid())
12881 if (!getDerived().AlwaysRebuild() &&
12882 Cond.get() ==
E->getCond() &&
12883 LHS.get() ==
E->getLHS() &&
12884 RHS.get() ==
E->getRHS())
12887 return getDerived().RebuildChooseExpr(
E->getBuiltinLoc(),
12888 Cond.get(), LHS.get(), RHS.get(),
12889 E->getRParenLoc());
12892template<
typename Derived>
12894TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *
E) {
12898template<
typename Derived>
12900TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *
E) {
12901 switch (
E->getOperator()) {
12905 case OO_Array_Delete:
12906 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
12911 assert(
E->getNumArgs() >= 1 &&
"Object call is missing arguments");
12920 static_cast<Expr *
>(
Object.get())->getEndLoc());
12924 if (getDerived().TransformExprs(
E->getArgs() + 1,
E->getNumArgs() - 1,
true,
12928 if (
E->getOperator() == OO_Subscript)
12929 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
12932 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
12936#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
12940#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
12941#include "clang/Basic/OperatorKinds.def"
12943 case OO_Conditional:
12944 llvm_unreachable(
"conditional operator is not actually overloadable");
12948 llvm_unreachable(
"not an overloaded operator?");
12952 if (
E->getNumArgs() == 1 &&
E->getOperator() == OO_Amp)
12953 First = getDerived().TransformAddressOfOperand(
E->getArg(0));
12955 First = getDerived().TransformExpr(
E->getArg(0));
12956 if (
First.isInvalid())
12960 if (
E->getNumArgs() == 2) {
12962 getDerived().TransformInitializer(
E->getArg(1),
false);
12963 if (Second.isInvalid())
12967 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12968 FPOptionsOverride NewOverrides(
E->getFPFeatures());
12969 getSema().CurFPFeatures =
12970 NewOverrides.applyOverrides(getSema().getLangOpts());
12971 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12973 Expr *
Callee =
E->getCallee();
12974 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
12975 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
12977 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
12980 return getDerived().RebuildCXXOperatorCallExpr(
12981 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
12982 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
12985 UnresolvedSet<1> Functions;
12986 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
12987 Callee = ICE->getSubExprAsWritten();
12988 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
12989 ValueDecl *VD = cast_or_null<ValueDecl>(
12990 getDerived().TransformDecl(DR->getLocation(), DR));
12994 if (!isa<CXXMethodDecl>(VD))
12995 Functions.addDecl(VD);
12997 return getDerived().RebuildCXXOperatorCallExpr(
12998 E->getOperator(),
E->getOperatorLoc(),
Callee->getBeginLoc(),
12999 false, Functions,
First.get(), Second.get());
13002template<
typename Derived>
13004TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *
E) {
13005 return getDerived().TransformCallExpr(
E);
13008template <
typename Derived>
13009ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *
E) {
13011 getSema().CurContext !=
E->getParentContext();
13013 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
13016 return getDerived().RebuildSourceLocExpr(
E->getIdentKind(),
E->
getType(),
13018 getSema().CurContext);
13021template <
typename Derived>
13022ExprResult TreeTransform<Derived>::TransformEmbedExpr(EmbedExpr *
E) {
13026template<
typename Derived>
13028TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *
E) {
13035 ExprResult EC = getDerived().TransformCallExpr(
E->getConfig());
13036 if (EC.isInvalid())
13040 bool ArgChanged =
false;
13042 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
13046 if (!getDerived().AlwaysRebuild() &&
13047 Callee.get() ==
E->getCallee() &&
13052 SourceLocation FakeLParenLoc
13054 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13056 E->getRParenLoc(), EC.get());
13059template<
typename Derived>
13067 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13071 if (!getDerived().AlwaysRebuild() &&
13072 Type ==
E->getTypeInfoAsWritten() &&
13073 SubExpr.
get() ==
E->getSubExpr())
13075 return getDerived().RebuildCXXNamedCastExpr(
13076 E->getOperatorLoc(),
E->
getStmtClass(),
E->getAngleBrackets().getBegin(),
13077 Type,
E->getAngleBrackets().getEnd(),
13079 E->getAngleBrackets().getEnd(), SubExpr.
get(),
E->getRParenLoc());
13082template<
typename Derived>
13091 if (Sub.isInvalid())
13094 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
13098template<
typename Derived>
13100TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *
E) {
13101 return getDerived().TransformCXXNamedCastExpr(
E);
13104template<
typename Derived>
13106TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *
E) {
13107 return getDerived().TransformCXXNamedCastExpr(
E);
13110template<
typename Derived>
13112TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
13113 CXXReinterpretCastExpr *
E) {
13114 return getDerived().TransformCXXNamedCastExpr(
E);
13117template<
typename Derived>
13119TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *
E) {
13120 return getDerived().TransformCXXNamedCastExpr(
E);
13123template<
typename Derived>
13125TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *
E) {
13126 return getDerived().TransformCXXNamedCastExpr(
E);
13129template<
typename Derived>
13131TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
13132 CXXFunctionalCastExpr *
E) {
13133 TypeSourceInfo *
Type =
13134 getDerived().TransformTypeWithDeducedTST(
E->getTypeInfoAsWritten());
13139 = getDerived().TransformExpr(
E->getSubExprAsWritten());
13140 if (SubExpr.isInvalid())
13143 if (!getDerived().AlwaysRebuild() &&
13144 Type ==
E->getTypeInfoAsWritten() &&
13145 SubExpr.get() ==
E->getSubExpr())
13148 return getDerived().RebuildCXXFunctionalCastExpr(Type,
13152 E->isListInitialization());
13155template<
typename Derived>
13157TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *
E) {
13158 if (
E->isTypeOperand()) {
13159 TypeSourceInfo *TInfo
13160 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
13164 if (!getDerived().AlwaysRebuild() &&
13165 TInfo ==
E->getTypeOperandSourceInfo())
13175 Expr *Op =
E->getExprOperand();
13178 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
13179 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
13182 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
13185 ExprResult SubExpr = getDerived().TransformExpr(Op);
13186 if (SubExpr.isInvalid())
13189 if (!getDerived().AlwaysRebuild() &&
13190 SubExpr.get() ==
E->getExprOperand())
13197template<
typename Derived>
13199TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *
E) {
13200 if (
E->isTypeOperand()) {
13201 TypeSourceInfo *TInfo
13202 = getDerived().TransformType(
E->getTypeOperandSourceInfo());
13206 if (!getDerived().AlwaysRebuild() &&
13207 TInfo ==
E->getTypeOperandSourceInfo())
13217 ExprResult SubExpr = getDerived().TransformExpr(
E->getExprOperand());
13218 if (SubExpr.isInvalid())
13221 if (!getDerived().AlwaysRebuild() &&
13222 SubExpr.get() ==
E->getExprOperand())
13229template<
typename Derived>
13231TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *
E) {
13235template<
typename Derived>
13237TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
13238 CXXNullPtrLiteralExpr *
E) {
13242template<
typename Derived>
13244TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *
E) {
13255 QualType
T = [&]() {
13256 auto &S = getSema();
13257 if (
E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
13260 return getDerived().TransformType(
E->
getType());
13264 if (!getDerived().AlwaysRebuild() &&
T ==
E->
getType()) {
13267 getSema().MarkThisReferenced(
E);
13271 return getDerived().RebuildCXXThisExpr(
E->
getBeginLoc(),
T,
E->isImplicit());
13274template<
typename Derived>
13276TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *
E) {
13277 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
13278 if (SubExpr.isInvalid())
13281 if (!getDerived().AlwaysRebuild() &&
13282 SubExpr.get() ==
E->getSubExpr())
13285 return getDerived().RebuildCXXThrowExpr(
E->getThrowLoc(), SubExpr.get(),
13286 E->isThrownVariableInScope());
13289template<
typename Derived>
13291TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *
E) {
13292 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
13293 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getParam()));
13298 if (
E->hasRewrittenInit()) {
13299 InitRes = getDerived().TransformExpr(
E->getRewrittenExpr());
13300 if (InitRes.isInvalid())
13304 if (!getDerived().AlwaysRebuild() && Param ==
E->getParam() &&
13306 InitRes.get() ==
E->getRewrittenExpr())
13309 return getDerived().RebuildCXXDefaultArgExpr(
E->getUsedLocation(), Param,
13313template<
typename Derived>
13315TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *
E) {
13316 FieldDecl *
Field = cast_or_null<FieldDecl>(
13317 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getField()));
13321 if (!getDerived().AlwaysRebuild() && Field ==
E->getField() &&
13325 return getDerived().RebuildCXXDefaultInitExpr(
E->
getExprLoc(), Field);
13328template<
typename Derived>
13330TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
13331 CXXScalarValueInitExpr *
E) {
13332 TypeSourceInfo *
T = getDerived().TransformType(
E->getTypeSourceInfo());
13336 if (!getDerived().AlwaysRebuild() &&
13337 T ==
E->getTypeSourceInfo())
13340 return getDerived().RebuildCXXScalarValueInitExpr(
T,
13341 T->getTypeLoc().getEndLoc(),
13342 E->getRParenLoc());
13345template<
typename Derived>
13347TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *
E) {
13349 TypeSourceInfo *AllocTypeInfo =
13350 getDerived().TransformTypeWithDeducedTST(
E->getAllocatedTypeSourceInfo());
13351 if (!AllocTypeInfo)
13355 std::optional<Expr *> ArraySize;
13356 if (
E->isArray()) {
13358 if (std::optional<Expr *> OldArraySize =
E->getArraySize()) {
13359 NewArraySize = getDerived().TransformExpr(*OldArraySize);
13360 if (NewArraySize.isInvalid())
13363 ArraySize = NewArraySize.get();
13367 bool ArgumentChanged =
false;
13369 if (getDerived().TransformExprs(
E->getPlacementArgs(),
13370 E->getNumPlacementArgs(),
true,
13371 PlacementArgs, &ArgumentChanged))
13375 Expr *OldInit =
E->getInitializer();
13378 NewInit = getDerived().TransformInitializer(OldInit,
true);
13379 if (NewInit.isInvalid())
13383 FunctionDecl *OperatorNew =
nullptr;
13384 if (
E->getOperatorNew()) {
13385 OperatorNew = cast_or_null<FunctionDecl>(
13386 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorNew()));
13391 FunctionDecl *OperatorDelete =
nullptr;
13392 if (
E->getOperatorDelete()) {
13393 OperatorDelete = cast_or_null<FunctionDecl>(
13394 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
13395 if (!OperatorDelete)
13399 if (!getDerived().AlwaysRebuild() &&
13400 AllocTypeInfo ==
E->getAllocatedTypeSourceInfo() &&
13401 ArraySize ==
E->getArraySize() &&
13402 NewInit.get() == OldInit &&
13403 OperatorNew ==
E->getOperatorNew() &&
13404 OperatorDelete ==
E->getOperatorDelete() &&
13405 !ArgumentChanged) {
13410 if (OperatorDelete)
13413 if (
E->isArray() && !
E->getAllocatedType()->isDependentType()) {
13414 QualType ElementType
13416 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
13417 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
13427 QualType AllocType = AllocTypeInfo->
getType();
13437 }
else if (
const ConstantArrayType *ConsArrayT
13438 = dyn_cast<ConstantArrayType>(ArrayT)) {
13442 AllocType = ConsArrayT->getElementType();
13443 }
else if (
const DependentSizedArrayType *DepArrayT
13444 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
13445 if (DepArrayT->getSizeExpr()) {
13446 ArraySize = DepArrayT->getSizeExpr();
13447 AllocType = DepArrayT->getElementType();
13452 return getDerived().RebuildCXXNewExpr(
13456 AllocTypeInfo, ArraySize,
E->getDirectInitRange(), NewInit.get());
13459template<
typename Derived>
13461TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *
E) {
13467 FunctionDecl *OperatorDelete =
nullptr;
13468 if (
E->getOperatorDelete()) {
13469 OperatorDelete = cast_or_null<FunctionDecl>(
13470 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getOperatorDelete()));
13471 if (!OperatorDelete)
13475 if (!getDerived().AlwaysRebuild() &&
13476 Operand.get() ==
E->getArgument() &&
13477 OperatorDelete ==
E->getOperatorDelete()) {
13480 if (OperatorDelete)
13485 E->getDestroyedType());
13486 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
13487 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
13496 return getDerived().RebuildCXXDeleteExpr(
13500template<
typename Derived>
13502TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
13503 CXXPseudoDestructorExpr *
E) {
13505 if (
Base.isInvalid())
13509 bool MayBePseudoDestructor =
false;
13511 E->getOperatorLoc(),
13512 E->isArrow()? tok::arrow : tok::period,
13514 MayBePseudoDestructor);
13515 if (
Base.isInvalid())
13518 QualType ObjectType = ObjectTypePtr.get();
13519 NestedNameSpecifierLoc QualifierLoc =
E->getQualifierLoc();
13520 if (QualifierLoc) {
13522 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
13527 SS.Adopt(QualifierLoc);
13529 PseudoDestructorTypeStorage Destroyed;
13530 if (
E->getDestroyedTypeInfo()) {
13531 TypeSourceInfo *DestroyedTypeInfo
13532 = getDerived().TransformTypeInObjectScope(
E->getDestroyedTypeInfo(),
13533 ObjectType,
nullptr, SS);
13534 if (!DestroyedTypeInfo)
13536 Destroyed = DestroyedTypeInfo;
13537 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
13540 Destroyed = PseudoDestructorTypeStorage(
E->getDestroyedTypeIdentifier(),
13541 E->getDestroyedTypeLoc());
13545 *
E->getDestroyedTypeIdentifier(),
E->getDestroyedTypeLoc(),
13546 nullptr, SS, ObjectTypePtr,
false);
13552 E->getDestroyedTypeLoc());
13555 TypeSourceInfo *ScopeTypeInfo =
nullptr;
13556 if (
E->getScopeTypeInfo()) {
13557 CXXScopeSpec EmptySS;
13558 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
13559 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
13560 if (!ScopeTypeInfo)
13564 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
13565 E->getOperatorLoc(),
13569 E->getColonColonLoc(),
13574template <
typename Derived>
13579 bool AllEmptyPacks =
true;
13580 for (
auto *OldD : Old->
decls()) {
13581 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
13585 if (isa<UsingShadowDecl>(OldD))
13594 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
13596 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
13597 Decls = UPD->expansions();
13600 for (
auto *
D : Decls) {
13601 if (
auto *UD = dyn_cast<UsingDecl>(
D)) {
13602 for (
auto *SD : UD->shadows())
13609 AllEmptyPacks &= Decls.empty();
13618 if (AllEmptyPacks && !RequiresADL) {
13619 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
13620 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
13630 getSema().FilterAcceptableTemplateNames(R,
13637 diag::err_template_kw_refers_to_non_template)
13641 diag::note_template_kw_refers_to_non_template)
13650template <
typename Derived>
13653 return TransformUnresolvedLookupExpr(Old,
false);
13656template <
typename Derived>
13659 bool IsAddressOfOperand) {
13664 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
13671 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
13675 SS.
Adopt(QualifierLoc);
13679 CXXRecordDecl *NamingClass
13680 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
13683 if (!NamingClass) {
13688 R.setNamingClass(NamingClass);
13709 SS, TemplateKWLoc, R,
13716 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
13719 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
13723template<
typename Derived>
13725TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *
E) {
13726 bool ArgChanged =
false;
13728 for (
unsigned I = 0, N =
E->getNumArgs(); I != N; ++I) {
13729 TypeSourceInfo *From =
E->getArg(I);
13730 TypeLoc FromTL = From->getTypeLoc();
13731 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
13732 TypeLocBuilder TLB;
13733 TLB.reserve(FromTL.getFullDataSize());
13734 QualType To = getDerived().TransformType(TLB, FromTL);
13738 if (To == From->getType())
13739 Args.push_back(From);
13741 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13750 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
13751 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
13757 bool Expand =
true;
13758 bool RetainExpansion =
false;
13759 std::optional<unsigned> OrigNumExpansions =
13760 ExpansionTL.getTypePtr()->getNumExpansions();
13761 std::optional<unsigned> NumExpansions = OrigNumExpansions;
13762 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
13763 PatternTL.getSourceRange(),
13765 Expand, RetainExpansion,
13773 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
13775 TypeLocBuilder TLB;
13776 TLB.reserve(From->getTypeLoc().getFullDataSize());
13778 QualType To = getDerived().TransformType(TLB, PatternTL);
13782 To = getDerived().RebuildPackExpansionType(To,
13783 PatternTL.getSourceRange(),
13784 ExpansionTL.getEllipsisLoc(),
13789 PackExpansionTypeLoc ToExpansionTL
13790 = TLB.push<PackExpansionTypeLoc>(To);
13791 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13792 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13798 for (
unsigned I = 0; I != *NumExpansions; ++I) {
13799 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
13800 TypeLocBuilder TLB;
13801 TLB.reserve(PatternTL.getFullDataSize());
13802 QualType To = getDerived().TransformType(TLB, PatternTL);
13806 if (To->containsUnexpandedParameterPack()) {
13807 To = getDerived().RebuildPackExpansionType(To,
13808 PatternTL.getSourceRange(),
13809 ExpansionTL.getEllipsisLoc(),
13814 PackExpansionTypeLoc ToExpansionTL
13815 = TLB.push<PackExpansionTypeLoc>(To);
13816 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13819 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13822 if (!RetainExpansion)
13827 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
13829 TypeLocBuilder TLB;
13830 TLB.reserve(From->getTypeLoc().getFullDataSize());
13832 QualType To = getDerived().TransformType(TLB, PatternTL);
13836 To = getDerived().RebuildPackExpansionType(To,
13837 PatternTL.getSourceRange(),
13838 ExpansionTL.getEllipsisLoc(),
13843 PackExpansionTypeLoc ToExpansionTL
13844 = TLB.push<PackExpansionTypeLoc>(To);
13845 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13846 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13849 if (!getDerived().AlwaysRebuild() && !ArgChanged)
13852 return getDerived().RebuildTypeTrait(
E->getTrait(),
E->
getBeginLoc(), Args,
13856template<
typename Derived>
13858TreeTransform<Derived>::TransformConceptSpecializationExpr(
13859 ConceptSpecializationExpr *
E) {
13860 const ASTTemplateArgumentListInfo *Old =
E->getTemplateArgsAsWritten();
13861 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
13862 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
13863 Old->NumTemplateArgs, TransArgs))
13866 return getDerived().RebuildConceptSpecializationExpr(
13867 E->getNestedNameSpecifierLoc(),
E->getTemplateKWLoc(),
13868 E->getConceptNameInfo(),
E->getFoundDecl(),
E->getNamedConcept(),
13872template<
typename Derived>
13874TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *
E) {
13877 Sema::ExtParameterInfoBuilder ExtParamInfos;
13881 EnterExpressionEvaluationContext Ctx(
13886 getSema().Context, getSema().CurContext,
13889 Sema::ContextRAII SavedContext(getSema(), Body,
false);
13891 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
13892 E->getRequiresKWLoc(),
E->getRBraceLoc(),
E, Body,
13893 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
13895 for (ParmVarDecl *Param : TransParams)
13897 Param->setDeclContext(Body);
13903 if (!TypeParamResult.isUnset())
13904 return TypeParamResult;
13907 if (getDerived().TransformRequiresExprRequirements(
E->getRequirements(),
13911 for (concepts::Requirement *Req : TransReqs) {
13912 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
13913 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
13914 ER->getReturnTypeRequirement()
13915 .getTypeConstraintTemplateParameterList()->getParam(0)
13916 ->setDeclContext(Body);
13921 return getDerived().RebuildRequiresExpr(
13922 E->getRequiresKWLoc(), Body,
E->getLParenLoc(), TransParams,
13923 E->getRParenLoc(), TransReqs,
E->getRBraceLoc());
13926template<
typename Derived>
13932 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
13933 TransReq = getDerived().TransformTypeRequirement(TypeReq);
13934 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
13935 TransReq = getDerived().TransformExprRequirement(ExprReq);
13937 TransReq = getDerived().TransformNestedRequirement(
13938 cast<concepts::NestedRequirement>(Req));
13941 Transformed.push_back(TransReq);
13946template<
typename Derived>
13951 if (getDerived().AlwaysRebuild())
13952 return getDerived().RebuildTypeRequirement(
13959 return getDerived().RebuildTypeRequirement(TransType);
13962template<
typename Derived>
13965 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
13974 TransExpr = TransExprRes.
get();
13977 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
13979 if (RetReq.isEmpty())
13980 TransRetReq.emplace();
13981 else if (RetReq.isSubstitutionFailure())
13982 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
13983 else if (RetReq.isTypeConstraint()) {
13985 RetReq.getTypeConstraintTemplateParameterList();
13987 getDerived().TransformTemplateParameterList(OrigTPL);
13990 TransRetReq.emplace(TPL);
13992 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
13993 if (
Expr *
E = TransExpr.dyn_cast<
Expr *>())
13994 return getDerived().RebuildExprRequirement(
E, Req->
isSimple(),
13996 std::move(*TransRetReq));
13997 return getDerived().RebuildExprRequirement(
14002template<
typename Derived>
14007 if (getDerived().AlwaysRebuild())
14008 return getDerived().RebuildNestedRequirement(
14016 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
14019template<
typename Derived>
14022 TypeSourceInfo *
T = getDerived().TransformType(
E->getQueriedTypeSourceInfo());
14026 if (!getDerived().AlwaysRebuild() &&
14027 T ==
E->getQueriedTypeSourceInfo())
14034 SubExpr = getDerived().TransformExpr(
E->getDimensionExpression());
14038 if (!getDerived().AlwaysRebuild() && SubExpr.
get() ==
E->getDimensionExpression())
14042 return getDerived().RebuildArrayTypeTrait(
E->getTrait(),
E->
getBeginLoc(),
T,
14046template<
typename Derived>
14048TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *
E) {
14053 SubExpr = getDerived().TransformExpr(
E->getQueriedExpression());
14054 if (SubExpr.isInvalid())
14057 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getQueriedExpression())
14061 return getDerived().RebuildExpressionTrait(
E->getTrait(),
E->
getBeginLoc(),
14065template <
typename Derived>
14069 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
14070 DRE, AddrTaken, RecoveryTSI);
14077 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
14079 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
14083template <
typename Derived>
14086 return TransformDependentScopeDeclRefExpr(
E,
false,
14090template <
typename Derived>
14094 assert(
E->getQualifierLoc());
14096 getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc());
14106 getDerived().TransformDeclarationNameInfo(
E->getNameInfo());
14110 if (!
E->hasExplicitTemplateArgs()) {
14111 if (!getDerived().AlwaysRebuild() && QualifierLoc ==
E->getQualifierLoc() &&
14114 NameInfo.
getName() ==
E->getDeclName())
14117 return getDerived().RebuildDependentScopeDeclRefExpr(
14118 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
14119 IsAddressOfOperand, RecoveryTSI);
14122 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
14123 if (getDerived().TransformTemplateArguments(
14124 E->getTemplateArgs(),
E->getNumTemplateArgs(), TransArgs))
14127 return getDerived().RebuildDependentScopeDeclRefExpr(
14128 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
14132template<
typename Derived>
14134TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *
E) {
14138 if (getDerived().AllowSkippingCXXConstructExpr() &&
14139 ((
E->getNumArgs() == 1 ||
14140 (
E->getNumArgs() > 1 && getDerived().DropCallArgument(
E->getArg(1)))) &&
14141 (!getDerived().DropCallArgument(
E->getArg(0))) &&
14142 !
E->isListInitialization()))
14143 return getDerived().TransformInitializer(
E->getArg(0),
14146 TemporaryBase Rebase(*
this,
E->
getBeginLoc(), DeclarationName());
14148 QualType
T = getDerived().TransformType(
E->
getType());
14152 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14153 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14157 bool ArgumentChanged =
false;
14160 EnterExpressionEvaluationContext Context(
14162 E->isListInitialization());
14163 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14168 if (!getDerived().AlwaysRebuild() &&
14170 Constructor ==
E->getConstructor() &&
14171 !ArgumentChanged) {
14178 return getDerived().RebuildCXXConstructExpr(
14180 E->hadMultipleCandidates(),
E->isListInitialization(),
14181 E->isStdInitListInitialization(),
E->requiresZeroInitialization(),
14182 E->getConstructionKind(),
E->getParenOrBraceRange());
14185template<
typename Derived>
14186ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
14187 CXXInheritedCtorInitExpr *
E) {
14188 QualType
T = getDerived().TransformType(
E->
getType());
14192 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14193 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14197 if (!getDerived().AlwaysRebuild() &&
14199 Constructor ==
E->getConstructor()) {
14206 return getDerived().RebuildCXXInheritedCtorInitExpr(
14207 T,
E->getLocation(), Constructor,
14208 E->constructsVBase(),
E->inheritedFromVBase());
14215template<
typename Derived>
14217TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *
E) {
14218 if (
auto *Dtor =
E->getTemporary()->getDestructor())
14220 const_cast<CXXDestructorDecl *
>(Dtor));
14221 return getDerived().TransformExpr(
E->getSubExpr());
14229template<
typename Derived>
14231TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *
E) {
14232 return getDerived().TransformExpr(
E->getSubExpr());
14235template<
typename Derived>
14237TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
14238 CXXTemporaryObjectExpr *
E) {
14239 TypeSourceInfo *
T =
14240 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
14244 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14245 getDerived().TransformDecl(
E->
getBeginLoc(),
E->getConstructor()));
14249 bool ArgumentChanged =
false;
14251 Args.reserve(
E->getNumArgs());
14253 EnterExpressionEvaluationContext Context(
14255 E->isListInitialization());
14256 if (TransformExprs(
E->getArgs(),
E->getNumArgs(),
true, Args,
14261 if (!getDerived().AlwaysRebuild() &&
14262 T ==
E->getTypeSourceInfo() &&
14263 Constructor ==
E->getConstructor() &&
14264 !ArgumentChanged) {
14272 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
14273 return getDerived().RebuildCXXTemporaryObjectExpr(
14278template<
typename Derived>
14280TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *
E) {
14283 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
14284 struct TransformedInitCapture {
14286 SourceLocation EllipsisLoc;
14291 InitCaptures.resize(
E->explicit_capture_end() -
E->explicit_capture_begin());
14293 CEnd =
E->capture_end();
14295 if (!
E->isInitCapture(
C))
14298 TransformedInitCapture &
Result = InitCaptures[
C -
E->capture_begin()];
14299 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
14301 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
14302 std::optional<unsigned> NumExpansions) {
14303 ExprResult NewExprInitResult = getDerived().TransformInitializer(
14306 if (NewExprInitResult.isInvalid()) {
14307 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
14310 Expr *NewExprInit = NewExprInitResult.get();
14312 QualType NewInitCaptureType =
14313 getSema().buildLambdaInitCaptureInitialization(
14314 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
14315 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
14316 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
14319 Result.Expansions.push_back(
14320 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
14324 if (OldVD->isParameterPack()) {
14325 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
14327 .castAs<PackExpansionTypeLoc>();
14333 bool Expand =
true;
14334 bool RetainExpansion =
false;
14335 std::optional<unsigned> OrigNumExpansions =
14336 ExpansionTL.getTypePtr()->getNumExpansions();
14337 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14338 if (getDerived().TryExpandParameterPacks(
14339 ExpansionTL.getEllipsisLoc(),
14340 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
14341 RetainExpansion, NumExpansions))
14344 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14345 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14346 SubstInitCapture(SourceLocation(), std::nullopt);
14349 if (!Expand || RetainExpansion) {
14350 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14351 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
14352 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
14355 SubstInitCapture(SourceLocation(), std::nullopt);
14359 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
14360 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
14371 DeclContext *DC = getSema().CurContext;
14389 while (DC->isRequiresExprBody())
14390 DC = DC->getParent();
14391 if ((getSema().isUnevaluatedContext() ||
14392 getSema().isConstantEvaluatedContext()) &&
14393 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
14396 CXXRecordDecl *OldClass =
E->getLambdaClass();
14397 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
14398 E->getIntroducerRange(),
nullptr, DependencyKind,
14399 E->getCaptureDefault());
14400 getDerived().transformedLocalDecl(OldClass, {
Class});
14402 CXXMethodDecl *NewCallOperator =
14403 getSema().CreateLambdaCallOperator(
E->getIntroducerRange(),
Class);
14404 NewCallOperator->setLexicalDeclContext(getSema().CurContext);
14407 getSema().buildLambdaScope(LSI, NewCallOperator,
E->getIntroducerRange(),
14408 E->getCaptureDefault(),
E->getCaptureDefaultLoc(),
14409 E->hasExplicitParameters(),
E->isMutable());
14412 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
14419 CEnd =
E->capture_end();
14423 if (
C->isImplicit())
14427 if (
C->capturesThis()) {
14433 Sema::CXXThisScopeRAII ThisScope(
14435 dyn_cast_if_present<CXXRecordDecl>(
14436 getSema().getFunctionLevelDeclContext()),
14438 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
14445 if (
C->capturesVLAType())
14449 if (
E->isInitCapture(
C)) {
14450 TransformedInitCapture &NewC = InitCaptures[
C -
E->capture_begin()];
14452 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
14455 for (InitCaptureInfoTy &Info : NewC.Expansions) {
14457 QualType InitQualType = Info.second;
14458 if (
Init.isInvalid() || InitQualType.isNull()) {
14462 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
14463 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
14464 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
14465 getSema().CurContext);
14470 NewVDs.push_back(NewVD);
14471 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
14477 getDerived().transformedLocalDecl(OldVD, NewVDs);
14481 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
14489 SourceLocation EllipsisLoc;
14490 if (
C->isPackExpansion()) {
14492 bool ShouldExpand =
false;
14493 bool RetainExpansion =
false;
14494 std::optional<unsigned> NumExpansions;
14495 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
14498 ShouldExpand, RetainExpansion,
14504 if (ShouldExpand) {
14508 auto *Pack = cast<VarDecl>(
C->getCapturedVar());
14509 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14510 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14511 VarDecl *CapturedVar
14512 = cast_or_null<VarDecl>(getDerived().TransformDecl(
C->getLocation(),
14514 if (!CapturedVar) {
14520 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
14528 EllipsisLoc =
C->getEllipsisLoc();
14532 auto *CapturedVar = cast_or_null<ValueDecl>(
14533 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
14534 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
14540 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
14543 getSema().finishLambdaExplicitCaptures(LSI);
14547 auto TPL = getDerived().TransformTemplateParameterList(
14548 E->getTemplateParameterList());
14549 LSI->GLTemplateParameterList = TPL;
14551 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
14558 TypeSourceInfo *NewCallOpTSI =
nullptr;
14560 auto OldCallOpTypeLoc =
14561 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
14563 auto TransformFunctionProtoTypeLoc =
14564 [
this](TypeLocBuilder &TLB, FunctionProtoTypeLoc FPTL) -> QualType {
14566 return this->TransformFunctionProtoType(
14567 TLB, FPTL,
nullptr, Qualifiers(),
14568 [&](FunctionProtoType::ExceptionSpecInfo &ESI,
bool &Changed) {
14569 return TransformExceptionSpec(FPTL.getBeginLoc(), ESI,
14570 ExceptionStorage, Changed);
14574 QualType NewCallOpType;
14575 TypeLocBuilder NewCallOpTLBuilder;
14577 if (
auto ATL = OldCallOpTypeLoc.getAs<AttributedTypeLoc>()) {
14578 NewCallOpType = this->TransformAttributedType(
14579 NewCallOpTLBuilder, ATL,
14580 [&](TypeLocBuilder &TLB, TypeLoc TL) -> QualType {
14581 return TransformFunctionProtoTypeLoc(
14582 TLB, TL.castAs<FunctionProtoTypeLoc>());
14585 auto FPTL = OldCallOpTypeLoc.castAs<FunctionProtoTypeLoc>();
14586 NewCallOpType = TransformFunctionProtoTypeLoc(NewCallOpTLBuilder, FPTL);
14589 if (NewCallOpType.isNull())
14592 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
14596 if (
auto ATL = NewCallOpTSI->getTypeLoc().getAs<AttributedTypeLoc>()) {
14597 Params = ATL.getModifiedLoc().castAs<FunctionProtoTypeLoc>().getParams();
14599 auto FPTL = NewCallOpTSI->getTypeLoc().castAs<FunctionProtoTypeLoc>();
14600 Params = FPTL.getParams();
14603 getSema().CompleteLambdaCallOperator(
14604 NewCallOperator,
E->getCallOperator()->getLocation(),
14605 E->getCallOperator()->getInnerLocStart(),
14606 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
14607 E->getCallOperator()->getConstexprKind(),
14608 E->getCallOperator()->getStorageClass(), Params,
14609 E->hasExplicitResultType());
14611 getDerived().transformAttrs(
E->getCallOperator(), NewCallOperator);
14612 getDerived().transformedLocalDecl(
E->getCallOperator(), {NewCallOperator});
14616 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
14618 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
14619 if (getDerived().ReplacingOriginal()) {
14620 Numbering = OldClass->getLambdaNumbering();
14623 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
14628 getSema().PushExpressionEvaluationContext(
14629 E->getCallOperator()->isConsteval() ?
14632 getSema().currentEvaluationContext().InImmediateEscalatingFunctionContext =
14633 getSema().getLangOpts().CPlusPlus20 &&
14634 E->getCallOperator()->isImmediateEscalating();
14636 Sema::CodeSynthesisContext
C;
14639 getSema().pushCodeSynthesisContext(
C);
14645 getSema().popCodeSynthesisContext();
14648 FuncScopeCleanup.disable();
14650 if (Body.isInvalid()) {
14651 SavedContext.pop();
14660 auto LSICopy = *LSI;
14661 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
14663 SavedContext.pop();
14698 DependencyKind = getDerived().ComputeLambdaDependency(&LSICopy);
14699 Class->setLambdaDependencyKind(DependencyKind);
14702 Class->setTypeForDecl(
nullptr);
14703 getSema().Context.getTypeDeclType(
Class);
14705 return getSema().BuildLambdaExpr(
E->
getBeginLoc(), Body.get()->getEndLoc(),
14709template<
typename Derived>
14712 return TransformStmt(S);
14715template<
typename Derived>
14720 CEnd =
E->capture_end();
14724 if (!
C->isImplicit())
14728 if (
C->capturesThis()) {
14729 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
14736 if (
C->capturesVLAType())
14739 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
14740 assert(!
E->isInitCapture(
C) &&
"implicit init-capture?");
14743 VarDecl *CapturedVar = cast_or_null<VarDecl>(
14744 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
14749 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
14755template<
typename Derived>
14760 getDerived().TransformTypeWithDeducedTST(
E->getTypeSourceInfo());
14764 bool ArgumentChanged =
false;
14766 Args.reserve(
E->getNumArgs());
14770 E->isListInitialization());
14771 if (getDerived().TransformExprs(
E->arg_begin(),
E->getNumArgs(),
true, Args,
14776 if (!getDerived().AlwaysRebuild() &&
14777 T ==
E->getTypeSourceInfo() &&
14782 return getDerived().RebuildCXXUnresolvedConstructExpr(
14783 T,
E->getLParenLoc(), Args,
E->getRParenLoc(),
E->isListInitialization());
14786template<
typename Derived>
14788TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
14789 CXXDependentScopeMemberExpr *
E) {
14794 QualType ObjectType;
14795 if (!
E->isImplicitAccess()) {
14796 OldBase =
E->getBase();
14797 Base = getDerived().TransformExpr(OldBase);
14798 if (
Base.isInvalid())
14803 bool MayBePseudoDestructor =
false;
14805 E->getOperatorLoc(),
14806 E->isArrow()? tok::arrow : tok::period,
14808 MayBePseudoDestructor);
14809 if (
Base.isInvalid())
14812 ObjectType = ObjectTy.get();
14813 BaseType = ((Expr*)
Base.get())->getType();
14816 BaseType = getDerived().TransformType(
E->getBaseType());
14822 NamedDecl *FirstQualifierInScope
14823 = getDerived().TransformFirstQualifierInScope(
14824 E->getFirstQualifierFoundInScope(),
14827 NestedNameSpecifierLoc QualifierLoc;
14828 if (
E->getQualifier()) {
14830 = getDerived().TransformNestedNameSpecifierLoc(
E->getQualifierLoc(),
14832 FirstQualifierInScope);
14837 SourceLocation TemplateKWLoc =
E->getTemplateKeywordLoc();
14843 DeclarationNameInfo NameInfo
14844 = getDerived().TransformDeclarationNameInfo(
E->getMemberNameInfo());
14845 if (!NameInfo.getName())
14848 if (!
E->hasExplicitTemplateArgs()) {
14851 if (!getDerived().AlwaysRebuild() &&
14852 Base.get() == OldBase &&
14853 BaseType ==
E->getBaseType() &&
14854 QualifierLoc ==
E->getQualifierLoc() &&
14855 NameInfo.getName() ==
E->getMember() &&
14856 FirstQualifierInScope ==
E->getFirstQualifierFoundInScope())
14859 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
14862 E->getOperatorLoc(),
14865 FirstQualifierInScope,
14870 TemplateArgumentListInfo TransArgs(
E->getLAngleLoc(),
E->getRAngleLoc());
14871 if (getDerived().TransformTemplateArguments(
E->getTemplateArgs(),
14872 E->getNumTemplateArgs(),
14876 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
14879 E->getOperatorLoc(),
14882 FirstQualifierInScope,
14887template <
typename Derived>
14888ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
14889 UnresolvedMemberExpr *Old) {
14893 if (!Old->isImplicitAccess()) {
14894 Base = getDerived().TransformExpr(Old->getBase());
14895 if (
Base.isInvalid())
14898 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
14899 if (
Base.isInvalid())
14901 BaseType =
Base.get()->getType();
14903 BaseType = getDerived().TransformType(Old->getBaseType());
14906 NestedNameSpecifierLoc QualifierLoc;
14907 if (Old->getQualifierLoc()) {
14909 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
14914 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
14919 if (TransformOverloadExprDecls(Old,
false, R))
14923 if (Old->getNamingClass()) {
14924 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
14925 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
14929 R.setNamingClass(NamingClass);
14932 TemplateArgumentListInfo TransArgs;
14933 if (Old->hasExplicitTemplateArgs()) {
14934 TransArgs.setLAngleLoc(Old->getLAngleLoc());
14935 TransArgs.setRAngleLoc(Old->getRAngleLoc());
14936 if (getDerived().TransformTemplateArguments(
14937 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
14945 NamedDecl *FirstQualifierInScope =
nullptr;
14947 return getDerived().RebuildUnresolvedMemberExpr(
14948 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
14949 TemplateKWLoc, FirstQualifierInScope, R,
14950 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
14953template<
typename Derived>
14955TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *
E) {
14958 ExprResult SubExpr = getDerived().TransformExpr(
E->getOperand());
14959 if (SubExpr.isInvalid())
14962 if (!getDerived().AlwaysRebuild() && SubExpr.get() ==
E->getOperand())
14965 return getDerived().RebuildCXXNoexceptExpr(
E->
getSourceRange(),SubExpr.get());
14968template<
typename Derived>
14970TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *
E) {
14971 ExprResult Pattern = getDerived().TransformExpr(
E->getPattern());
14972 if (Pattern.isInvalid())
14975 if (!getDerived().AlwaysRebuild() && Pattern.get() ==
E->getPattern())
14978 return getDerived().RebuildPackExpansion(Pattern.get(),
E->getEllipsisLoc(),
14979 E->getNumExpansions());
14982template<
typename Derived>
14984TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *
E) {
14994 TemplateArgument ArgStorage;
14997 if (
E->isPartiallySubstituted()) {
14998 PackArgs =
E->getPartialArguments();
15001 bool ShouldExpand =
false;
15002 bool RetainExpansion =
false;
15003 std::optional<unsigned> NumExpansions;
15004 if (getDerived().TryExpandParameterPacks(
E->getOperatorLoc(),
E->getPackLoc(),
15006 ShouldExpand, RetainExpansion,
15012 if (ShouldExpand) {
15013 auto *Pack =
E->getPack();
15014 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
15015 ArgStorage = getSema().Context.getPackExpansionType(
15017 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
15018 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
15020 auto *VD = cast<ValueDecl>(Pack);
15021 ExprResult DRE = getSema().BuildDeclRefExpr(
15022 VD, VD->getType().getNonLValueExprType(getSema().Context),
15025 if (DRE.isInvalid())
15027 ArgStorage =
new (getSema().Context)
15028 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
15029 E->getPackLoc(), std::nullopt);
15031 PackArgs = ArgStorage;
15036 if (!PackArgs.size()) {
15037 auto *Pack = cast_or_null<NamedDecl>(
15038 getDerived().TransformDecl(
E->getPackLoc(),
E->getPack()));
15041 return getDerived().RebuildSizeOfPackExpr(
15042 E->getOperatorLoc(), Pack,
E->getPackLoc(),
E->getRParenLoc(),
15043 std::nullopt, std::nullopt);
15047 std::optional<unsigned>
Result = 0;
15048 for (
const TemplateArgument &Arg : PackArgs) {
15049 if (!Arg.isPackExpansion()) {
15054 TemplateArgumentLoc ArgLoc;
15055 InventTemplateArgumentLoc(Arg, ArgLoc);
15058 SourceLocation Ellipsis;
15059 std::optional<unsigned> OrigNumExpansions;
15060 TemplateArgumentLoc Pattern =
15061 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
15062 OrigNumExpansions);
15065 TemplateArgumentLoc OutPattern;
15066 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15067 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
15072 std::optional<unsigned> NumExpansions =
15073 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
15074 if (!NumExpansions) {
15087 return getDerived().RebuildSizeOfPackExpr(
15088 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
15091 TemplateArgumentListInfo TransformedPackArgs(
E->getPackLoc(),
15094 TemporaryBase Rebase(*
this,
E->getPackLoc(), getBaseEntity());
15095 typedef TemplateArgumentLocInventIterator<
15096 Derived,
const TemplateArgument*> PackLocIterator;
15097 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
15098 PackLocIterator(*
this, PackArgs.end()),
15099 TransformedPackArgs,
true))
15106 bool PartialSubstitution =
false;
15107 for (
auto &
Loc : TransformedPackArgs.arguments()) {
15108 Args.push_back(
Loc.getArgument());
15109 if (
Loc.getArgument().isPackExpansion())
15110 PartialSubstitution =
true;
15113 if (PartialSubstitution)
15114 return getDerived().RebuildSizeOfPackExpr(
15115 E->getOperatorLoc(),
E->getPack(),
E->getPackLoc(),
E->getRParenLoc(),
15116 std::nullopt, Args);
15118 return getDerived().RebuildSizeOfPackExpr(
E->getOperatorLoc(),
E->getPack(),
15119 E->getPackLoc(),
E->getRParenLoc(),
15120 Args.size(), std::nullopt);
15123template <
typename Derived>
15125TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *
E) {
15130 ExprResult IndexExpr = getDerived().TransformExpr(
E->getIndexExpr());
15131 if (IndexExpr.isInvalid())
15135 if (!
E->expandsToEmptyPack() &&
E->getExpressions().empty()) {
15136 Expr *Pattern =
E->getPackIdExpression();
15138 getSema().collectUnexpandedParameterPacks(
E->getPackIdExpression(),
15140 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15144 bool ShouldExpand =
true;
15145 bool RetainExpansion =
false;
15146 std::optional<unsigned> OrigNumExpansions;
15147 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15148 if (getDerived().TryExpandParameterPacks(
15150 ShouldExpand, RetainExpansion, NumExpansions))
15152 if (!ShouldExpand) {
15153 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15154 ExprResult Pack = getDerived().TransformExpr(Pattern);
15155 if (Pack.isInvalid())
15157 return getDerived().RebuildPackIndexingExpr(
15158 E->getEllipsisLoc(),
E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
15161 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15162 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15163 ExprResult Out = getDerived().TransformExpr(Pattern);
15164 if (Out.isInvalid())
15166 if (Out.get()->containsUnexpandedParameterPack()) {
15167 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
15168 OrigNumExpansions);
15169 if (Out.isInvalid())
15172 ExpandedExprs.push_back(Out.get());
15176 if (RetainExpansion) {
15177 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15179 ExprResult Out = getDerived().TransformExpr(Pattern);
15180 if (Out.isInvalid())
15183 Out = getDerived().RebuildPackExpansion(Out.get(),
E->getEllipsisLoc(),
15184 OrigNumExpansions);
15185 if (Out.isInvalid())
15187 ExpandedExprs.push_back(Out.get());
15189 }
else if (!
E->expandsToEmptyPack()) {
15190 if (getDerived().TransformExprs(
E->getExpressions().data(),
15191 E->getExpressions().size(),
false,
15196 return getDerived().RebuildPackIndexingExpr(
15197 E->getEllipsisLoc(),
E->getRSquareLoc(),
E->getPackIdExpression(),
15198 IndexExpr.get(), ExpandedExprs,
15199 ExpandedExprs.size() == 0);
15202template<
typename Derived>
15204TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
15205 SubstNonTypeTemplateParmPackExpr *
E) {
15210template<
typename Derived>
15212TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
15213 SubstNonTypeTemplateParmExpr *
E) {
15218template<
typename Derived>
15220TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *
E) {
15225template<
typename Derived>
15227TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
15228 MaterializeTemporaryExpr *
E) {
15229 return getDerived().TransformExpr(
E->getSubExpr());
15232template<
typename Derived>
15234TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *
E) {
15235 UnresolvedLookupExpr *
Callee =
nullptr;
15236 if (Expr *OldCallee =
E->getCallee()) {
15237 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
15238 if (CalleeResult.isInvalid())
15240 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
15243 Expr *Pattern =
E->getPattern();
15246 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
15247 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15251 bool Expand =
true;
15252 bool RetainExpansion =
false;
15253 std::optional<unsigned> OrigNumExpansions =
E->getNumExpansions(),
15254 NumExpansions = OrigNumExpansions;
15255 if (getDerived().TryExpandParameterPacks(
E->getEllipsisLoc(),
15258 Expand, RetainExpansion,
15265 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15268 E->getLHS() ? getDerived().TransformExpr(
E->getLHS()) :
ExprResult();
15269 if (LHS.isInvalid())
15273 E->getRHS() ? getDerived().TransformExpr(
E->getRHS()) :
ExprResult();
15274 if (RHS.isInvalid())
15277 if (!getDerived().AlwaysRebuild() &&
15278 LHS.get() ==
E->getLHS() && RHS.get() ==
E->getRHS())
15281 return getDerived().RebuildCXXFoldExpr(
15283 E->getEllipsisLoc(), RHS.get(),
E->
getEndLoc(), NumExpansions);
15289 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
15290 SemaRef.
Diag(
E->getEllipsisLoc(),
15291 clang::diag::err_fold_expression_limit_exceeded)
15292 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
15294 SemaRef.
Diag(
E->getEllipsisLoc(), diag::note_bracket_depth);
15303 bool LeftFold =
E->isLeftFold();
15307 if (!LeftFold && RetainExpansion) {
15308 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15310 ExprResult Out = getDerived().TransformExpr(Pattern);
15311 if (Out.isInvalid())
15314 Result = getDerived().RebuildCXXFoldExpr(
15321 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15322 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
15323 getSema(), LeftFold ? I : *NumExpansions - I - 1);
15324 ExprResult Out = getDerived().TransformExpr(Pattern);
15325 if (Out.isInvalid())
15328 if (Out.get()->containsUnexpandedParameterPack()) {
15330 Result = getDerived().RebuildCXXFoldExpr(
15332 E->getOperator(),
E->getEllipsisLoc(),
15334 OrigNumExpansions);
15335 }
else if (
Result.isUsable()) {
15337 Expr *LHS = LeftFold ?
Result.get() : Out.get();
15338 Expr *RHS = LeftFold ? Out.get() :
Result.get();
15340 UnresolvedSet<16> Functions;
15341 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
15342 Result = getDerived().RebuildCXXOperatorCallExpr(
15344 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
15345 Functions, LHS, RHS);
15347 Result = getDerived().RebuildBinaryOperator(
E->getEllipsisLoc(),
15348 E->getOperator(), LHS, RHS);
15359 if (LeftFold && RetainExpansion) {
15360 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15362 ExprResult Out = getDerived().TransformExpr(Pattern);
15363 if (Out.isInvalid())
15366 Result = getDerived().RebuildCXXFoldExpr(
15368 E->getEllipsisLoc(), Out.get(),
E->
getEndLoc(), OrigNumExpansions);
15376 return getDerived().RebuildEmptyCXXFoldExpr(
E->getEllipsisLoc(),
15382template <
typename Derived>
15384TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *
E) {
15387 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
15391 return getDerived().RebuildParenListExpr(
E->
getBeginLoc(), TransformedInits,
15395template<
typename Derived>
15397TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
15398 CXXStdInitializerListExpr *
E) {
15399 return getDerived().TransformExpr(
E->getSubExpr());
15402template<
typename Derived>
15404TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *
E) {
15408template<
typename Derived>
15410TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *
E) {
15414template<
typename Derived>
15416TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *
E) {
15417 ExprResult SubExpr = getDerived().TransformExpr(
E->getSubExpr());
15418 if (SubExpr.isInvalid())
15421 if (!getDerived().AlwaysRebuild() &&
15422 SubExpr.get() ==
E->getSubExpr())
15425 return getDerived().RebuildObjCBoxedExpr(
E->
getSourceRange(), SubExpr.get());
15428template<
typename Derived>
15430TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *
E) {
15433 bool ArgChanged =
false;
15434 if (getDerived().TransformExprs(
E->getElements(),
E->getNumElements(),
15435 false, Elements, &ArgChanged))
15438 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15446template<
typename Derived>
15448TreeTransform<Derived>::TransformObjCDictionaryLiteral(
15449 ObjCDictionaryLiteral *
E) {
15452 bool ArgChanged =
false;
15453 for (
unsigned I = 0, N =
E->getNumElements(); I != N; ++I) {
15454 ObjCDictionaryElement OrigElement =
E->getKeyValueElement(I);
15456 if (OrigElement.isPackExpansion()) {
15459 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
15460 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
15461 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15465 bool Expand =
true;
15466 bool RetainExpansion =
false;
15467 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
15468 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15469 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
15470 OrigElement.Value->getEndLoc());
15471 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
15472 PatternRange, Unexpanded, Expand,
15473 RetainExpansion, NumExpansions))
15480 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15481 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15482 if (Key.isInvalid())
15485 if (Key.get() != OrigElement.Key)
15489 if (
Value.isInvalid())
15492 if (
Value.get() != OrigElement.Value)
15495 ObjCDictionaryElement Expansion = {
15496 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
15498 Elements.push_back(Expansion);
15508 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15509 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15510 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15511 if (Key.isInvalid())
15515 if (
Value.isInvalid())
15518 ObjCDictionaryElement Element = {
15519 Key.get(),
Value.get(), SourceLocation(), NumExpansions
15525 if (Key.get()->containsUnexpandedParameterPack() ||
15526 Value.get()->containsUnexpandedParameterPack())
15527 Element.EllipsisLoc = OrigElement.EllipsisLoc;
15529 Elements.push_back(Element);
15539 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15540 if (Key.isInvalid())
15543 if (Key.get() != OrigElement.Key)
15548 = getDerived().TransformExpr(OrigElement.Value);
15549 if (
Value.isInvalid())
15552 if (
Value.get() != OrigElement.Value)
15555 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
15557 Elements.push_back(Element);
15560 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15563 return getDerived().RebuildObjCDictionaryLiteral(
E->
getSourceRange(),
15567template<
typename Derived>
15569TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *
E) {
15570 TypeSourceInfo *EncodedTypeInfo
15571 = getDerived().TransformType(
E->getEncodedTypeSourceInfo());
15572 if (!EncodedTypeInfo)
15575 if (!getDerived().AlwaysRebuild() &&
15576 EncodedTypeInfo ==
E->getEncodedTypeSourceInfo())
15579 return getDerived().RebuildObjCEncodeExpr(
E->getAtLoc(),
15581 E->getRParenLoc());
15584template<
typename Derived>
15586TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *
E) {
15591 return getDerived().TransformExpr(
E->getSubExpr());
15594template<
typename Derived>
15596TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *
E) {
15597 TypeSourceInfo *TSInfo
15598 = getDerived().TransformType(
E->getTypeInfoAsWritten());
15606 if (!getDerived().AlwaysRebuild() &&
15607 TSInfo ==
E->getTypeInfoAsWritten() &&
15608 Result.get() ==
E->getSubExpr())
15612 E->getLParenLoc(),
E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
15616template <
typename Derived>
15617ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
15618 ObjCAvailabilityCheckExpr *
E) {
15622template<
typename Derived>
15624TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *
E) {
15626 bool ArgChanged =
false;
15628 Args.reserve(
E->getNumArgs());
15629 if (getDerived().TransformExprs(
E->getArgs(),
E->getNumArgs(),
false, Args,
15635 TypeSourceInfo *ReceiverTypeInfo
15636 = getDerived().TransformType(
E->getClassReceiverTypeInfo());
15637 if (!ReceiverTypeInfo)
15641 if (!getDerived().AlwaysRebuild() &&
15642 ReceiverTypeInfo ==
E->getClassReceiverTypeInfo() && !ArgChanged)
15647 E->getSelectorLocs(SelLocs);
15648 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
15651 E->getMethodDecl(),
15658 if (!
E->getMethodDecl())
15663 E->getSelectorLocs(SelLocs);
15664 return getDerived().RebuildObjCMessageExpr(
E->getSuperLoc(),
15667 E->getReceiverType(),
15668 E->getMethodDecl(),
15676 "Only class and instance messages may be instantiated");
15678 = getDerived().TransformExpr(
E->getInstanceReceiver());
15679 if (Receiver.isInvalid())
15683 if (!getDerived().AlwaysRebuild() &&
15684 Receiver.get() ==
E->getInstanceReceiver() && !ArgChanged)
15689 E->getSelectorLocs(SelLocs);
15690 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
15693 E->getMethodDecl(),
15699template<
typename Derived>
15701TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *
E) {
15705template<
typename Derived>
15707TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *
E) {
15711template<
typename Derived>
15713TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *
E) {
15716 if (
Base.isInvalid())
15722 if (!getDerived().AlwaysRebuild() &&
15723 Base.get() ==
E->getBase())
15726 return getDerived().RebuildObjCIvarRefExpr(
Base.get(),
E->getDecl(),
15728 E->isArrow(),
E->isFreeIvar());
15731template<
typename Derived>
15733TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *
E) {
15736 if (!
E->isObjectReceiver())
15741 if (
Base.isInvalid())
15747 if (!getDerived().AlwaysRebuild() &&
15748 Base.get() ==
E->getBase())
15751 if (
E->isExplicitProperty())
15752 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
15753 E->getExplicitProperty(),
15756 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
15758 E->getImplicitPropertyGetter(),
15759 E->getImplicitPropertySetter(),
15763template<
typename Derived>
15765TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *
E) {
15768 if (
Base.isInvalid())
15772 ExprResult Key = getDerived().TransformExpr(
E->getKeyExpr());
15773 if (Key.isInvalid())
15777 if (!getDerived().AlwaysRebuild() &&
15778 Key.get() ==
E->getKeyExpr() &&
Base.get() ==
E->getBaseExpr())
15781 return getDerived().RebuildObjCSubscriptRefExpr(
E->getRBracket(),
15782 Base.get(), Key.get(),
15783 E->getAtIndexMethodDecl(),
15784 E->setAtIndexMethodDecl());
15787template<
typename Derived>
15789TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *
E) {
15792 if (
Base.isInvalid())
15796 if (!getDerived().AlwaysRebuild() &&
15797 Base.get() ==
E->getBase())
15800 return getDerived().RebuildObjCIsaExpr(
Base.get(),
E->getIsaMemberLoc(),
15805template<
typename Derived>
15807TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *
E) {
15808 bool ArgumentChanged =
false;
15810 SubExprs.reserve(
E->getNumSubExprs());
15811 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
15812 SubExprs, &ArgumentChanged))
15815 if (!getDerived().AlwaysRebuild() &&
15819 return getDerived().RebuildShuffleVectorExpr(
E->getBuiltinLoc(),
15821 E->getRParenLoc());
15824template<
typename Derived>
15826TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *
E) {
15827 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
15828 if (SrcExpr.isInvalid())
15831 TypeSourceInfo *
Type = getDerived().TransformType(
E->getTypeSourceInfo());
15835 if (!getDerived().AlwaysRebuild() &&
15836 Type ==
E->getTypeSourceInfo() &&
15837 SrcExpr.get() ==
E->getSrcExpr())
15840 return getDerived().RebuildConvertVectorExpr(
E->getBuiltinLoc(),
15841 SrcExpr.get(), Type,
15842 E->getRParenLoc());
15845template<
typename Derived>
15847TreeTransform<Derived>::TransformBlockExpr(BlockExpr *
E) {
15848 BlockDecl *oldBlock =
E->getBlockDecl();
15851 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
15854 blockScope->TheDecl->setBlockMissingReturnType(
15855 oldBlock->blockMissingReturnType());
15860 const FunctionProtoType *exprFunctionType =
E->getFunctionType();
15863 Sema::ExtParameterInfoBuilder extParamInfos;
15864 if (getDerived().TransformFunctionTypeParams(
15865 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
15866 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
15868 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
15872 QualType exprResultType =
15873 getDerived().TransformType(exprFunctionType->getReturnType());
15875 auto epi = exprFunctionType->getExtProtoInfo();
15876 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
15879 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
15883 if (!params.empty())
15884 blockScope->TheDecl->setParams(params);
15886 if (!oldBlock->blockMissingReturnType()) {
15887 blockScope->HasImplicitReturnType =
false;
15888 blockScope->ReturnType = exprResultType;
15892 StmtResult body = getDerived().TransformStmt(
E->getBody());
15893 if (body.isInvalid()) {
15894 getSema().ActOnBlockError(
E->getCaretLocation(),
nullptr);
15902 for (
const auto &I : oldBlock->captures()) {
15903 VarDecl *oldCapture = I.getVariable();
15906 if (oldCapture->isParameterPack())
15909 VarDecl *newCapture =
15910 cast<VarDecl>(getDerived().TransformDecl(
E->getCaretLocation(),
15912 assert(blockScope->CaptureMap.count(newCapture));
15918 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
15919 "this pointer isn't captured in the old block");
15927template<
typename Derived>
15929TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *
E) {
15930 ExprResult SrcExpr = getDerived().TransformExpr(
E->getSrcExpr());
15931 if (SrcExpr.isInvalid())
15934 QualType
Type = getDerived().TransformType(
E->
getType());
15937 E->getRParenLoc());
15940template<
typename Derived>
15942TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *
E) {
15943 bool ArgumentChanged =
false;
15945 SubExprs.reserve(
E->getNumSubExprs());
15946 if (getDerived().TransformExprs(
E->getSubExprs(),
E->getNumSubExprs(),
false,
15947 SubExprs, &ArgumentChanged))
15950 if (!getDerived().AlwaysRebuild() &&
15954 return getDerived().RebuildAtomicExpr(
E->getBuiltinLoc(), SubExprs,
15955 E->getOp(),
E->getRParenLoc());
15962template<
typename Derived>
15966 getDerived().getBaseEntity());
15969template<
typename Derived>
15973 getDerived().getBaseEntity());
15976template<
typename Derived>
15979 bool WrittenAsLValue,
15982 Sigil, getDerived().getBaseEntity());
15985template<
typename Derived>
15991 getDerived().getBaseEntity());
15994template<
typename Derived>
16002 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16006template<
typename Derived>
16018 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
16019 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
16024template<
typename Derived>
16031template <
typename Derived>
16034 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16035 if (SizeExpr || !Size)
16037 IndexTypeQuals, BracketsRange,
16038 getDerived().getBaseEntity());
16046 for (
const auto &
T : Types)
16058 IndexTypeQuals, BracketsRange,
16059 getDerived().getBaseEntity());
16062template <
typename Derived>
16065 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16066 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
16067 IndexTypeQuals, BracketsRange);
16070template <
typename Derived>
16074 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
16075 IndexTypeQuals, BracketsRange);
16078template <
typename Derived>
16081 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16082 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
16084 IndexTypeQuals, BracketsRange);
16087template <
typename Derived>
16090 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
16091 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
16093 IndexTypeQuals, BracketsRange);
16096template <
typename Derived>
16103template <
typename Derived>
16105 unsigned NumElements,
16111template <
typename Derived>
16118template<
typename Derived>
16120 unsigned NumElements,
16123 NumElements,
true);
16130template<
typename Derived>
16138template <
typename Derived>
16140 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
16145template <
typename Derived>
16153template<
typename Derived>
16159 getDerived().getBaseLocation(),
16160 getDerived().getBaseEntity(),
16164template<
typename Derived>
16169template<
typename Derived>
16172 assert(
D &&
"no decl found");
16176 if (
auto *UPD = dyn_cast<UsingPackDecl>(
D)) {
16180 if (UPD->expansions().empty()) {
16181 getSema().Diag(
Loc, diag::err_using_pack_expansion_empty)
16182 << UPD->isCXXClassMember() << UPD;
16191 for (
auto *
E : UPD->expansions()) {
16197 else if (
T.isNull())
16201 "mismatched resolved types in using pack expansion");
16203 return T.isNull() ? FallbackT :
T;
16204 }
else if (
auto *Using = dyn_cast<UsingDecl>(
D)) {
16205 assert(Using->hasTypename() &&
16206 "UnresolvedUsingTypenameDecl transformed to non-typename using");
16209 assert(++Using->shadow_begin() == Using->shadow_end());
16218 assert(isa<UnresolvedUsingTypenameDecl>(
D) &&
16219 "UnresolvedUsingTypenameDecl transformed to non-using decl");
16221 cast<UnresolvedUsingTypenameDecl>(
D));
16225template <
typename Derived>
16231template<
typename Derived>
16237template <
typename Derived>
16242template <
typename Derived>
16248 FullySubstituted, Expansions);
16251template<
typename Derived>
16258template<
typename Derived>
16266template<
typename Derived>
16272template<
typename Derived>
16280template <
typename Derived>
16291template <
typename Derived>
16297template<
typename Derived>
16306template<
typename Derived>
16314 bool AllowInjectedClassName) {
16318 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
16321 AllowInjectedClassName);
16322 return Template.
get();
16325template<
typename Derived>
16332 bool AllowInjectedClassName) {
16335 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
16336 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
16338 getSema().ActOnTemplateName(
16340 false, Template, AllowInjectedClassName);
16341 return Template.
get();
16344template <
typename Derived>
16349 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
16355 Opc,
First, Second);
16370 if (Op == OO_Subscript) {
16371 if (!
First->getType()->isOverloadableType() &&
16373 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
16375 }
else if (Op == OO_Arrow) {
16378 if (
First->getType()->isDependentType())
16382 }
else if (Second ==
nullptr || isPostIncDec) {
16383 if (!
First->getType()->isOverloadableType() ||
16384 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
16391 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
16395 !
First->getType()->isOverloadableType() &&
16410 if (!Second || isPostIncDec) {
16420 First, Second, RequiresADL);
16427template<
typename Derived>
16442 ->template getAs<RecordType>())){
16445 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
16446 CCLoc, TildeLoc, Destroyed);
16458 if (!ScopeType->getType()->getAs<
TagType>()) {
16459 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
16460 diag::err_expected_class_or_namespace)
16461 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
16469 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
16470 OperatorLoc, isArrow,
16478template<
typename Derived>
16486 for (
unsigned I = 0; I < NumParams; ++I) {
16487 if (I != ContextParamPos) {
16493 Params.push_back(std::make_pair(StringRef(), QualType()));
16496 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
16497 S->getCapturedRegionKind(), Params);
16500 Sema::CompoundScopeRAII CompoundScope(getSema());
16501 Body = getDerived().TransformStmt(S->getCapturedStmt());
16504 if (Body.isInvalid()) {
16505 getSema().ActOnCapturedRegionError();
16509 return getSema().ActOnCapturedRegionEnd(Body.get());
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Target Target
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
static QualType getPointeeType(const MemRegion *R)
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
DeclarationNameTable DeclarationNames
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true)
Form a pack expansion type with the given pattern.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
CanQualType PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
CanQualType UnsignedInt128Ty
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getRParenLoc() const
TypeLoc getValueLoc() const
SourceLocation getKWLoc() const
SourceLocation getLParenLoc() const
Attr - This represents one attribute.
attr::Kind getKind() const
SourceLocation getLocation() const
Represents an attribute applied to a statement.
Type source information for an attributed type.
const Attr * getAttr() const
The type attribute.
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
TypeLoc getEquivalentTypeLoc() const
void setAttr(const Attr *A)
attr::Kind getAttrKind() const
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
std::optional< NullabilityKind > getImmediateNullability() const
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
void setIsVariadic(bool value)
TypeLoc getInnerLoc() const
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
Represents binding an expression to a temporary.
CXXCatchStmt - This represents a C++ catch block.
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
Represents a call to an inherited base class constructor from an inheriting constructor.
Abstract class common to all of the C++ "named"/"keyword" casts.
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Represents a C++ nested-name-specifier or a global scope specifier.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
This captures a statement into a function.
SourceLocation getBegin() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
Expr * getCountExpr() const
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
bool isCountInBytes() const
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
The name of a declaration.
@ CXXConversionFunctionName
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a dependent template name that cannot be resolved prior to template instantiation.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
SourceLocation getTemplateNameLoc() const
SourceLocation getLAngleLoc() const
void setTemplateKeywordLoc(SourceLocation Loc)
SourceLocation getTemplateKeywordLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
SourceLocation getRAngleLoc() const
SourceLocation getElaboratedKeywordLoc() const
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
Represents a template specialization type whose template cannot be resolved, e.g.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
TypeLoc getNamedTypeLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
RAII object that enters a new expression evaluation context.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
QualType getReturnType() const
QualType getCallResultType() const
Determine the type of an expression that calls this function.
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present,...
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
QualType getReturnType() const
AssociationTy< false > Association
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
const TypeClass * getTypePtr() const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This represents clauses with a list of expressions that are mappable.
ObjCIvarDecl - Represents an ObjC instance variable.
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
bool isInstanceMethod() const
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents the declaration of an Objective-C type parameter.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Wrapper for void* pointer.
static OpaquePtr make(QualType P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
Represents a pack expansion of types.
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
SourceLocation getEndLoc() const
void setLParenLoc(SourceLocation EndLoc)
void setConditionDetails(Expr *ConditionExpr)
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
void setDefaultDetails(OpenACCDefaultClauseKind DefKind)
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
void setWaitDetails(Expr *DevNum, SourceLocation QueuesLoc, llvm::SmallVector< Expr * > &&IntExprs)
void setEndLoc(SourceLocation EndLoc)
void setIntExprDetails(ArrayRef< Expr * > IntExprs)
OpenACCDefaultClauseKind getDefaultClauseKind() const
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * 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 * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'to' clause.
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' 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()
void ActOnStmtExprError()
std::optional< FunctionEffectMode > ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName)
Try to parse the conditional expression attached to an effect attribute (e.g.
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt=std::nullopt)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, const FunctionEffectWithCondition &EC, SourceLocation NewAttrLoc)
Warn and return true if adding an effect to a set would create a conflict.
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
ConvertVectorExpr - Handle __builtin_convertvector.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
DeclContext * getCurLexicalContext() const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool EmptyPack=false)
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
@ TryCapture_ExplicitByVal
@ TryCapture_ExplicitByRef
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
bool CheckRebuiltStmtAttributes(ArrayRef< const Attr * > Attrs)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
ExprResult BuiltinShuffleVector(CallExpr *TheCall)
BuiltinShuffleVector - Handle __builtin_shufflevector.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, std::optional< unsigned > Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs=std::nullopt)
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
A structure for storing an already-substituted template template parameter pack.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
TypeSourceInfo * getTypeSourceInfo() const
SourceRange getSourceRange() const LLVM_READONLY
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getSourceExpression() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
SourceLocation getTemplateNameLoc() const
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
Wrapper for template type parameters.
The top declaration context.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
SourceLocation getTemplateKeywordLoc() const
Get the SourceLocation of the template keyword (if any).
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
ElaboratedTypeKeyword getKeyword() const
The base class of the type hierarchy.
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i....
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isFunctionType() const
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
TypedefNameDecl * getTypedefNameDecl() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent)
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.
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
CXXRecordDecl * Lambda
The class that describes the lambda.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
bool Inc(InterpState &S, CodePtr OpPC)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
The JSON file list parser is used to communicate input to InstallAPI.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
ArrayTypeTrait
Names for the array type traits.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
ActionResult< Expr * > ExprResult
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
ActionResult< Stmt * > StmtResult
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
const FunctionProtoType * T
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
MutableArrayRef< Expr * > MultiExprArg
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
This structure contains most locations needed for by an OMPVarListClause.
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.