13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
46#include "llvm/ADT/ArrayRef.h"
47#include "llvm/Support/ErrorHandling.h"
51using namespace llvm::omp;
107template<
typename Derived>
112 class ForgetPartiallySubstitutedPackRAII {
117 ForgetPartiallySubstitutedPackRAII(Derived &Self) : Self(Self) {
118 Old = Self.ForgetPartiallySubstitutedPack();
121 ~ForgetPartiallySubstitutedPackRAII() {
122 Self.RememberPartiallySubstitutedPack(Old);
139 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
143 return static_cast<const Derived&
>(*this);
208 OldLocation = Self.getDerived().getBaseLocation();
209 OldEntity = Self.getDerived().getBaseEntity();
212 Self.getDerived().setBase(Location, Entity);
216 Self.getDerived().setBase(OldLocation, OldEntity);
289 bool &ShouldExpand,
bool &RetainExpansion,
290 std::optional<unsigned> &NumExpansions) {
291 ShouldExpand =
false;
406 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
407#include "clang/Basic/AttrList.inc"
417 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
418 const X##Attr *A) { \
419 return getDerived().Transform##X##Attr(A); \
421#include "clang/Basic/AttrList.inc"
467 bool *ArgChanged =
nullptr);
476 llvm::DenseMap<Decl *, Decl *>::iterator Known
479 return Known->second;
507 assert(New.size() == 1 &&
508 "must override transformedLocalDecl if performing pack expansion");
546 NamedDecl *FirstQualifierInScope =
nullptr);
591 NamedDecl *FirstQualifierInScope =
nullptr,
592 bool AllowInjectedClassName =
false);
604 bool Uneval =
false);
627 bool Uneval =
false) {
646 template<
typename InputIterator>
650 bool Uneval =
false);
662#define ABSTRACT_TYPELOC(CLASS, PARENT)
663#define TYPELOC(CLASS, PARENT) \
664 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
665#include "clang/AST/TypeLocNodes.def"
669 bool SuppressObjCLifetime);
673 bool SuppressObjCLifetime);
675 template<
typename Fn>
682 template <
typename Fn>
684 Fn TransformModifiedType);
732 return getDerived().TransformFunctionTypeParams(
733 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
751 KWLoc, Params,
nullptr,
752 nullptr, PTypes, &TransParams, PInfos))
765 std::optional<unsigned> NumExpansions,
766 bool ExpectParameterPack);
793 bool IsAddressOfOperand,
801 bool IsAddressOfOperand);
807#define STMT(Node, Parent) \
808 LLVM_ATTRIBUTE_NOINLINE \
809 StmtResult Transform##Node(Node *S);
810#define VALUESTMT(Node, Parent) \
811 LLVM_ATTRIBUTE_NOINLINE \
812 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
813#define EXPR(Node, Parent) \
814 LLVM_ATTRIBUTE_NOINLINE \
815 ExprResult Transform##Node(Node *E);
816#define ABSTRACT_STMT(Stmt)
817#include "clang/AST/StmtNodes.inc"
819#define GEN_CLANG_CLAUSE_CLASS
820#define CLAUSE_CLASS(Enum, Str, Class) \
821 LLVM_ATTRIBUTE_NOINLINE \
822 OMPClause *Transform##Class(Class *S);
823#include "llvm/Frontend/OpenMP/OMP.inc"
900 const llvm::APInt *Size,
Expr *SizeExpr,
901 unsigned IndexTypeQuals,
SourceRange BracketsRange);
910 const llvm::APInt &Size,
Expr *SizeExpr,
911 unsigned IndexTypeQuals,
921 unsigned IndexTypeQuals,
931 unsigned IndexTypeQuals,
942 unsigned IndexTypeQuals,
980 unsigned NumColumns);
1067 bool FullySubstituted,
1081 TypeConstraintConcept,
1082 TypeConstraintArgs);
1090 Template, Deduced,
false);
1136 bool AllowInjectedClassName) {
1140 SS.
Adopt(QualifierLoc);
1142 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1143 AllowInjectedClassName);
1157 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1174 bool DeducedTSTContext) {
1176 SS.
Adopt(QualifierLoc);
1189 *
Id, IdLoc, DeducedTSTContext);
1207 switch (
Result.getResultKind()) {
1218 llvm_unreachable(
"Tag lookup cannot find non-tags");
1230 switch (
Result.getResultKind()) {
1236 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1237 << SomeDecl << NTK << llvm::to_underlying(Kind);
1243 << llvm::to_underlying(Kind) <<
Id << DC
1252 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1270 std::optional<unsigned> NumExpansions) {
1315 bool AllowInjectedClassName);
1328 bool AllowInjectedClassName);
1338 Decl *AssociatedDecl,
unsigned Index,
1341 ArgPack, AssociatedDecl, Index, Final);
1419 Then, ElseLoc, Else);
1473 Inc, RParenLoc, Body);
1518 bool IsVolatile,
unsigned NumOutputs,
1525 NumInputs, Names, Constraints, Exprs,
1526 AsmString, Clobbers, NumLabels, RParenLoc);
1535 StringRef AsmString,
1536 unsigned NumOutputs,
unsigned NumInputs,
1542 NumOutputs, NumInputs,
1543 Constraints, Clobbers, Exprs, EndLoc);
1572 CoawaitLoc, Operand, OpCoawaitLookup);
1576 Suspend.
get(),
true);
1676 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc,
1677 PrevMappedDirective);
1691 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1793 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1806 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1819 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1870 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1897 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1898 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1912 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1913 ReductionId, UnresolvedReductions);
1928 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1929 ReductionId, UnresolvedReductions);
1942 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1943 StepModifierLoc, EndLoc);
1956 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2016 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2029 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2044 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2045 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2046 ColonLoc, VarList, Locs,
2047 false, UnresolvedMappers);
2060 Allocate, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2083 ThreadLimit, StartLoc, LParenLoc, EndLoc);
2107 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2120 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2155 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2170 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2171 ColonLoc, VarList, Locs, UnresolvedMappers);
2186 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2187 ColonLoc, VarList, Locs, UnresolvedMappers);
2238 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2285 StartLoc, LParenLoc, EndLoc,
Data);
2298 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2310 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2323 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2334 LParenLoc, VarLoc, EndLoc);
2346 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2485 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2525 ForLoc, Element, Collection, RParenLoc);
2543 StartLoc, IdLoc,
Id);
2581 if (RangeStmt->isSingleDecl()) {
2582 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2583 if (RangeVar->isInvalidDecl())
2586 Expr *RangeExpr = RangeVar->getInit();
2593 diag::err_objc_for_range_init_stmt)
2594 <<
Init->getSourceRange();
2597 ForLoc, LoopVar, RangeExpr, RParenLoc);
2604 ForLoc, CoawaitLoc,
Init, ColonLoc,
Range,
Begin, End, Cond, Inc,
2618 QualifierLoc, NameInfo, Nested);
2680 SS.
Adopt(QualifierLoc);
2792 if (IsOMPArraySection)
2794 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2795 Stride, RBracketLoc);
2797 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2798 "Stride/second colon not allowed for OpenACC");
2801 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2813 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2825 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2835 Expr *ExecConfig =
nullptr) {
2837 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2844 nullptr, Callee, LParenLoc, Args, RParenLoc);
2862 if (!
Member->getDeclName()) {
2866 assert(
Member->getType()->isRecordType() &&
2867 "unnamed member not of record type?");
2880 if (!isArrow &&
Base->isPRValue()) {
2889 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2895 SS.
Adopt(QualifierLoc);
2909 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2910 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2911 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2914 ->getAsCXXRecordDecl()) {
2915 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2918 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2926 FirstQualifierInScope,
2927 R, ExplicitTemplateArgs,
3105 Expr *ControllingExpr,
3110 ControllingExpr, Types, Exprs);
3125 ControllingType, Types, Exprs);
3158 case Stmt::CXXStaticCastExprClass:
3159 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3160 RAngleLoc, LParenLoc,
3161 SubExpr, RParenLoc);
3163 case Stmt::CXXDynamicCastExprClass:
3164 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3165 RAngleLoc, LParenLoc,
3166 SubExpr, RParenLoc);
3168 case Stmt::CXXReinterpretCastExprClass:
3169 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3170 RAngleLoc, LParenLoc,
3174 case Stmt::CXXConstCastExprClass:
3175 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3176 RAngleLoc, LParenLoc,
3177 SubExpr, RParenLoc);
3179 case Stmt::CXXAddrspaceCastExprClass:
3180 return getDerived().RebuildCXXAddrspaceCastExpr(
3181 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3184 llvm_unreachable(
"Invalid C++ named cast");
3262 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3274 bool ListInitialization) {
3278 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3280 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3281 RParenLoc, ListInitialization);
3284 ListInitialization);
3348 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3358 bool IsThrownVariableInScope) {
3368 Expr *RewrittenExpr) {
3370 RewrittenExpr,
getSema().CurContext);
3405 std::optional<Expr *> ArraySize,
3424 bool IsGlobalDelete,
3475 bool IsAddressOfOperand,
3478 SS.
Adopt(QualifierLoc);
3480 if (TemplateArgs || TemplateKWLoc.
isValid())
3482 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3485 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3507 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3508 bool ListInitialization,
bool StdInitListInitialization,
3514 if (Constructor->isInheritingConstructor())
3515 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3518 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args,
Loc,
3525 HadMultipleCandidates,
3527 StdInitListInitialization,
3528 RequiresZeroInit, ConstructKind,
3536 bool ConstructsVBase,
3537 bool InheritedFromVBase) {
3539 Loc,
T, Constructor, ConstructsVBase, InheritedFromVBase);
3550 bool ListInitialization) {
3552 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3563 bool ListInitialization) {
3565 RParenLoc, ListInitialization);
3582 SS.
Adopt(QualifierLoc);
3585 OperatorLoc, IsArrow,
3587 FirstQualifierInScope,
3589 TemplateArgs,
nullptr);
3605 SS.
Adopt(QualifierLoc);
3608 OperatorLoc, IsArrow,
3610 FirstQualifierInScope,
3611 R, TemplateArgs,
nullptr);
3626 std::optional<unsigned> Length,
3629 RParenLoc, Length, PartialArgs);
3634 Expr *PackIdExpression,
Expr *IndexExpr,
3636 bool EmptyPack =
false) {
3638 IndexExpr, RSquareLoc, ExpandedExprs,
3668 NamedConcept, TALI);
3686 LocalParameters, RParenLoc, Requirements,
3740 Expr **Elements,
unsigned NumElements) {
3750 RB,
Base, Key, getterMethod, setterMethod);
3782 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3797 Sel, Method, LBracLoc,
3798 SelectorLocs, RBracLoc, Args);
3812 nullptr, SuperType, SuperLoc, Sel, Method, LBracLoc,
3813 SelectorLocs, RBracLoc, Args)
3815 Sel, Method, LBracLoc,
3816 SelectorLocs, RBracLoc, Args);
3825 bool IsArrow,
bool IsFreeIvar) {
3834 if (IsFreeIvar &&
Result.isUsable())
3835 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3871 PropertyLoc,
Base));
3903 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3912 CK_BuiltinFnToFnPtr).
get();
3938 std::optional<unsigned> NumExpansions) {
3943 EllipsisLoc, NumExpansions);
3965 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
3986 std::optional<unsigned> NumExpansions) {
3999 std::optional<unsigned> NumExpansions) {
4001 EllipsisLoc, RHS, RParenLoc,
4059 bool DeducibleTSTContext);
4071template <
typename Derived>
4076 switch (S->getStmtClass()) {
4081#define STMT(Node, Parent) \
4082 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4083#define VALUESTMT(Node, Parent) \
4084 case Stmt::Node##Class: \
4085 return getDerived().Transform##Node(cast<Node>(S), SDK);
4086#define ABSTRACT_STMT(Node)
4087#define EXPR(Node, Parent)
4088#include "clang/AST/StmtNodes.inc"
4091#define STMT(Node, Parent)
4092#define ABSTRACT_STMT(Stmt)
4093#define EXPR(Node, Parent) case Stmt::Node##Class:
4094#include "clang/AST/StmtNodes.inc"
4096 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4098 if (SDK == SDK_StmtExprResult)
4099 E = getSema().ActOnStmtExprResult(E);
4100 return getSema().ActOnExprStmt(E, SDK == SDK_Discarded);
4107template<
typename Derived>
4112 switch (S->getClauseKind()) {
4115#define GEN_CLANG_CLAUSE_CLASS
4116#define CLAUSE_CLASS(Enum, Str, Class) \
4118 return getDerived().Transform##Class(cast<Class>(S));
4119#include "llvm/Frontend/OpenMP/OMP.inc"
4126template<
typename Derived>
4133#define STMT(Node, Parent) case Stmt::Node##Class: break;
4134#define ABSTRACT_STMT(Stmt)
4135#define EXPR(Node, Parent) \
4136 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4137#include "clang/AST/StmtNodes.inc"
4143template<
typename Derived>
4151 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4152 Init = FE->getSubExpr();
4154 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4160 Init = MTE->getSubExpr();
4163 Init = Binder->getSubExpr();
4166 Init = ICE->getSubExprAsWritten();
4169 dyn_cast<CXXStdInitializerListExpr>(
Init))
4170 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4177 return getDerived().TransformExpr(
Init);
4182 return getDerived().RebuildParenListExpr(
Parens.getBegin(), std::nullopt,
4187 if (isa<ImplicitValueInitExpr>(
Init))
4188 return getDerived().RebuildParenListExpr(
SourceLocation(), std::nullopt,
4193 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4194 return getDerived().TransformExpr(
Init);
4199 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4206 getSema().keepInLifetimeExtendingContext();
4208 bool ArgChanged =
false;
4210 true, NewArgs, &ArgChanged))
4215 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4220 if (
Parens.isInvalid()) {
4223 assert(NewArgs.empty() &&
4224 "no parens or braces but have direct init with arguments?");
4227 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4231template<
typename Derived>
4237 for (
unsigned I = 0; I != NumInputs; ++I) {
4239 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4247 Expr *Pattern = Expansion->getPattern();
4250 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4251 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4256 bool RetainExpansion =
false;
4257 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4258 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4259 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4262 Expand, RetainExpansion,
4271 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4275 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4276 Expansion->getEllipsisLoc(),
4278 if (Out.isInvalid())
4283 Outputs.push_back(Out.get());
4289 if (ArgChanged) *ArgChanged =
true;
4293 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4295 ExprResult Out = getDerived().TransformExpr(Pattern);
4296 if (Out.isInvalid())
4299 if (Out.get()->containsUnexpandedParameterPack()) {
4300 Out = getDerived().RebuildPackExpansion(
4301 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4302 if (Out.isInvalid())
4306 Outputs.push_back(Out.get());
4311 if (RetainExpansion) {
4312 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4314 ExprResult Out = getDerived().TransformExpr(Pattern);
4315 if (Out.isInvalid())
4318 Out = getDerived().RebuildPackExpansion(
4319 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4320 if (Out.isInvalid())
4323 Outputs.push_back(Out.get());
4330 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4331 : getDerived().TransformExpr(Inputs[I]);
4335 if (
Result.get() != Inputs[I] && ArgChanged)
4338 Outputs.push_back(
Result.get());
4344template <
typename Derived>
4348 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4349 getDerived().TransformDefinition(Var->
getLocation(), Var));
4354 return getSema().ActOnConditionVariable(ConditionVar,
Loc, Kind);
4363 return getSema().ActOnCondition(
nullptr,
Loc, CondExpr.
get(), Kind,
4370template <
typename Derived>
4378 Qualifier = Qualifier.getPrefix())
4394 SS, FirstQualifierInScope,
false))
4401 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4409 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4424 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4433 FirstQualifierInScope, SS);
4443 diag::warn_cxx98_compat_enum_nested_name_spec);
4446 SS.
Adopt(ETL.getQualifierLoc());
4447 TL = ETL.getNamedTypeLoc();
4466 FirstQualifierInScope =
nullptr;
4472 !getDerived().AlwaysRebuild())
4485template<
typename Derived>
4493 switch (Name.getNameKind()) {
4504 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4505 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4506 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4522 NewTInfo = getDerived().TransformType(OldTInfo);
4530 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4546 llvm_unreachable(
"Unknown name kind.");
4549template<
typename Derived>
4556 bool AllowInjectedClassName) {
4558 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4559 assert(Template &&
"qualified template name must refer to a template");
4562 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4567 if (!getDerived().AlwaysRebuild() &&
4569 TransTemplate == Template)
4572 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4580 FirstQualifierInScope =
nullptr;
4583 if (!getDerived().AlwaysRebuild() &&
4591 if (DTN->isIdentifier()) {
4592 return getDerived().RebuildTemplateName(SS,
4594 *DTN->getIdentifier(),
4597 FirstQualifierInScope,
4598 AllowInjectedClassName);
4601 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4602 DTN->getOperator(), NameLoc,
4603 ObjectType, AllowInjectedClassName);
4606 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4608 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4613 if (!getDerived().AlwaysRebuild() &&
4614 TransTemplate == Template)
4621 = Name.getAsSubstTemplateTemplateParmPack()) {
4622 return getDerived().RebuildTemplateName(
4623 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4624 SubstPack->getIndex(), SubstPack->getFinal());
4628 llvm_unreachable(
"overloaded function decl survived to here");
4631template<
typename Derived>
4635 Output = getSema().getTrivialTemplateArgumentLoc(
4636 Arg,
QualType(), getDerived().getBaseLocation());
4639template <
typename Derived>
4647 llvm_unreachable(
"Unexpected TemplateArgument");
4657 QualType NewT = getDerived().TransformType(
T);
4664 ValueDecl *NewD = D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4665 getDerived().getBaseLocation(), D))
4670 if (NewT ==
T && D == NewD)
4687 llvm_unreachable(
"unexpected template argument kind");
4697 DI = getDerived().TransformType(DI);
4708 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4714 SS.
Adopt(QualifierLoc);
4715 TemplateName Template = getDerived().TransformTemplateName(
4726 llvm_unreachable(
"Caller should expand pack expansions");
4741 ExprResult E = getDerived().TransformExpr(InputExpr);
4756template<
typename Derived,
typename InputIterator>
4764 typedef typename std::iterator_traits<InputIterator>::difference_type
4794 Self.InventTemplateArgumentLoc(*
Iter,
Result);
4802 return X.Iter == Y.Iter;
4807 return X.Iter != Y.Iter;
4811template<
typename Derived>
4812template<
typename InputIterator>
4829 if (TransformTemplateArguments(PackLocIterator(*
this,
4830 In.getArgument().pack_begin()),
4831 PackLocIterator(*
this,
4832 In.getArgument().pack_end()),
4839 if (In.getArgument().isPackExpansion()) {
4843 std::optional<unsigned> OrigNumExpansions;
4845 = getSema().getTemplateArgumentPackExpansionPattern(
4846 In, Ellipsis, OrigNumExpansions);
4849 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4850 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4855 bool RetainExpansion =
false;
4856 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4857 if (getDerived().TryExpandParameterPacks(Ellipsis,
4871 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
4874 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
4876 if (Out.getArgument().isNull())
4885 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4888 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4891 if (Out.getArgument().containsUnexpandedParameterPack()) {
4892 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4894 if (Out.getArgument().isNull())
4903 if (RetainExpansion) {
4904 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4906 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4909 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4911 if (Out.getArgument().isNull())
4921 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
4935template<
typename Derived>
4937 if (getDerived().AlreadyTransformed(
T))
4943 getDerived().getBaseLocation());
4953template<
typename Derived>
4957 getDerived().getBaseEntity());
4958 if (getDerived().AlreadyTransformed(DI->
getType()))
4973template<
typename Derived>
4976 switch (
T.getTypeLocClass()) {
4977#define ABSTRACT_TYPELOC(CLASS, PARENT)
4978#define TYPELOC(CLASS, PARENT) \
4979 case TypeLoc::CLASS: \
4980 return getDerived().Transform##CLASS##Type(TLB, \
4981 T.castAs<CLASS##TypeLoc>());
4982#include "clang/AST/TypeLocNodes.def"
4985 llvm_unreachable(
"unhandled type loc!");
4988template<
typename Derived>
4990 if (!isa<DependentNameType>(
T))
4991 return TransformType(
T);
4993 if (getDerived().AlreadyTransformed(
T))
4996 getDerived().getBaseLocation());
4997 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
5001template<
typename Derived>
5004 if (!isa<DependentNameType>(DI->
getType()))
5005 return TransformType(DI);
5009 getDerived().getBaseEntity());
5010 if (getDerived().AlreadyTransformed(DI->
getType()))
5030 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5039template<
typename Derived>
5044 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5045 auto SuppressObjCLifetime =
5046 T.getType().getLocalQualifiers().hasObjCLifetime();
5048 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5049 SuppressObjCLifetime);
5050 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5051 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5052 TLB, STTP, SuppressObjCLifetime);
5054 Result = getDerived().TransformType(TLB, UnqualTL);
5073template <
typename Derived>
5083 SemaRef.
Diag(
Loc, diag::err_address_space_mismatch_templ_inst)
5114 else if (
T.getObjCLifetime()) {
5119 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->
isDeduced()) {
5135 SemaRef.
Diag(
Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5144template<
typename Derived>
5150 if (getDerived().AlreadyTransformed(TL.
getType()))
5154 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5160template<
typename Derived>
5162TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5163 QualType ObjectType,
5164 NamedDecl *UnqualLookup,
5166 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5169 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5173template <
typename Derived>
5174TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5175 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5177 QualType
T = TL.getType();
5178 assert(!getDerived().AlreadyTransformed(
T));
5183 if (isa<TemplateSpecializationType>(
T)) {
5184 TemplateSpecializationTypeLoc SpecTL =
5185 TL.castAs<TemplateSpecializationTypeLoc>();
5187 TemplateName Template = getDerived().TransformTemplateName(
5188 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5189 ObjectType, UnqualLookup,
true);
5190 if (Template.isNull())
5193 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5195 }
else if (isa<DependentTemplateSpecializationType>(
T)) {
5196 DependentTemplateSpecializationTypeLoc SpecTL =
5197 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5199 TemplateName Template
5200 = getDerived().RebuildTemplateName(SS,
5201 SpecTL.getTemplateKeywordLoc(),
5202 *SpecTL.getTypePtr()->getIdentifier(),
5203 SpecTL.getTemplateNameLoc(),
5204 ObjectType, UnqualLookup,
5206 if (Template.isNull())
5209 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5215 Result = getDerived().TransformType(TLB, TL);
5224template <
class TyLoc>
static inline
5226 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5227 NewT.setNameLoc(
T.getNameLoc());
5231template<
typename Derived>
5232QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5234 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(
T.getType());
5235 NewT.setBuiltinLoc(
T.getBuiltinLoc());
5236 if (
T.needsExtraLocalData())
5237 NewT.getWrittenBuiltinSpecs() =
T.getWrittenBuiltinSpecs();
5241template<
typename Derived>
5242QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5248template <
typename Derived>
5249QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5250 AdjustedTypeLoc TL) {
5252 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5255template<
typename Derived>
5256QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5257 DecayedTypeLoc TL) {
5258 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5259 if (OriginalType.isNull())
5262 QualType
Result = TL.getType();
5263 if (getDerived().AlwaysRebuild() ||
5264 OriginalType != TL.getOriginalLoc().getType())
5266 TLB.push<DecayedTypeLoc>(
Result);
5271template <
typename Derived>
5273TreeTransform<Derived>::TransformArrayParameterType(TypeLocBuilder &TLB,
5274 ArrayParameterTypeLoc TL) {
5275 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5276 if (OriginalType.isNull())
5279 QualType
Result = TL.getType();
5280 if (getDerived().AlwaysRebuild() ||
5281 OriginalType != TL.getElementLoc().getType())
5283 TLB.push<ArrayParameterTypeLoc>(
Result);
5288template<
typename Derived>
5289QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5290 PointerTypeLoc TL) {
5291 QualType PointeeType
5292 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5293 if (PointeeType.isNull())
5296 QualType
Result = TL.getType();
5297 if (PointeeType->getAs<ObjCObjectType>()) {
5304 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5305 NewT.setStarLoc(TL.getStarLoc());
5309 if (getDerived().AlwaysRebuild() ||
5310 PointeeType != TL.getPointeeLoc().getType()) {
5311 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5318 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5320 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5321 NewT.setSigilLoc(TL.getSigilLoc());
5325template<
typename Derived>
5327TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5328 BlockPointerTypeLoc TL) {
5329 QualType PointeeType
5330 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5331 if (PointeeType.isNull())
5334 QualType
Result = TL.getType();
5335 if (getDerived().AlwaysRebuild() ||
5336 PointeeType != TL.getPointeeLoc().getType()) {
5337 Result = getDerived().RebuildBlockPointerType(PointeeType,
5343 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5344 NewT.setSigilLoc(TL.getSigilLoc());
5352template<
typename Derived>
5360 if (PointeeType.
isNull())
5364 if (getDerived().AlwaysRebuild() ||
5365 PointeeType !=
T->getPointeeTypeAsWritten()) {
5366 Result = getDerived().RebuildReferenceType(PointeeType,
5367 T->isSpelledAsLValue(),
5380 if (isa<LValueReferenceType>(
Result))
5389template<
typename Derived>
5393 return TransformReferenceType(TLB, TL);
5396template<
typename Derived>
5398TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5399 RValueReferenceTypeLoc TL) {
5400 return TransformReferenceType(TLB, TL);
5403template<
typename Derived>
5405TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5406 MemberPointerTypeLoc TL) {
5407 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5408 if (PointeeType.isNull())
5411 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5412 TypeSourceInfo *NewClsTInfo =
nullptr;
5414 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5419 const MemberPointerType *
T = TL.getTypePtr();
5420 QualType OldClsType = QualType(
T->getClass(), 0);
5421 QualType NewClsType;
5423 NewClsType = NewClsTInfo->getType();
5425 NewClsType = getDerived().TransformType(OldClsType);
5426 if (NewClsType.isNull())
5430 QualType
Result = TL.getType();
5431 if (getDerived().AlwaysRebuild() ||
5433 NewClsType != OldClsType) {
5434 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5442 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5443 if (MPT && PointeeType != MPT->getPointeeType()) {
5444 assert(isa<AdjustedType>(MPT->getPointeeType()));
5445 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5448 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5449 NewTL.setSigilLoc(TL.getSigilLoc());
5450 NewTL.setClassTInfo(NewClsTInfo);
5455template<
typename Derived>
5457TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5458 ConstantArrayTypeLoc TL) {
5459 const ConstantArrayType *
T = TL.getTypePtr();
5460 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5461 if (ElementType.isNull())
5465 Expr *OldSize = TL.getSizeExpr();
5467 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5468 Expr *NewSize =
nullptr;
5472 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5476 QualType
Result = TL.getType();
5477 if (getDerived().AlwaysRebuild() ||
5478 ElementType !=
T->getElementType() ||
5479 (
T->getSizeExpr() && NewSize != OldSize)) {
5480 Result = getDerived().RebuildConstantArrayType(ElementType,
5481 T->getSizeModifier(),
5482 T->getSize(), NewSize,
5483 T->getIndexTypeCVRQualifiers(),
5484 TL.getBracketsRange());
5493 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5494 NewTL.setLBracketLoc(TL.getLBracketLoc());
5495 NewTL.setRBracketLoc(TL.getRBracketLoc());
5496 NewTL.setSizeExpr(NewSize);
5501template<
typename Derived>
5502QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5503 TypeLocBuilder &TLB,
5504 IncompleteArrayTypeLoc TL) {
5505 const IncompleteArrayType *
T = TL.getTypePtr();
5506 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5507 if (ElementType.isNull())
5510 QualType
Result = TL.getType();
5511 if (getDerived().AlwaysRebuild() ||
5512 ElementType !=
T->getElementType()) {
5513 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5514 T->getSizeModifier(),
5515 T->getIndexTypeCVRQualifiers(),
5516 TL.getBracketsRange());
5521 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5522 NewTL.setLBracketLoc(TL.getLBracketLoc());
5523 NewTL.setRBracketLoc(TL.getRBracketLoc());
5524 NewTL.setSizeExpr(
nullptr);
5529template<
typename Derived>
5531TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5532 VariableArrayTypeLoc TL) {
5533 const VariableArrayType *
T = TL.getTypePtr();
5534 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5535 if (ElementType.isNull())
5540 EnterExpressionEvaluationContext Context(
5542 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5544 if (SizeResult.isInvalid())
5548 if (SizeResult.isInvalid())
5551 Expr *
Size = SizeResult.get();
5553 QualType
Result = TL.getType();
5554 if (getDerived().AlwaysRebuild() ||
5555 ElementType !=
T->getElementType() ||
5556 Size !=
T->getSizeExpr()) {
5557 Result = getDerived().RebuildVariableArrayType(ElementType,
5558 T->getSizeModifier(),
5560 T->getIndexTypeCVRQualifiers(),
5561 TL.getBracketsRange());
5568 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5569 NewTL.setLBracketLoc(TL.getLBracketLoc());
5570 NewTL.setRBracketLoc(TL.getRBracketLoc());
5571 NewTL.setSizeExpr(Size);
5576template<
typename Derived>
5578TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5579 DependentSizedArrayTypeLoc TL) {
5580 const DependentSizedArrayType *
T = TL.getTypePtr();
5581 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5582 if (ElementType.isNull())
5590 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5593 Expr *origSize = TL.getSizeExpr();
5594 if (!origSize) origSize =
T->getSizeExpr();
5597 = getDerived().TransformExpr(origSize);
5599 if (sizeResult.isInvalid())
5602 Expr *size = sizeResult.get();
5604 QualType
Result = TL.getType();
5605 if (getDerived().AlwaysRebuild() ||
5606 ElementType !=
T->getElementType() ||
5608 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5609 T->getSizeModifier(),
5611 T->getIndexTypeCVRQualifiers(),
5612 TL.getBracketsRange());
5619 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5620 NewTL.setLBracketLoc(TL.getLBracketLoc());
5621 NewTL.setRBracketLoc(TL.getRBracketLoc());
5622 NewTL.setSizeExpr(size);
5627template <
typename Derived>
5628QualType TreeTransform<Derived>::TransformDependentVectorType(
5629 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5630 const DependentVectorType *
T = TL.getTypePtr();
5631 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5632 if (ElementType.isNull())
5640 if (
Size.isInvalid())
5643 QualType
Result = TL.getType();
5644 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5645 Size.get() !=
T->getSizeExpr()) {
5646 Result = getDerived().RebuildDependentVectorType(
5647 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5653 if (isa<DependentVectorType>(
Result)) {
5654 DependentVectorTypeLoc NewTL =
5655 TLB.push<DependentVectorTypeLoc>(
Result);
5656 NewTL.setNameLoc(TL.getNameLoc());
5658 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5659 NewTL.setNameLoc(TL.getNameLoc());
5665template<
typename Derived>
5666QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5667 TypeLocBuilder &TLB,
5668 DependentSizedExtVectorTypeLoc TL) {
5669 const DependentSizedExtVectorType *
T = TL.getTypePtr();
5672 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5673 if (ElementType.isNull())
5682 if (
Size.isInvalid())
5685 QualType
Result = TL.getType();
5686 if (getDerived().AlwaysRebuild() ||
5687 ElementType !=
T->getElementType() ||
5688 Size.get() !=
T->getSizeExpr()) {
5689 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5691 T->getAttributeLoc());
5697 if (isa<DependentSizedExtVectorType>(
Result)) {
5698 DependentSizedExtVectorTypeLoc NewTL
5699 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5700 NewTL.setNameLoc(TL.getNameLoc());
5702 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5703 NewTL.setNameLoc(TL.getNameLoc());
5709template <
typename Derived>
5711TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5712 ConstantMatrixTypeLoc TL) {
5713 const ConstantMatrixType *
T = TL.getTypePtr();
5714 QualType ElementType = getDerived().TransformType(
T->getElementType());
5715 if (ElementType.isNull())
5718 QualType
Result = TL.getType();
5719 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
5720 Result = getDerived().RebuildConstantMatrixType(
5721 ElementType,
T->getNumRows(),
T->getNumColumns());
5726 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5727 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5728 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5729 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5730 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5735template <
typename Derived>
5736QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5737 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5738 const DependentSizedMatrixType *
T = TL.getTypePtr();
5740 QualType ElementType = getDerived().TransformType(
T->getElementType());
5741 if (ElementType.isNull()) {
5749 Expr *origRows = TL.getAttrRowOperand();
5751 origRows =
T->getRowExpr();
5752 Expr *origColumns = TL.getAttrColumnOperand();
5754 origColumns =
T->getColumnExpr();
5756 ExprResult rowResult = getDerived().TransformExpr(origRows);
5758 if (rowResult.isInvalid())
5761 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5763 if (columnResult.isInvalid())
5766 Expr *rows = rowResult.get();
5767 Expr *columns = columnResult.get();
5769 QualType
Result = TL.getType();
5770 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5771 rows != origRows || columns != origColumns) {
5772 Result = getDerived().RebuildDependentSizedMatrixType(
5773 ElementType, rows, columns,
T->getAttributeLoc());
5781 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5782 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5783 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5784 NewTL.setAttrRowOperand(rows);
5785 NewTL.setAttrColumnOperand(columns);
5789template <
typename Derived>
5790QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5791 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5792 const DependentAddressSpaceType *
T = TL.getTypePtr();
5794 QualType pointeeType = getDerived().TransformType(
T->
getPointeeType());
5796 if (pointeeType.isNull())
5803 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
5805 if (AddrSpace.isInvalid())
5808 QualType
Result = TL.getType();
5809 if (getDerived().AlwaysRebuild() || pointeeType !=
T->
getPointeeType() ||
5810 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
5811 Result = getDerived().RebuildDependentAddressSpaceType(
5812 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
5818 if (isa<DependentAddressSpaceType>(
Result)) {
5819 DependentAddressSpaceTypeLoc NewTL =
5820 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
5822 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5823 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
5824 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5827 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(
5828 Result, getDerived().getBaseLocation());
5829 TransformType(TLB, DI->getTypeLoc());
5835template <
typename Derived>
5836QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
5838 const VectorType *
T = TL.getTypePtr();
5839 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5840 if (ElementType.isNull())
5843 QualType
Result = TL.getType();
5844 if (getDerived().AlwaysRebuild() ||
5845 ElementType !=
T->getElementType()) {
5846 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
5847 T->getVectorKind());
5852 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5853 NewTL.setNameLoc(TL.getNameLoc());
5858template<
typename Derived>
5859QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
5860 ExtVectorTypeLoc TL) {
5861 const VectorType *
T = TL.getTypePtr();
5862 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5863 if (ElementType.isNull())
5866 QualType
Result = TL.getType();
5867 if (getDerived().AlwaysRebuild() ||
5868 ElementType !=
T->getElementType()) {
5869 Result = getDerived().RebuildExtVectorType(ElementType,
5870 T->getNumElements(),
5876 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5877 NewTL.setNameLoc(TL.getNameLoc());
5882template <
typename Derived>
5885 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
5889 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
5916 NewDI = getDerived().TransformType(OldDI);
5920 if (NewDI == OldDI && indexAdjustment == 0)
5934 transformedLocalDecl(OldParm, {newParm});
5938template <
typename Derived>
5946 unsigned *LastParamTransformed) {
5947 int indexAdjustment = 0;
5949 unsigned NumParams = Params.size();
5950 for (
unsigned i = 0; i != NumParams; ++i) {
5951 if (LastParamTransformed)
5952 *LastParamTransformed = i;
5954 assert(OldParm->getFunctionScopeIndex() == i);
5956 std::optional<unsigned> NumExpansions;
5958 if (OldParm->isParameterPack()) {
5963 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
5969 bool ShouldExpand =
false;
5970 bool RetainExpansion =
false;
5971 std::optional<unsigned> OrigNumExpansions;
5972 if (Unexpanded.size() > 0) {
5974 NumExpansions = OrigNumExpansions;
5975 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
5976 Pattern.getSourceRange(),
5988 "Could not find parameter packs or undeduced auto type!");
5995 getDerived().ExpandingFunctionParameterPack(OldParm);
5996 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5999 = getDerived().TransformFunctionTypeParam(OldParm,
6007 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6008 OutParamTypes.push_back(NewParm->
getType());
6010 PVars->push_back(NewParm);
6015 if (RetainExpansion) {
6016 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6018 = getDerived().TransformFunctionTypeParam(OldParm,
6026 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6027 OutParamTypes.push_back(NewParm->
getType());
6029 PVars->push_back(NewParm);
6045 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6050 "Parameter pack no longer a parameter pack after "
6053 NewParm = getDerived().TransformFunctionTypeParam(
6054 OldParm, indexAdjustment, std::nullopt,
6062 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6063 OutParamTypes.push_back(NewParm->
getType());
6065 PVars->push_back(NewParm);
6073 bool IsPackExpansion =
false;
6074 std::optional<unsigned> NumExpansions;
6077 = dyn_cast<PackExpansionType>(OldType)) {
6079 QualType Pattern = Expansion->getPattern();
6081 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6084 bool ShouldExpand =
false;
6085 bool RetainExpansion =
false;
6097 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6099 QualType NewType = getDerived().TransformType(Pattern);
6104 NewType = getSema().getASTContext().getPackExpansionType(
6105 NewType, std::nullopt);
6112 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6113 OutParamTypes.push_back(NewType);
6115 PVars->push_back(
nullptr);
6124 if (RetainExpansion) {
6125 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6126 QualType NewType = getDerived().TransformType(Pattern);
6131 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6132 OutParamTypes.push_back(NewType);
6134 PVars->push_back(
nullptr);
6139 OldType = Expansion->getPattern();
6140 IsPackExpansion =
true;
6142 NewType = getDerived().TransformType(OldType);
6144 NewType = getDerived().TransformType(OldType);
6150 if (IsPackExpansion)
6151 NewType = getSema().Context.getPackExpansionType(NewType,
6155 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6156 OutParamTypes.push_back(NewType);
6158 PVars->push_back(
nullptr);
6163 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6165 assert(parm->getFunctionScopeIndex() == i);
6172template<
typename Derived>
6177 return getDerived().TransformFunctionProtoType(
6180 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6181 ExceptionStorage, Changed);
6185template<
typename Derived>
template<
typename Fn>
6188 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6205 if (getDerived().TransformFunctionTypeParams(
6209 ParamTypes, &ParamDecls, ExtParamInfos))
6221 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6223 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6229 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6233 if (getDerived().TransformFunctionTypeParams(
6237 ParamTypes, &ParamDecls, ExtParamInfos))
6243 bool EPIChanged =
false;
6248 if (
auto NewExtParamInfos =
6262 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType() ||
6264 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6275 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6281template<
typename Derived>
6291 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6293 SemaRef, Method ? Method->getParent() :
nullptr,
6294 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6304 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6327 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6332 bool Expand =
false;
6333 bool RetainExpansion =
false;
6334 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6337 if (getDerived().TryExpandParameterPacks(
6339 RetainExpansion, NumExpansions))
6347 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6352 Exceptions.push_back(
U);
6358 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6361 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6365 Exceptions.push_back(
U);
6374 Exceptions.push_back(
U);
6384template<
typename Derived>
6394 if (getDerived().AlwaysRebuild() || ResultType !=
T->
getReturnType())
6395 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6406template <
typename Derived>
6407QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6408 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6409 const UnresolvedUsingType *
T = TL.getTypePtr();
6410 Decl *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6414 QualType
Result = TL.getType();
6415 if (getDerived().AlwaysRebuild() || D !=
T->getDecl()) {
6416 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(), D);
6423 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6424 NewTL.setNameLoc(TL.getNameLoc());
6429template <
typename Derived>
6430QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6432 const UsingType *
T = TL.getTypePtr();
6434 auto *Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6435 TL.getLocalSourceRange().getBegin(),
T->getFoundDecl()));
6439 QualType Underlying = getDerived().TransformType(
T->
desugar());
6440 if (Underlying.isNull())
6443 QualType
Result = TL.getType();
6444 if (getDerived().AlwaysRebuild() || Found !=
T->getFoundDecl() ||
6445 Underlying !=
T->getUnderlyingType()) {
6446 Result = getDerived().RebuildUsingType(Found, Underlying);
6451 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6455template<
typename Derived>
6456QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6457 TypedefTypeLoc TL) {
6458 const TypedefType *
T = TL.getTypePtr();
6459 TypedefNameDecl *Typedef
6460 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6465 QualType
Result = TL.getType();
6466 if (getDerived().AlwaysRebuild() ||
6467 Typedef !=
T->getDecl()) {
6468 Result = getDerived().RebuildTypedefType(Typedef);
6473 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6474 NewTL.setNameLoc(TL.getNameLoc());
6479template<
typename Derived>
6480QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6481 TypeOfExprTypeLoc TL) {
6487 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6495 QualType
Result = TL.getType();
6497 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6499 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6504 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6505 NewTL.setTypeofLoc(TL.getTypeofLoc());
6506 NewTL.setLParenLoc(TL.getLParenLoc());
6507 NewTL.setRParenLoc(TL.getRParenLoc());
6512template<
typename Derived>
6513QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6515 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6516 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6520 QualType
Result = TL.getType();
6522 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6523 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6528 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6529 NewTL.setTypeofLoc(TL.getTypeofLoc());
6530 NewTL.setLParenLoc(TL.getLParenLoc());
6531 NewTL.setRParenLoc(TL.getRParenLoc());
6532 NewTL.setUnmodifiedTInfo(New_Under_TI);
6537template<
typename Derived>
6538QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6539 DecltypeTypeLoc TL) {
6540 const DecltypeType *
T = TL.getTypePtr();
6547 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6551 E = getSema().ActOnDecltypeExpression(E.get());
6555 QualType
Result = TL.getType();
6556 if (getDerived().AlwaysRebuild() ||
6557 E.get() !=
T->getUnderlyingExpr()) {
6558 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
6564 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6565 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6566 NewTL.setRParenLoc(TL.getRParenLoc());
6570template <
typename Derived>
6572TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6573 PackIndexingTypeLoc TL) {
6575 ExprResult IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6576 if (IndexExpr.isInvalid())
6578 QualType Pattern = TL.getPattern();
6580 const PackIndexingType *PIT = TL.getTypePtr();
6584 bool NotYetExpanded = Types.empty();
6585 bool FullySubstituted =
true;
6590 for (
const QualType &
T : Types) {
6592 QualType Transformed = getDerived().TransformType(
T);
6593 if (Transformed.isNull())
6595 SubtitutedTypes.push_back(Transformed);
6600 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
6601 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6604 bool ShouldExpand =
true;
6605 bool RetainExpansion =
false;
6606 std::optional<unsigned> OrigNumExpansions;
6607 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6608 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6609 Unexpanded, ShouldExpand,
6610 RetainExpansion, NumExpansions))
6612 if (!ShouldExpand) {
6613 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6616 TypeSourceInfo *TI =
6618 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6621 if (NotYetExpanded) {
6622 FullySubstituted =
false;
6623 QualType Out = getDerived().RebuildPackIndexingType(
6624 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6629 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6630 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6633 SubtitutedTypes.push_back(Pack);
6636 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6637 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6638 QualType Out = getDerived().TransformType(
T);
6641 SubtitutedTypes.push_back(Out);
6645 if (RetainExpansion) {
6646 FullySubstituted =
false;
6647 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6648 QualType Out = getDerived().TransformType(
T);
6651 SubtitutedTypes.push_back(Out);
6658 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6659 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6661 QualType Out = getDerived().RebuildPackIndexingType(
6662 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6663 FullySubstituted, SubtitutedTypes);
6667 PackIndexingTypeLoc
Loc = TLB.push<PackIndexingTypeLoc>(Out);
6668 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6672template<
typename Derived>
6673QualType TreeTransform<Derived>::TransformUnaryTransformType(
6674 TypeLocBuilder &TLB,
6675 UnaryTransformTypeLoc TL) {
6676 QualType
Result = TL.getType();
6677 if (
Result->isDependentType()) {
6678 const UnaryTransformType *
T = TL.getTypePtr();
6680 getDerived().TransformType(TL.getUnderlyingTInfo())->getType();
6681 Result = getDerived().RebuildUnaryTransformType(NewBase,
6688 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6689 NewTL.setKWLoc(TL.getKWLoc());
6690 NewTL.setParensRange(TL.getParensRange());
6691 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6695template<
typename Derived>
6696QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6697 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6698 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
6701 TemplateName TemplateName = getDerived().TransformTemplateName(
6702 SS,
T->getTemplateName(), TL.getTemplateNameLoc());
6703 if (TemplateName.isNull())
6706 QualType OldDeduced =
T->getDeducedType();
6707 QualType NewDeduced;
6708 if (!OldDeduced.isNull()) {
6709 NewDeduced = getDerived().TransformType(OldDeduced);
6710 if (NewDeduced.isNull())
6714 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6715 TemplateName, NewDeduced);
6719 DeducedTemplateSpecializationTypeLoc NewTL =
6720 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6721 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6726template<
typename Derived>
6727QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6729 const RecordType *
T = TL.getTypePtr();
6731 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6736 QualType
Result = TL.getType();
6737 if (getDerived().AlwaysRebuild() ||
6744 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6745 NewTL.setNameLoc(TL.getNameLoc());
6750template<
typename Derived>
6751QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
6753 const EnumType *
T = TL.getTypePtr();
6755 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6760 QualType
Result = TL.getType();
6761 if (getDerived().AlwaysRebuild() ||
6762 Enum !=
T->getDecl()) {
6768 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
6769 NewTL.setNameLoc(TL.getNameLoc());
6774template<
typename Derived>
6775QualType TreeTransform<Derived>::TransformInjectedClassNameType(
6776 TypeLocBuilder &TLB,
6777 InjectedClassNameTypeLoc TL) {
6778 Decl *D = getDerived().TransformDecl(TL.getNameLoc(),
6779 TL.getTypePtr()->getDecl());
6780 if (!D)
return QualType();
6783 TLB.pushTypeSpec(
T).setNameLoc(TL.getNameLoc());
6787template<
typename Derived>
6791 return getDerived().TransformTemplateTypeParmType(
6796template <
typename Derived>
6802template<
typename Derived>
6803QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
6804 TypeLocBuilder &TLB,
6805 SubstTemplateTypeParmTypeLoc TL) {
6806 const SubstTemplateTypeParmType *
T = TL.getTypePtr();
6809 getDerived().TransformDecl(TL.getNameLoc(),
T->getAssociatedDecl());
6814 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
6815 QualType Replacement = getDerived().TransformType(
T->getReplacementType());
6816 if (Replacement.isNull())
6820 Replacement, NewReplaced,
T->getIndex(),
T->getPackIndex());
6823 SubstTemplateTypeParmTypeLoc NewTL
6824 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
6825 NewTL.setNameLoc(TL.getNameLoc());
6830template<
typename Derived>
6834 return getDerived().TransformSubstTemplateTypeParmPackType(
6838template <
typename Derived>
6844template<
typename Derived>
6854 = getDerived().TransformTemplateName(SS,
T->getTemplateName(),
6859 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
6862template<
typename Derived>
6870 if (getDerived().AlwaysRebuild() ||
6872 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
6877 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
6885template <
typename Derived>
6886QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
6888 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
6889 if (ValueType.isNull())
6892 QualType
Result = TL.getType();
6893 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
6894 const PipeType *PT =
Result->castAs<PipeType>();
6895 bool isReadPipe = PT->isReadOnly();
6896 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
6901 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
6902 NewTL.setKWLoc(TL.getKWLoc());
6907template <
typename Derived>
6908QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
6910 const BitIntType *EIT = TL.getTypePtr();
6911 QualType
Result = TL.getType();
6913 if (getDerived().AlwaysRebuild()) {
6914 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
6915 EIT->getNumBits(), TL.getNameLoc());
6920 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
6921 NewTL.setNameLoc(TL.getNameLoc());
6925template <
typename Derived>
6926QualType TreeTransform<Derived>::TransformDependentBitIntType(
6927 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
6928 const DependentBitIntType *EIT = TL.getTypePtr();
6932 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
6935 if (BitsExpr.isInvalid())
6938 QualType
Result = TL.getType();
6940 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
6941 Result = getDerived().RebuildDependentBitIntType(
6942 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
6948 if (isa<DependentBitIntType>(
Result)) {
6949 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
6950 NewTL.setNameLoc(TL.getNameLoc());
6952 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
6953 NewTL.setNameLoc(TL.getNameLoc());
6963 template<
typename ArgLocContainer>
6965 ArgLocContainer *Container;
6990 : Container(&Container), Index(Index) { }
7004 return Container->getArgLoc(Index);
7008 return pointer(Container->getArgLoc(Index));
7013 return X.Container == Y.Container &&
X.Index == Y.Index;
7022template<
typename Derived>
7023QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7025 const AutoType *
T = TL.getTypePtr();
7026 QualType OldDeduced =
T->getDeducedType();
7027 QualType NewDeduced;
7028 if (!OldDeduced.isNull()) {
7029 NewDeduced = getDerived().TransformType(OldDeduced);
7030 if (NewDeduced.isNull())
7034 ConceptDecl *NewCD =
nullptr;
7035 TemplateArgumentListInfo NewTemplateArgs;
7036 NestedNameSpecifierLoc NewNestedNameSpec;
7037 if (
T->isConstrained()) {
7038 assert(TL.getConceptReference());
7039 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7040 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7042 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7043 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7044 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
7045 if (getDerived().TransformTemplateArguments(
7046 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7050 if (TL.getNestedNameSpecifierLoc()) {
7052 = getDerived().TransformNestedNameSpecifierLoc(
7053 TL.getNestedNameSpecifierLoc());
7054 if (!NewNestedNameSpec)
7059 QualType
Result = TL.getType();
7060 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7064 NewArgList.reserve(NewTemplateArgs.size());
7065 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7066 NewArgList.push_back(ArgLoc.getArgument());
7067 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7073 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7074 NewTL.setNameLoc(TL.getNameLoc());
7075 NewTL.setRParenLoc(TL.getRParenLoc());
7076 NewTL.setConceptReference(
nullptr);
7078 if (
T->isConstrained()) {
7079 DeclarationNameInfo DNI = DeclarationNameInfo(
7080 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7081 TL.getConceptNameLoc(),
7082 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7084 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7085 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7087 NewTL.setConceptReference(CR);
7093template <
typename Derived>
7095 TypeLocBuilder &TLB,
7096 TemplateSpecializationTypeLoc TL,
7097 TemplateName Template) {
7098 TemplateArgumentListInfo NewTemplateArgs;
7099 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7100 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7101 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7103 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7104 ArgIterator(TL, TL.getNumArgs()),
7111 getDerived().RebuildTemplateSpecializationType(Template,
7112 TL.getTemplateNameLoc(),
7120 if (isa<DependentTemplateSpecializationType>(
Result)) {
7121 DependentTemplateSpecializationTypeLoc NewTL
7122 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7123 NewTL.setElaboratedKeywordLoc(SourceLocation());
7124 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7125 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7126 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7127 NewTL.setLAngleLoc(TL.getLAngleLoc());
7128 NewTL.setRAngleLoc(TL.getRAngleLoc());
7129 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7130 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7134 TemplateSpecializationTypeLoc NewTL
7135 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7136 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7137 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7138 NewTL.setLAngleLoc(TL.getLAngleLoc());
7139 NewTL.setRAngleLoc(TL.getRAngleLoc());
7140 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7141 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7147template <
typename Derived>
7158 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7166 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7168 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7178 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7184 = getDerived().RebuildTemplateSpecializationType(Template,
7196 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7203template<
typename Derived>
7218 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7219 if (NamedT.isNull())
7228 if (
const TemplateSpecializationType *TST =
7229 NamedT->getAs<TemplateSpecializationType>()) {
7230 TemplateName Template = TST->getTemplateName();
7231 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7232 Template.getAsTemplateDecl())) {
7234 diag::err_tag_reference_non_tag)
7236 << llvm::to_underlying(
7238 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7244 if (getDerived().AlwaysRebuild() ||
7246 NamedT !=
T->getNamedType()) {
7249 QualifierLoc, NamedT);
7254 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7256 NewTL.setQualifierLoc(QualifierLoc);
7260template <
typename Derived>
7261template <
typename Fn>
7266 if (modifiedType.
isNull())
7271 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7272 if (oldAttr && !newAttr)
7278 if (getDerived().AlwaysRebuild() ||
7284 if (equivalentType.
isNull())
7293 diag::err_nullability_nonpointer)
7309template <
typename Derived>
7312 return getDerived().TransformAttributedType(
7314 return getDerived().TransformType(TLB, ModifiedLoc);
7318template <
typename Derived>
7327 Expr *NewCount =
nullptr;
7329 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7332 NewCount = CountResult.
get();
7336 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->
desugar() ||
7337 OldCount != NewCount) {
7346template <
typename Derived>
7347QualType TreeTransform<Derived>::TransformBTFTagAttributedType(
7348 TypeLocBuilder &TLB, BTFTagAttributedTypeLoc TL) {
7350 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7353template<
typename Derived>
7355TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7357 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7361 QualType
Result = TL.getType();
7362 if (getDerived().AlwaysRebuild() ||
7363 Inner != TL.getInnerLoc().getType()) {
7364 Result = getDerived().RebuildParenType(Inner);
7369 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7370 NewTL.setLParenLoc(TL.getLParenLoc());
7371 NewTL.setRParenLoc(TL.getRParenLoc());
7375template <
typename Derived>
7377TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7378 MacroQualifiedTypeLoc TL) {
7379 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7383 QualType
Result = TL.getType();
7384 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7386 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7391 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7392 NewTL.setExpansionLoc(TL.getExpansionLoc());
7396template<
typename Derived>
7397QualType TreeTransform<Derived>::TransformDependentNameType(
7398 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7399 return TransformDependentNameType(TLB, TL,
false);
7402template<
typename Derived>
7403QualType TreeTransform<Derived>::TransformDependentNameType(
7404 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7405 const DependentNameType *
T = TL.getTypePtr();
7407 NestedNameSpecifierLoc QualifierLoc
7408 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7413 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7414 TL.getElaboratedKeywordLoc(),
7422 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7423 QualType NamedT = ElabT->getNamedType();
7424 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7426 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7427 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7428 NewTL.setQualifierLoc(QualifierLoc);
7430 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7431 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7432 NewTL.setQualifierLoc(QualifierLoc);
7433 NewTL.setNameLoc(TL.getNameLoc());
7438template<
typename Derived>
7441 DependentTemplateSpecializationTypeLoc TL) {
7442 NestedNameSpecifierLoc QualifierLoc;
7443 if (TL.getQualifierLoc()) {
7445 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7451 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7454template<
typename Derived>
7467 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7472 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7480 QualType NamedT = ElabT->getNamedType();
7489 for (
unsigned I = 0, E = NewTemplateArgs.
size(); I != E; ++I)
7496 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7505 for (
unsigned I = 0, E = NewTemplateArgs.
size(); I != E; ++I)
7514 for (
unsigned I = 0, E = NewTemplateArgs.
size(); I != E; ++I)
7520template<
typename Derived>
7529 if (getDerived().AlwaysRebuild() ||
7531 Result = getDerived().RebuildPackExpansionType(Pattern,
7539 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7544template<
typename Derived>
7546TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7547 ObjCInterfaceTypeLoc TL) {
7549 TLB.pushFullCopy(TL);
7550 return TL.getType();
7553template<
typename Derived>
7555TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7556 ObjCTypeParamTypeLoc TL) {
7557 const ObjCTypeParamType *
T = TL.getTypePtr();
7558 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7559 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7563 QualType
Result = TL.getType();
7564 if (getDerived().AlwaysRebuild() ||
7565 OTP !=
T->getDecl()) {
7566 Result = getDerived().RebuildObjCTypeParamType(
7567 OTP, TL.getProtocolLAngleLoc(),
7568 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7569 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7574 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7575 if (TL.getNumProtocols()) {
7576 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7577 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7578 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7579 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7584template<
typename Derived>
7586TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7587 ObjCObjectTypeLoc TL) {
7589 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7590 if (BaseType.isNull())
7593 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7597 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7598 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7599 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7600 QualType TypeArg = TypeArgInfo->getType();
7601 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7605 const auto *PackExpansion = PackExpansionLoc.getType()
7606 ->castAs<PackExpansionType>();
7610 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7614 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7615 bool Expand =
false;
7616 bool RetainExpansion =
false;
7617 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7618 if (getDerived().TryExpandParameterPacks(
7619 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7620 Unexpanded, Expand, RetainExpansion, NumExpansions))
7627 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7629 TypeLocBuilder TypeArgBuilder;
7630 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7631 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7633 if (NewPatternType.isNull())
7637 NewPatternType, NumExpansions);
7638 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7639 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7640 NewTypeArgInfos.push_back(
7641 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7647 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7648 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7650 TypeLocBuilder TypeArgBuilder;
7651 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7653 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7655 if (NewTypeArg.isNull())
7658 NewTypeArgInfos.push_back(
7659 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7665 TypeLocBuilder TypeArgBuilder;
7666 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7667 QualType NewTypeArg =
7668 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7669 if (NewTypeArg.isNull())
7673 if (NewTypeArg == TypeArg) {
7674 NewTypeArgInfos.push_back(TypeArgInfo);
7678 NewTypeArgInfos.push_back(
7679 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7683 QualType
Result = TL.getType();
7684 if (getDerived().AlwaysRebuild() || AnyChanged) {
7686 Result = getDerived().RebuildObjCObjectType(
7687 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7688 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7689 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7690 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7696 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7697 NewT.setHasBaseTypeAsWritten(
true);
7698 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7699 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7700 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7701 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7702 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7703 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7704 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7705 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7709template<
typename Derived>
7711TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
7712 ObjCObjectPointerTypeLoc TL) {
7713 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7714 if (PointeeType.isNull())
7717 QualType
Result = TL.getType();
7718 if (getDerived().AlwaysRebuild() ||
7719 PointeeType != TL.getPointeeLoc().getType()) {
7720 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
7726 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
7727 NewT.setStarLoc(TL.getStarLoc());
7734template<
typename Derived>
7736TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
7740template<
typename Derived>
7743 return getDerived().TransformCompoundStmt(S,
false);
7746template<
typename Derived>
7752 if (S->hasStoredFPFeatures())
7753 getSema().resetFPOptions(
7754 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
7757 bool SubStmtInvalid =
false;
7758 bool SubStmtChanged =
false;
7760 for (
auto *B : S->body()) {
7762 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
7764 if (
Result.isInvalid()) {
7767 if (isa<DeclStmt>(B))
7771 SubStmtInvalid =
true;
7775 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
7776 Statements.push_back(
Result.getAs<Stmt>());
7782 if (!getDerived().AlwaysRebuild() &&
7786 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
7792template<
typename Derived>
7794TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
7801 LHS = getDerived().TransformExpr(S->getLHS());
7803 if (LHS.isInvalid())
7807 RHS = getDerived().TransformExpr(S->getRHS());
7809 if (RHS.isInvalid())
7816 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
7818 S->getEllipsisLoc(),
7821 if (Case.isInvalid())
7826 getDerived().TransformStmt(S->getSubStmt());
7827 if (SubStmt.isInvalid())
7831 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
7834template <
typename Derived>
7835StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
7838 getDerived().TransformStmt(S->getSubStmt());
7839 if (SubStmt.isInvalid())
7843 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
7847template<
typename Derived>
7849TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
7850 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7851 if (SubStmt.isInvalid())
7854 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
7862 if (LD == S->getDecl())
7863 S->getDecl()->setStmt(
nullptr);
7866 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
7867 cast<LabelDecl>(LD), SourceLocation(),
7871template <
typename Derived>
7880 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
7881#include "clang/Basic/AttrList.inc"
7886template <
typename Derived>
7897 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
7898#include "clang/Basic/AttrList.inc"
7900 return TransformAttr(R);
7903template <
typename Derived>
7906 StmtDiscardKind SDK) {
7907 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7911 bool AttrsChanged =
false;
7915 for (
const auto *I : S->getAttrs()) {
7917 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
7918 AttrsChanged |= (I != R);
7923 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
7931 return getDerived().RebuildAttributedStmt(S->getAttrLoc(), Attrs,
7935template<
typename Derived>
7937TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
7940 if (
Init.isInvalid())
7943 Sema::ConditionResult Cond;
7944 if (!S->isConsteval()) {
7946 Cond = getDerived().TransformCondition(
7947 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
7950 if (Cond.isInvalid())
7955 std::optional<bool> ConstexprConditionValue;
7956 if (S->isConstexpr())
7957 ConstexprConditionValue = Cond.getKnownValue();
7961 if (!ConstexprConditionValue || *ConstexprConditionValue) {
7962 EnterExpressionEvaluationContext Ctx(
7965 S->isNonNegatedConsteval());
7967 Then = getDerived().TransformStmt(S->getThen());
7968 if (Then.isInvalid())
7974 Then =
new (getSema().Context)
7975 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
7980 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
7981 EnterExpressionEvaluationContext Ctx(
7984 S->isNegatedConsteval());
7986 Else = getDerived().TransformStmt(S->getElse());
7987 if (Else.isInvalid())
7989 }
else if (S->getElse() && ConstexprConditionValue &&
7990 *ConstexprConditionValue) {
7994 Else =
new (getSema().Context)
7995 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
7998 if (!getDerived().AlwaysRebuild() &&
7999 Init.get() == S->getInit() &&
8000 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8001 Then.get() == S->getThen() &&
8002 Else.get() == S->getElse())
8005 return getDerived().RebuildIfStmt(
8006 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8007 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8010template<
typename Derived>
8012TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
8015 if (
Init.isInvalid())
8019 Sema::ConditionResult Cond = getDerived().TransformCondition(
8020 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8022 if (Cond.isInvalid())
8027 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8028 Init.get(), Cond, S->getRParenLoc());
8033 StmtResult Body = getDerived().TransformStmt(S->getBody());
8034 if (Body.isInvalid())
8038 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8042template<
typename Derived>
8044TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
8046 Sema::ConditionResult Cond = getDerived().TransformCondition(
8047 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8049 if (Cond.isInvalid())
8053 StmtResult Body = getDerived().TransformStmt(S->getBody());
8054 if (Body.isInvalid())
8057 if (!getDerived().AlwaysRebuild() &&
8058 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8059 Body.get() == S->getBody())
8062 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8063 Cond, S->getRParenLoc(), Body.get());
8066template<
typename Derived>
8068TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
8070 StmtResult Body = getDerived().TransformStmt(S->getBody());
8071 if (Body.isInvalid())
8075 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8076 if (Cond.isInvalid())
8079 if (!getDerived().AlwaysRebuild() &&
8080 Cond.get() == S->getCond() &&
8081 Body.get() == S->getBody())
8084 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8085 S->getWhileLoc(), Cond.get(),
8089template<
typename Derived>
8091TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8092 if (getSema().getLangOpts().OpenMP)
8093 getSema().OpenMP().startOpenMPLoop();
8097 if (
Init.isInvalid())
8102 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8103 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8107 Sema::ConditionResult Cond = getDerived().TransformCondition(
8108 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8110 if (Cond.isInvalid())
8115 if (
Inc.isInvalid())
8118 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8119 if (S->getInc() && !FullInc.get())
8123 StmtResult Body = getDerived().TransformStmt(S->getBody());
8124 if (Body.isInvalid())
8127 if (!getDerived().AlwaysRebuild() &&
8128 Init.get() == S->getInit() &&
8129 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8130 Inc.get() == S->getInc() &&
8131 Body.get() == S->getBody())
8134 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8135 Init.get(), Cond, FullInc,
8136 S->getRParenLoc(), Body.get());
8139template<
typename Derived>
8141TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8142 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8148 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8149 cast<LabelDecl>(LD));
8152template<
typename Derived>
8154TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8160 if (!getDerived().AlwaysRebuild() &&
8161 Target.get() == S->getTarget())
8164 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8168template<
typename Derived>
8170TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8174template<
typename Derived>
8176TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8180template<
typename Derived>
8182TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8190 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8193template<
typename Derived>
8195TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8196 bool DeclChanged =
false;
8198 for (
auto *D : S->decls()) {
8199 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8203 if (Transformed != D)
8206 Decls.push_back(Transformed);
8209 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8212 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8215template<
typename Derived>
8217TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8226 bool ExprsChanged =
false;
8229 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8230 Names.push_back(S->getOutputIdentifier(I));
8233 Constraints.push_back(S->getOutputConstraintLiteral(I));
8236 Expr *OutputExpr = S->getOutputExpr(I);
8241 ExprsChanged |=
Result.get() != OutputExpr;
8243 Exprs.push_back(
Result.get());
8247 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8248 Names.push_back(S->getInputIdentifier(I));
8251 Constraints.push_back(S->getInputConstraintLiteral(I));
8254 Expr *InputExpr = S->getInputExpr(I);
8259 ExprsChanged |=
Result.get() != InputExpr;
8261 Exprs.push_back(
Result.get());
8265 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8266 Names.push_back(S->getLabelIdentifier(I));
8271 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8272 Exprs.push_back(
Result.get());
8274 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8278 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I)
8279 Clobbers.push_back(S->getClobberStringLiteral(I));
8282 AsmString = S->getAsmString();
8283 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8284 S->isVolatile(), S->getNumOutputs(),
8285 S->getNumInputs(), Names.data(),
8286 Constraints, Exprs, AsmString.get(),
8287 Clobbers, S->getNumLabels(),
8291template<
typename Derived>
8293TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8296 bool HadError =
false, HadChange =
false;
8300 TransformedExprs.reserve(SrcExprs.size());
8301 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8303 if (!
Result.isUsable()) {
8306 HadChange |= (
Result.get() != SrcExprs[i]);
8307 TransformedExprs.push_back(
Result.get());
8312 if (!HadChange && !getDerived().AlwaysRebuild())
8315 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8316 AsmToks, S->getAsmString(),
8317 S->getNumOutputs(), S->getNumInputs(),
8318 S->getAllConstraints(), S->getClobbers(),
8319 TransformedExprs, S->getEndLoc());
8323template<
typename Derived>
8325TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8327 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8328 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8329 ScopeInfo->NeedsCoroutineSuspends &&
8330 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8331 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8332 "expected clean scope info");
8336 ScopeInfo->setNeedsCoroutineSuspends(
false);
8349 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8350 ScopeInfo->CoroutinePromise = Promise;
8355 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8356 if (InitSuspend.isInvalid())
8359 getDerived().TransformStmt(S->getFinalSuspendStmt());
8360 if (FinalSuspend.isInvalid() ||
8363 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8364 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8366 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8367 if (BodyRes.isInvalid())
8370 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8371 if (Builder.isInvalid())
8374 Expr *ReturnObject = S->getReturnValueInit();
8375 assert(ReturnObject &&
"the return object is expected to be valid");
8376 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8378 if (Res.isInvalid())
8380 Builder.ReturnValue = Res.get();
8385 if (S->hasDependentPromiseType()) {
8388 if (!Promise->getType()->isDependentType()) {
8389 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8390 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8391 "these nodes should not have been built yet");
8392 if (!Builder.buildDependentStatements())
8396 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8397 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8398 if (Res.isInvalid())
8400 Builder.OnFallthrough = Res.get();
8403 if (
auto *OnException = S->getExceptionHandler()) {
8404 StmtResult Res = getDerived().TransformStmt(OnException);
8405 if (Res.isInvalid())
8407 Builder.OnException = Res.get();
8410 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8411 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8412 if (Res.isInvalid())
8414 Builder.ReturnStmtOnAllocFailure = Res.get();
8418 assert(S->getAllocate() && S->getDeallocate() &&
8419 "allocation and deallocation calls must already be built");
8420 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8421 if (AllocRes.isInvalid())
8423 Builder.Allocate = AllocRes.get();
8425 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8426 if (DeallocRes.isInvalid())
8428 Builder.Deallocate = DeallocRes.get();
8430 if (
auto *ResultDecl = S->getResultDecl()) {
8431 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8432 if (Res.isInvalid())
8434 Builder.ResultDecl = Res.get();
8437 if (
auto *ReturnStmt = S->getReturnStmt()) {
8438 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8439 if (Res.isInvalid())
8441 Builder.ReturnStmt = Res.get();
8445 return getDerived().RebuildCoroutineBodyStmt(Builder);
8448template<
typename Derived>
8450TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8458 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8462template <
typename Derived>
8463ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *E) {
8475 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8476 getSema().getCurScope(), E->getKeywordLoc());
8480 return getDerived().RebuildCoawaitExpr(
8481 E->getKeywordLoc(),
Operand.get(),
8482 cast<UnresolvedLookupExpr>(Lookup.get()), E->isImplicit());
8485template <
typename Derived>
8487TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *E) {
8488 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8490 if (OperandResult.isInvalid())
8493 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8494 E->getOperatorCoawaitLookup());
8496 if (LookupResult.isInvalid())
8501 return getDerived().RebuildDependentCoawaitExpr(
8502 E->getKeywordLoc(), OperandResult.get(),
8503 cast<UnresolvedLookupExpr>(LookupResult.get()));
8506template<
typename Derived>
8508TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *E) {
8516 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8521template<
typename Derived>
8523TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8525 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8526 if (TryBody.isInvalid())
8530 bool AnyCatchChanged =
false;
8532 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8533 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8534 if (Catch.isInvalid())
8536 if (Catch.get() != S->getCatchStmt(I))
8537 AnyCatchChanged =
true;
8538 CatchStmts.push_back(Catch.get());
8543 if (S->getFinallyStmt()) {
8544 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8545 if (Finally.isInvalid())
8550 if (!getDerived().AlwaysRebuild() &&
8551 TryBody.get() == S->getTryBody() &&
8553 Finally.get() == S->getFinallyStmt())
8557 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8558 CatchStmts, Finally.get());
8561template<
typename Derived>
8563TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8565 VarDecl *Var =
nullptr;
8566 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8567 TypeSourceInfo *TSInfo =
nullptr;
8568 if (FromVar->getTypeSourceInfo()) {
8569 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8576 T = TSInfo->getType();
8578 T = getDerived().TransformType(FromVar->getType());
8583 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8588 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8589 if (Body.isInvalid())
8592 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8597template<
typename Derived>
8599TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8601 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8602 if (Body.isInvalid())
8606 if (!getDerived().AlwaysRebuild() &&
8607 Body.get() == S->getFinallyBody())
8611 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8615template<
typename Derived>
8617TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8619 if (S->getThrowExpr()) {
8620 Operand = getDerived().TransformExpr(S->getThrowExpr());
8625 if (!getDerived().AlwaysRebuild() &&
8626 Operand.get() == S->getThrowExpr())
8629 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8632template<
typename Derived>
8634TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8635 ObjCAtSynchronizedStmt *S) {
8641 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8647 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8648 if (Body.isInvalid())
8652 if (!getDerived().AlwaysRebuild() &&
8653 Object.get() == S->getSynchExpr() &&
8654 Body.get() == S->getSynchBody())
8658 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8659 Object.get(), Body.get());
8662template<
typename Derived>
8664TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8665 ObjCAutoreleasePoolStmt *S) {
8667 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8668 if (Body.isInvalid())
8672 if (!getDerived().AlwaysRebuild() &&
8673 Body.get() == S->getSubStmt())
8677 return getDerived().RebuildObjCAutoreleasePoolStmt(
8678 S->getAtLoc(), Body.get());
8681template<
typename Derived>
8683TreeTransform<Derived>::TransformObjCForCollectionStmt(
8684 ObjCForCollectionStmt *S) {
8687 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
8688 if (Element.isInvalid())
8692 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
8693 if (Collection.isInvalid())
8697 StmtResult Body = getDerived().TransformStmt(S->getBody());
8698 if (Body.isInvalid())
8702 if (!getDerived().AlwaysRebuild() &&
8703 Element.get() == S->getElement() &&
8704 Collection.get() == S->getCollection() &&
8705 Body.get() == S->getBody())
8709 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
8716template <
typename Derived>
8717StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
8719 VarDecl *Var =
nullptr;
8720 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
8722 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
8726 Var = getDerived().RebuildExceptionDecl(
8727 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
8728 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
8729 if (!Var || Var->isInvalidDecl())
8734 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
8735 if (Handler.isInvalid())
8738 if (!getDerived().AlwaysRebuild() && !Var &&
8739 Handler.get() == S->getHandlerBlock())
8742 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
8745template <
typename Derived>
8746StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
8748 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
8749 if (TryBlock.isInvalid())
8753 bool HandlerChanged =
false;
8755 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
8756 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
8757 if (Handler.isInvalid())
8760 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
8761 Handlers.push_back(Handler.getAs<Stmt>());
8764 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
8768 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
8772template<
typename Derived>
8774TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
8775 EnterExpressionEvaluationContext ForRangeInitContext(
8783 auto &LastRecord = getSema().ExprEvalContexts.back();
8784 LastRecord.InLifetimeExtendingContext =
true;
8787 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
8788 if (
Init.isInvalid())
8797 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
8798 auto ForRangeLifetimeExtendTemps =
8799 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
8804 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
8805 if (End.isInvalid())
8808 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8809 if (Cond.isInvalid())
8813 if (Cond.isInvalid())
8819 if (
Inc.isInvalid())
8824 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
8825 if (LoopVar.isInvalid())
8829 if (getDerived().AlwaysRebuild() ||
8830 Init.get() != S->getInit() ||
8831 Range.get() != S->getRangeStmt() ||
8832 Begin.get() != S->getBeginStmt() ||
8833 End.get() != S->getEndStmt() ||
8834 Cond.get() != S->getCond() ||
8835 Inc.get() != S->getInc() ||
8836 LoopVar.get() != S->getLoopVarStmt()) {
8837 NewStmt = getDerived().RebuildCXXForRangeStmt(
8838 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8840 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8841 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
8844 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
8849 StmtResult Body = getDerived().TransformStmt(S->getBody());
8850 if (Body.isInvalid())
8855 if (Body.get() != S->getBody() && NewStmt.get() == S) {
8856 NewStmt = getDerived().RebuildCXXForRangeStmt(
8857 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8859 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8860 if (NewStmt.isInvalid())
8864 if (NewStmt.get() == S)
8867 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
8870template<
typename Derived>
8872TreeTransform<Derived>::TransformMSDependentExistsStmt(
8873 MSDependentExistsStmt *S) {
8875 NestedNameSpecifierLoc QualifierLoc;
8876 if (S->getQualifierLoc()) {
8878 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
8884 DeclarationNameInfo NameInfo = S->getNameInfo();
8885 if (NameInfo.getName()) {
8886 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
8887 if (!NameInfo.getName())
8892 if (!getDerived().AlwaysRebuild() &&
8893 QualifierLoc == S->getQualifierLoc() &&
8894 NameInfo.getName() == S->getNameInfo().getName())
8899 SS.Adopt(QualifierLoc);
8900 bool Dependent =
false;
8901 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
8903 if (S->isIfExists())
8906 return new (getSema().Context) NullStmt(S->getKeywordLoc());
8909 if (S->isIfNotExists())
8912 return new (getSema().Context) NullStmt(S->getKeywordLoc());
8923 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
8924 if (SubStmt.isInvalid())
8932 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
8939template<
typename Derived>
8941TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *E) {
8942 NestedNameSpecifierLoc QualifierLoc;
8943 if (E->getQualifierLoc()) {
8945 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
8950 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
8951 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
8956 if (
Base.isInvalid())
8960 MSPropertyRefExpr(
Base.get(), PD, E->isArrow(),
8962 QualifierLoc, E->getMemberLoc());
8965template <
typename Derived>
8966ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
8967 MSPropertySubscriptExpr *E) {
8968 auto BaseRes = getDerived().TransformExpr(E->getBase());
8969 if (BaseRes.isInvalid())
8971 auto IdxRes = getDerived().TransformExpr(E->getIdx());
8972 if (IdxRes.isInvalid())
8975 if (!getDerived().AlwaysRebuild() &&
8976 BaseRes.get() == E->getBase() &&
8977 IdxRes.get() == E->getIdx())
8980 return getDerived().RebuildArraySubscriptExpr(
8981 BaseRes.get(), SourceLocation(), IdxRes.get(), E->getRBracketLoc());
8984template <
typename Derived>
8985StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
8986 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
8987 if (TryBlock.isInvalid())
8990 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
8991 if (Handler.isInvalid())
8994 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
8995 Handler.get() == S->getHandler())
8998 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
8999 TryBlock.get(), Handler.get());
9002template <
typename Derived>
9003StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
9005 if (
Block.isInvalid())
9008 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9011template <
typename Derived>
9012StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
9013 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9014 if (FilterExpr.isInvalid())
9018 if (
Block.isInvalid())
9021 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9025template <
typename Derived>
9027 if (isa<SEHFinallyStmt>(Handler))
9028 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
9030 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
9033template<
typename Derived>
9043template <
typename Derived>
9045TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9049 return getDerived().TransformStmt(L->getLoopStmt());
9052template <
typename Derived>
9059 TClauses.reserve(Clauses.size());
9063 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9064 OMPClause *Clause = getDerived().TransformOMPClause(*I);
9065 getDerived().getSema().OpenMP().EndOpenMPClause();
9067 TClauses.push_back(Clause);
9069 TClauses.push_back(
nullptr);
9074 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9088 Body = getDerived().TransformStmt(CS);
9090 getSema().getLangOpts().OpenMPIRBuilder)
9091 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9094 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9099 if (TClauses.size() != Clauses.size()) {
9106 DirName = cast<OMPCriticalDirective>(D)->getDirectiveName();
9107 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9111 CancelRegion = cast<OMPCancellationPointDirective>(D)->getCancelRegion();
9113 CancelRegion = cast<OMPCancelDirective>(D)->getCancelRegion();
9116 return getDerived().RebuildOMPExecutableDirective(
9122template <
typename Derived>
9126 SemaRef.
Diag(D->
getBeginLoc(), diag::err_omp_instantiation_not_supported)
9131template <
typename Derived>
9133TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9134 DeclarationNameInfo DirName;
9135 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9136 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9137 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9138 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9142template <
typename Derived>
9144TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *D) {
9145 DeclarationNameInfo DirName;
9146 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9147 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9148 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9149 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9153template <
typename Derived>
9155TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *D) {
9156 DeclarationNameInfo DirName;
9157 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9158 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9159 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9160 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9164template <
typename Derived>
9166TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *D) {
9167 DeclarationNameInfo DirName;
9168 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9169 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9170 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9171 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9175template <
typename Derived>
9177TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *D) {
9178 DeclarationNameInfo DirName;
9179 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9180 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9181 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9182 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9186template <
typename Derived>
9188TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *D) {
9189 DeclarationNameInfo DirName;
9190 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9191 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9192 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9193 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9197template <
typename Derived>
9199TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *D) {
9200 DeclarationNameInfo DirName;
9201 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9202 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9203 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9204 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9208template <
typename Derived>
9210TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *D) {
9211 DeclarationNameInfo DirName;
9212 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9213 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9214 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9215 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9219template <
typename Derived>
9221TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *D) {
9222 DeclarationNameInfo DirName;
9223 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9224 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9225 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9226 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9230template <
typename Derived>
9232TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *D) {
9233 DeclarationNameInfo DirName;
9234 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9235 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9236 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9237 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9241template <
typename Derived>
9243TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *D) {
9244 DeclarationNameInfo DirName;
9245 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9246 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9247 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9248 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9252template <
typename Derived>
9254TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *D) {
9255 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9256 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9257 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9258 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9262template <
typename Derived>
9263StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9264 OMPParallelForDirective *D) {
9265 DeclarationNameInfo DirName;
9266 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9267 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9268 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9269 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9273template <
typename Derived>
9274StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9275 OMPParallelForSimdDirective *D) {
9276 DeclarationNameInfo DirName;
9277 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9278 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9279 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9280 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9284template <
typename Derived>
9285StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9286 OMPParallelMasterDirective *D) {
9287 DeclarationNameInfo DirName;
9288 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9289 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9290 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9291 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9295template <
typename Derived>
9296StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9297 OMPParallelMaskedDirective *D) {
9298 DeclarationNameInfo DirName;
9299 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9300 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9301 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9302 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9306template <
typename Derived>
9307StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9308 OMPParallelSectionsDirective *D) {
9309 DeclarationNameInfo DirName;
9310 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9311 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9312 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9313 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9317template <
typename Derived>
9319TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *D) {
9320 DeclarationNameInfo DirName;
9321 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9322 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9323 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9324 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9328template <
typename Derived>
9329StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9330 OMPTaskyieldDirective *D) {
9331 DeclarationNameInfo DirName;
9332 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9333 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9334 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9335 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9339template <
typename Derived>
9341TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *D) {
9342 DeclarationNameInfo DirName;
9343 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9344 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9345 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9346 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9350template <
typename Derived>
9352TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
9353 DeclarationNameInfo DirName;
9354 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9355 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9356 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9357 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9361template <
typename Derived>
9363TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *D) {
9364 DeclarationNameInfo DirName;
9365 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9366 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9367 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9368 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9372template <
typename Derived>
9373StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9374 OMPTaskgroupDirective *D) {
9375 DeclarationNameInfo DirName;
9376 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9377 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9378 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9379 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9383template <
typename Derived>
9385TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *D) {
9386 DeclarationNameInfo DirName;
9387 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9388 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9389 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9390 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9394template <
typename Derived>
9396TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *D) {
9397 DeclarationNameInfo DirName;
9398 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9399 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9400 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9401 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9405template <
typename Derived>
9407TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *D) {
9408 DeclarationNameInfo DirName;
9409 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9410 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9411 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9412 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9416template <
typename Derived>
9418TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *D) {
9419 DeclarationNameInfo DirName;
9420 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9421 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9422 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9423 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9427template <
typename Derived>
9429TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *D) {
9430 DeclarationNameInfo DirName;
9431 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9432 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9433 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9434 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9438template <
typename Derived>
9440TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *D) {
9441 DeclarationNameInfo DirName;
9442 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9443 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9444 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9445 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9449template <
typename Derived>
9450StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9451 OMPTargetDataDirective *D) {
9452 DeclarationNameInfo DirName;
9453 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9454 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9455 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9456 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9460template <
typename Derived>
9461StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9462 OMPTargetEnterDataDirective *D) {
9463 DeclarationNameInfo DirName;
9464 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9465 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
9466 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9467 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9471template <
typename Derived>
9472StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9473 OMPTargetExitDataDirective *D) {
9474 DeclarationNameInfo DirName;
9475 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9476 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
9477 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9478 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9482template <
typename Derived>
9483StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9484 OMPTargetParallelDirective *D) {
9485 DeclarationNameInfo DirName;
9486 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9487 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
9488 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9489 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9493template <
typename Derived>
9494StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9495 OMPTargetParallelForDirective *D) {
9496 DeclarationNameInfo DirName;
9497 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9498 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
9499 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9500 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9504template <
typename Derived>
9505StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9506 OMPTargetUpdateDirective *D) {
9507 DeclarationNameInfo DirName;
9508 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9509 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
9510 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9511 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9515template <
typename Derived>
9517TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *D) {
9518 DeclarationNameInfo DirName;
9519 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9520 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
9521 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9522 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9526template <
typename Derived>
9527StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9528 OMPCancellationPointDirective *D) {
9529 DeclarationNameInfo DirName;
9530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9531 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
9532 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9537template <
typename Derived>
9539TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *D) {
9540 DeclarationNameInfo DirName;
9541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9542 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
9543 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9548template <
typename Derived>
9550TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
9551 DeclarationNameInfo DirName;
9552 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9553 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
9554 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9555 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9559template <
typename Derived>
9560StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9561 OMPTaskLoopSimdDirective *D) {
9562 DeclarationNameInfo DirName;
9563 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9564 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9565 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9566 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9570template <
typename Derived>
9571StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9572 OMPMasterTaskLoopDirective *D) {
9573 DeclarationNameInfo DirName;
9574 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9575 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
9576 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9577 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9581template <
typename Derived>
9582StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
9583 OMPMaskedTaskLoopDirective *D) {
9584 DeclarationNameInfo DirName;
9585 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9586 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
9587 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9588 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9592template <
typename Derived>
9593StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
9594 OMPMasterTaskLoopSimdDirective *D) {
9595 DeclarationNameInfo DirName;
9596 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9597 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9598 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9599 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9603template <
typename Derived>
9604StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
9605 OMPMaskedTaskLoopSimdDirective *D) {
9606 DeclarationNameInfo DirName;
9607 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9608 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9609 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9610 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9614template <
typename Derived>
9615StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
9616 OMPParallelMasterTaskLoopDirective *D) {
9617 DeclarationNameInfo DirName;
9618 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9619 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
9620 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9621 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9625template <
typename Derived>
9626StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
9627 OMPParallelMaskedTaskLoopDirective *D) {
9628 DeclarationNameInfo DirName;
9629 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9630 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
9631 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9632 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9636template <
typename Derived>
9638TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
9639 OMPParallelMasterTaskLoopSimdDirective *D) {
9640 DeclarationNameInfo DirName;
9641 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9642 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9643 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9644 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9648template <
typename Derived>
9650TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
9651 OMPParallelMaskedTaskLoopSimdDirective *D) {
9652 DeclarationNameInfo DirName;
9653 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9654 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9655 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9656 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9660template <
typename Derived>
9661StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
9662 OMPDistributeDirective *D) {
9663 DeclarationNameInfo DirName;
9664 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9665 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
9666 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9667 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9671template <
typename Derived>
9672StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
9673 OMPDistributeParallelForDirective *D) {
9674 DeclarationNameInfo DirName;
9675 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9676 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
9677 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9678 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9682template <
typename Derived>
9684TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
9685 OMPDistributeParallelForSimdDirective *D) {
9686 DeclarationNameInfo DirName;
9687 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9688 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9689 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9690 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9694template <
typename Derived>
9695StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
9696 OMPDistributeSimdDirective *D) {
9697 DeclarationNameInfo DirName;
9698 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9699 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
9700 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9701 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9705template <
typename Derived>
9706StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
9707 OMPTargetParallelForSimdDirective *D) {
9708 DeclarationNameInfo DirName;
9709 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9710 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9711 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9712 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9716template <
typename Derived>
9717StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
9718 OMPTargetSimdDirective *D) {
9719 DeclarationNameInfo DirName;
9720 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9721 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
9722 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9723 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9727template <
typename Derived>
9728StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
9729 OMPTeamsDistributeDirective *D) {
9730 DeclarationNameInfo DirName;
9731 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9732 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
9733 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9734 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9738template <
typename Derived>
9739StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
9740 OMPTeamsDistributeSimdDirective *D) {
9741 DeclarationNameInfo DirName;
9742 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9743 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
9744 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9745 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9749template <
typename Derived>
9750StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
9751 OMPTeamsDistributeParallelForSimdDirective *D) {
9752 DeclarationNameInfo DirName;
9753 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9754 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
9756 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9757 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9761template <
typename Derived>
9762StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
9763 OMPTeamsDistributeParallelForDirective *D) {
9764 DeclarationNameInfo DirName;
9765 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9766 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
9767 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9768 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9772template <
typename Derived>
9773StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
9774 OMPTargetTeamsDirective *D) {
9775 DeclarationNameInfo DirName;
9776 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9777 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
9778 auto Res = getDerived().TransformOMPExecutableDirective(D);
9779 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9783template <
typename Derived>
9784StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
9785 OMPTargetTeamsDistributeDirective *D) {
9786 DeclarationNameInfo DirName;
9787 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9788 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
9789 auto Res = getDerived().TransformOMPExecutableDirective(D);
9790 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9794template <
typename Derived>
9796TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
9797 OMPTargetTeamsDistributeParallelForDirective *D) {
9798 DeclarationNameInfo DirName;
9799 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9800 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
9802 auto Res = getDerived().TransformOMPExecutableDirective(D);
9803 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9807template <
typename Derived>
9809 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
9810 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
9811 DeclarationNameInfo DirName;
9812 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9813 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
9815 auto Res = getDerived().TransformOMPExecutableDirective(D);
9816 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9820template <
typename Derived>
9822TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
9823 OMPTargetTeamsDistributeSimdDirective *D) {
9824 DeclarationNameInfo DirName;
9825 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9826 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
9827 auto Res = getDerived().TransformOMPExecutableDirective(D);
9828 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9832template <
typename Derived>
9834TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *D) {
9835 DeclarationNameInfo DirName;
9836 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9837 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
9838 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9839 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9843template <
typename Derived>
9845TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *D) {
9846 DeclarationNameInfo DirName;
9847 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9848 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
9849 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9850 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9854template <
typename Derived>
9856TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *D) {
9857 DeclarationNameInfo DirName;
9858 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9859 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
9860 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9861 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9865template <
typename Derived>
9866StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
9867 OMPGenericLoopDirective *D) {
9868 DeclarationNameInfo DirName;
9869 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9870 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
9871 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9872 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9876template <
typename Derived>
9877StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
9878 OMPTeamsGenericLoopDirective *D) {
9879 DeclarationNameInfo DirName;
9880 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9881 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
9882 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9883 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9887template <
typename Derived>
9888StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
9889 OMPTargetTeamsGenericLoopDirective *D) {
9890 DeclarationNameInfo DirName;
9891 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9892 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
9893 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9894 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9898template <
typename Derived>
9899StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
9900 OMPParallelGenericLoopDirective *D) {
9901 DeclarationNameInfo DirName;
9902 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9903 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
9904 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9905 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9909template <
typename Derived>
9911TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
9912 OMPTargetParallelGenericLoopDirective *D) {
9913 DeclarationNameInfo DirName;
9914 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9915 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
9916 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9917 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9924template <
typename Derived>
9925OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
9926 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
9927 if (Cond.isInvalid())
9929 return getDerived().RebuildOMPIfClause(
9930 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
9931 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
9934template <
typename Derived>
9935OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
9936 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
9937 if (Cond.isInvalid())
9939 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
9940 C->getLParenLoc(),
C->getEndLoc());
9943template <
typename Derived>
9945TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
9946 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
9947 if (NumThreads.isInvalid())
9949 return getDerived().RebuildOMPNumThreadsClause(
9950 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9953template <
typename Derived>
9955TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
9956 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
9959 return getDerived().RebuildOMPSafelenClause(
9960 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9963template <
typename Derived>
9965TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
9966 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
9969 return getDerived().RebuildOMPAllocatorClause(
9970 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9973template <
typename Derived>
9975TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
9976 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
9979 return getDerived().RebuildOMPSimdlenClause(
9980 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9983template <
typename Derived>
9984OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
9986 TransformedSizes.reserve(
C->getNumSizes());
9988 for (Expr *E :
C->getSizesRefs()) {
9990 TransformedSizes.push_back(
nullptr);
9999 TransformedSizes.push_back(
T.get());
10002 if (!Changed && !getDerived().AlwaysRebuild())
10004 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10005 C->getLParenLoc(),
C->getEndLoc());
10008template <
typename Derived>
10009OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
10010 if (!getDerived().AlwaysRebuild())
10012 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10015template <
typename Derived>
10017TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
10018 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10021 Expr *Factor =
T.get();
10022 bool Changed = Factor !=
C->getFactor();
10024 if (!Changed && !getDerived().AlwaysRebuild())
10026 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10030template <
typename Derived>
10032TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
10033 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10036 return getDerived().RebuildOMPCollapseClause(
10037 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10040template <
typename Derived>
10042TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
10043 return getDerived().RebuildOMPDefaultClause(
10044 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
10045 C->getLParenLoc(),
C->getEndLoc());
10048template <
typename Derived>
10050TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
10051 return getDerived().RebuildOMPProcBindClause(
10052 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10053 C->getLParenLoc(),
C->getEndLoc());
10056template <
typename Derived>
10058TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
10059 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10062 return getDerived().RebuildOMPScheduleClause(
10063 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10064 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10065 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10066 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10069template <
typename Derived>
10071TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
10073 if (
auto *Num =
C->getNumForLoops()) {
10074 E = getDerived().TransformExpr(Num);
10078 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10079 C->getLParenLoc(), E.get());
10082template <
typename Derived>
10084TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10086 if (Expr *Evt =
C->getEventHandler()) {
10087 E = getDerived().TransformExpr(Evt);
10091 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10092 C->getLParenLoc(),
C->getEndLoc());
10095template <
typename Derived>
10097TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10102template <
typename Derived>
10104TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10109template <
typename Derived>
10111TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10116template <
typename Derived>
10117OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10122template <
typename Derived>
10123OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10128template <
typename Derived>
10130TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10135template <
typename Derived>
10137TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10142template <
typename Derived>
10144TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10149template <
typename Derived>
10150OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10155template <
typename Derived>
10157TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10162template <
typename Derived>
10164TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10169template <
typename Derived>
10171TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10176template <
typename Derived>
10178TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10183template <
typename Derived>
10185TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10190template <
typename Derived>
10191OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10196template <
typename Derived>
10198TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10203template <
typename Derived>
10204OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10209template <
typename Derived>
10211TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10216template <
typename Derived>
10217OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10218 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10219 if (IVR.isInvalid())
10222 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10223 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10224 for (Expr *E : llvm::drop_begin(
C->varlists())) {
10225 ExprResult ER = getDerived().TransformExpr(cast<Expr>(E));
10226 if (ER.isInvalid())
10228 InteropInfo.PreferTypes.push_back(ER.get());
10230 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10231 C->getBeginLoc(),
C->getLParenLoc(),
10232 C->getVarLoc(),
C->getEndLoc());
10235template <
typename Derived>
10236OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10237 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10238 if (ER.isInvalid())
10240 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10241 C->getLParenLoc(),
C->getVarLoc(),
10245template <
typename Derived>
10247TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10249 if (Expr *IV =
C->getInteropVar()) {
10250 ER = getDerived().TransformExpr(IV);
10251 if (ER.isInvalid())
10254 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10255 C->getLParenLoc(),
C->getVarLoc(),
10259template <
typename Derived>
10261TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10262 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10263 if (Cond.isInvalid())
10265 return getDerived().RebuildOMPNovariantsClause(
10266 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10269template <
typename Derived>
10271TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10272 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10273 if (Cond.isInvalid())
10275 return getDerived().RebuildOMPNocontextClause(
10276 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10279template <
typename Derived>
10281TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10282 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10283 if (ThreadID.isInvalid())
10285 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10286 C->getLParenLoc(),
C->getEndLoc());
10289template <
typename Derived>
10290OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10291 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10294 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10295 C->getLParenLoc(),
C->getEndLoc());
10298template <
typename Derived>
10299OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10300 OMPUnifiedAddressClause *
C) {
10301 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10304template <
typename Derived>
10305OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10306 OMPUnifiedSharedMemoryClause *
C) {
10308 "unified_shared_memory clause cannot appear in dependent context");
10311template <
typename Derived>
10312OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10313 OMPReverseOffloadClause *
C) {
10314 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10317template <
typename Derived>
10318OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10319 OMPDynamicAllocatorsClause *
C) {
10321 "dynamic_allocators clause cannot appear in dependent context");
10324template <
typename Derived>
10325OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10326 OMPAtomicDefaultMemOrderClause *
C) {
10328 "atomic_default_mem_order clause cannot appear in dependent context");
10331template <
typename Derived>
10332OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10333 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10334 C->getBeginLoc(),
C->getLParenLoc(),
10338template <
typename Derived>
10340TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10341 return getDerived().RebuildOMPSeverityClause(
10342 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10343 C->getLParenLoc(),
C->getEndLoc());
10346template <
typename Derived>
10348TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10349 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10352 return getDerived().RebuildOMPMessageClause(
10353 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10357template <
typename Derived>
10359TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10361 Vars.reserve(
C->varlist_size());
10362 for (
auto *VE :
C->varlists()) {
10363 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10364 if (EVar.isInvalid())
10366 Vars.push_back(EVar.get());
10368 return getDerived().RebuildOMPPrivateClause(
10369 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10372template <
typename Derived>
10373OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10374 OMPFirstprivateClause *
C) {
10376 Vars.reserve(
C->varlist_size());
10377 for (
auto *VE :
C->varlists()) {
10378 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10379 if (EVar.isInvalid())
10381 Vars.push_back(EVar.get());
10383 return getDerived().RebuildOMPFirstprivateClause(
10384 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10387template <
typename Derived>
10389TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10391 Vars.reserve(
C->varlist_size());
10392 for (
auto *VE :
C->varlists()) {
10393 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10394 if (EVar.isInvalid())
10396 Vars.push_back(EVar.get());
10398 return getDerived().RebuildOMPLastprivateClause(
10399 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10400 C->getLParenLoc(),
C->getEndLoc());
10403template <
typename Derived>
10405TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10407 Vars.reserve(
C->varlist_size());
10408 for (
auto *VE :
C->varlists()) {
10409 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10410 if (EVar.isInvalid())
10412 Vars.push_back(EVar.get());
10414 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10415 C->getLParenLoc(),
C->getEndLoc());
10418template <
typename Derived>
10420TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10422 Vars.reserve(
C->varlist_size());
10423 for (
auto *VE :
C->varlists()) {
10424 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10425 if (EVar.isInvalid())
10427 Vars.push_back(EVar.get());
10429 CXXScopeSpec ReductionIdScopeSpec;
10430 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10432 DeclarationNameInfo NameInfo =
C->getNameInfo();
10433 if (NameInfo.getName()) {
10434 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10435 if (!NameInfo.getName())
10441 for (
auto *E :
C->reduction_ops()) {
10444 auto *ULE = cast<UnresolvedLookupExpr>(E);
10445 UnresolvedSet<8> Decls;
10446 for (
auto *D : ULE->decls()) {
10448 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10449 Decls.addDecl(InstD, InstD->getAccess());
10453 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10454 true, Decls.begin(), Decls.end(),
10457 UnresolvedReductions.push_back(
nullptr);
10459 return getDerived().RebuildOMPReductionClause(
10460 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10461 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10462 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10465template <
typename Derived>
10466OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10467 OMPTaskReductionClause *
C) {
10469 Vars.reserve(
C->varlist_size());
10470 for (
auto *VE :
C->varlists()) {
10471 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10472 if (EVar.isInvalid())
10474 Vars.push_back(EVar.get());
10476 CXXScopeSpec ReductionIdScopeSpec;
10477 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10479 DeclarationNameInfo NameInfo =
C->getNameInfo();
10480 if (NameInfo.getName()) {
10481 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10482 if (!NameInfo.getName())
10488 for (
auto *E :
C->reduction_ops()) {
10491 auto *ULE = cast<UnresolvedLookupExpr>(E);
10492 UnresolvedSet<8> Decls;
10493 for (
auto *D : ULE->decls()) {
10495 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10496 Decls.addDecl(InstD, InstD->getAccess());
10500 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10501 true, Decls.begin(), Decls.end(),
10504 UnresolvedReductions.push_back(
nullptr);
10506 return getDerived().RebuildOMPTaskReductionClause(
10507 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10508 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10511template <
typename Derived>
10513TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10515 Vars.reserve(
C->varlist_size());
10516 for (
auto *VE :
C->varlists()) {
10517 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10518 if (EVar.isInvalid())
10520 Vars.push_back(EVar.get());
10522 CXXScopeSpec ReductionIdScopeSpec;
10523 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10525 DeclarationNameInfo NameInfo =
C->getNameInfo();
10526 if (NameInfo.getName()) {
10527 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10528 if (!NameInfo.getName())
10534 for (
auto *E :
C->reduction_ops()) {
10537 auto *ULE = cast<UnresolvedLookupExpr>(E);
10538 UnresolvedSet<8> Decls;
10539 for (
auto *D : ULE->decls()) {
10541 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10542 Decls.addDecl(InstD, InstD->getAccess());
10546 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10547 true, Decls.begin(), Decls.end(),
10550 UnresolvedReductions.push_back(
nullptr);
10552 return getDerived().RebuildOMPInReductionClause(
10553 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10554 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10557template <
typename Derived>
10559TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
10561 Vars.reserve(
C->varlist_size());
10562 for (
auto *VE :
C->varlists()) {
10563 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10564 if (EVar.isInvalid())
10566 Vars.push_back(EVar.get());
10568 ExprResult Step = getDerived().TransformExpr(
C->getStep());
10569 if (Step.isInvalid())
10571 return getDerived().RebuildOMPLinearClause(
10572 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
10573 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
10577template <
typename Derived>
10579TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
10581 Vars.reserve(
C->varlist_size());
10582 for (
auto *VE :
C->varlists()) {
10583 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10584 if (EVar.isInvalid())
10586 Vars.push_back(EVar.get());
10588 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
10589 if (Alignment.isInvalid())
10591 return getDerived().RebuildOMPAlignedClause(
10592 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10593 C->getColonLoc(),
C->getEndLoc());
10596template <
typename Derived>
10598TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
10600 Vars.reserve(
C->varlist_size());
10601 for (
auto *VE :
C->varlists()) {
10602 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10603 if (EVar.isInvalid())
10605 Vars.push_back(EVar.get());
10607 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
10608 C->getLParenLoc(),
C->getEndLoc());
10611template <
typename Derived>
10613TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
10615 Vars.reserve(
C->varlist_size());
10616 for (
auto *VE :
C->varlists()) {
10617 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10618 if (EVar.isInvalid())
10620 Vars.push_back(EVar.get());
10622 return getDerived().RebuildOMPCopyprivateClause(
10623 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10626template <
typename Derived>
10627OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
10629 Vars.reserve(
C->varlist_size());
10630 for (
auto *VE :
C->varlists()) {
10631 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10632 if (EVar.isInvalid())
10634 Vars.push_back(EVar.get());
10636 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
10637 C->getLParenLoc(),
C->getEndLoc());
10640template <
typename Derived>
10642TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
10643 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
10646 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
10647 C->getLParenLoc(),
C->getEndLoc());
10650template <
typename Derived>
10652TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
10654 Expr *DepModifier =
C->getModifier();
10656 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
10657 if (DepModRes.isInvalid())
10659 DepModifier = DepModRes.
get();
10661 Vars.reserve(
C->varlist_size());
10662 for (
auto *VE :
C->varlists()) {
10663 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10664 if (EVar.isInvalid())
10666 Vars.push_back(EVar.get());
10668 return getDerived().RebuildOMPDependClause(
10669 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
10670 C->getOmpAllMemoryLoc()},
10671 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10674template <
typename Derived>
10676TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
10677 ExprResult E = getDerived().TransformExpr(
C->getDevice());
10680 return getDerived().RebuildOMPDeviceClause(
10681 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10682 C->getModifierLoc(),
C->getEndLoc());
10685template <
typename Derived,
class T>
10692 Vars.reserve(
C->varlist_size());
10693 for (
auto *VE :
C->varlists()) {
10697 Vars.push_back(EVar.
get());
10701 if (
C->getMapperQualifierLoc()) {
10702 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
10703 C->getMapperQualifierLoc());
10707 MapperIdScopeSpec.
Adopt(QualifierLoc);
10708 MapperIdInfo =
C->getMapperIdInfo();
10709 if (MapperIdInfo.
getName()) {
10710 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
10716 for (
auto *E :
C->mapperlists()) {
10719 auto *ULE = cast<UnresolvedLookupExpr>(E);
10721 for (
auto *D : ULE->decls()) {
10723 cast<NamedDecl>(TT.
getDerived().TransformDecl(E->getExprLoc(), D));
10729 MapperIdInfo,
true, Decls.
begin(), Decls.
end(),
10732 UnresolvedMappers.push_back(
nullptr);
10738template <
typename Derived>
10739OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
10740 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10742 Expr *IteratorModifier =
C->getIteratorModifier();
10743 if (IteratorModifier) {
10744 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
10745 if (MapModRes.isInvalid())
10747 IteratorModifier = MapModRes.
get();
10749 CXXScopeSpec MapperIdScopeSpec;
10750 DeclarationNameInfo MapperIdInfo;
10752 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
10753 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10755 return getDerived().RebuildOMPMapClause(
10756 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
10757 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
10758 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10761template <
typename Derived>
10763TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
10764 Expr *Allocator =
C->getAllocator();
10766 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
10767 if (AllocatorRes.isInvalid())
10769 Allocator = AllocatorRes.get();
10772 Vars.reserve(
C->varlist_size());
10773 for (
auto *VE :
C->varlists()) {
10774 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10775 if (EVar.isInvalid())
10777 Vars.push_back(EVar.get());
10779 return getDerived().RebuildOMPAllocateClause(
10780 Allocator, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10784template <
typename Derived>
10786TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
10787 ExprResult E = getDerived().TransformExpr(
C->getNumTeams());
10790 return getDerived().RebuildOMPNumTeamsClause(
10791 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10794template <
typename Derived>
10796TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
10797 ExprResult E = getDerived().TransformExpr(
C->getThreadLimit());
10800 return getDerived().RebuildOMPThreadLimitClause(
10801 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10804template <
typename Derived>
10806TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
10807 ExprResult E = getDerived().TransformExpr(
C->getPriority());
10810 return getDerived().RebuildOMPPriorityClause(
10811 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10814template <
typename Derived>
10816TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
10817 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
10820 return getDerived().RebuildOMPGrainsizeClause(
10821 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10822 C->getModifierLoc(),
C->getEndLoc());
10825template <
typename Derived>
10827TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
10828 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
10831 return getDerived().RebuildOMPNumTasksClause(
10832 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10833 C->getModifierLoc(),
C->getEndLoc());
10836template <
typename Derived>
10837OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
10838 ExprResult E = getDerived().TransformExpr(
C->getHint());
10841 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
10842 C->getLParenLoc(),
C->getEndLoc());
10845template <
typename Derived>
10846OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
10847 OMPDistScheduleClause *
C) {
10848 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10851 return getDerived().RebuildOMPDistScheduleClause(
10852 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10853 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10856template <
typename Derived>
10858TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
10861 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
10862 C->getDefaultmapKind(),
10865 C->getDefaultmapModifierLoc(),
10866 C->getDefaultmapKindLoc(),
10870template <
typename Derived>
10871OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
10872 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10874 CXXScopeSpec MapperIdScopeSpec;
10875 DeclarationNameInfo MapperIdInfo;
10877 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
10878 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10880 return getDerived().RebuildOMPToClause(
10881 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
10882 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10885template <
typename Derived>
10886OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
10887 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10889 CXXScopeSpec MapperIdScopeSpec;
10890 DeclarationNameInfo MapperIdInfo;
10892 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
10893 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10895 return getDerived().RebuildOMPFromClause(
10896 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
10897 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10900template <
typename Derived>
10901OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
10902 OMPUseDevicePtrClause *
C) {
10904 Vars.reserve(
C->varlist_size());
10905 for (
auto *VE :
C->varlists()) {
10906 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10907 if (EVar.isInvalid())
10909 Vars.push_back(EVar.get());
10911 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10912 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
10915template <
typename Derived>
10916OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
10917 OMPUseDeviceAddrClause *
C) {
10919 Vars.reserve(
C->varlist_size());
10920 for (
auto *VE :
C->varlists()) {
10921 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10922 if (EVar.isInvalid())
10924 Vars.push_back(EVar.get());
10926 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10927 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
10930template <
typename Derived>
10932TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
10934 Vars.reserve(
C->varlist_size());
10935 for (
auto *VE :
C->varlists()) {
10936 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10937 if (EVar.isInvalid())
10939 Vars.push_back(EVar.get());
10941 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10942 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
10945template <
typename Derived>
10946OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
10947 OMPHasDeviceAddrClause *
C) {
10949 Vars.reserve(
C->varlist_size());
10950 for (
auto *VE :
C->varlists()) {
10951 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10952 if (EVar.isInvalid())
10954 Vars.push_back(EVar.get());
10956 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10957 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
10960template <
typename Derived>
10962TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
10964 Vars.reserve(
C->varlist_size());
10965 for (
auto *VE :
C->varlists()) {
10966 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10967 if (EVar.isInvalid())
10969 Vars.push_back(EVar.get());
10971 return getDerived().RebuildOMPNontemporalClause(
10972 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10975template <
typename Derived>
10977TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
10979 Vars.reserve(
C->varlist_size());
10980 for (
auto *VE :
C->varlists()) {
10981 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10982 if (EVar.isInvalid())
10984 Vars.push_back(EVar.get());
10986 return getDerived().RebuildOMPInclusiveClause(
10987 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10990template <
typename Derived>
10992TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
10994 Vars.reserve(
C->varlist_size());
10995 for (
auto *VE :
C->varlists()) {
10996 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10997 if (EVar.isInvalid())
10999 Vars.push_back(EVar.get());
11001 return getDerived().RebuildOMPExclusiveClause(
11002 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11005template <
typename Derived>
11006OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
11007 OMPUsesAllocatorsClause *
C) {
11009 Data.reserve(
C->getNumberOfAllocators());
11010 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11011 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
11012 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11013 if (Allocator.isInvalid())
11016 if (Expr *AT = D.AllocatorTraits) {
11017 AllocatorTraits = getDerived().TransformExpr(AT);
11018 if (AllocatorTraits.isInvalid())
11021 SemaOpenMP::UsesAllocatorsData &NewD =
Data.emplace_back();
11022 NewD.Allocator = Allocator.get();
11023 NewD.AllocatorTraits = AllocatorTraits.get();
11024 NewD.LParenLoc = D.LParenLoc;
11025 NewD.RParenLoc = D.RParenLoc;
11027 return getDerived().RebuildOMPUsesAllocatorsClause(
11028 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11031template <
typename Derived>
11033TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
11035 Locators.reserve(
C->varlist_size());
11037 if (Expr *Modifier =
C->getModifier()) {
11038 ModifierRes = getDerived().TransformExpr(Modifier);
11039 if (ModifierRes.isInvalid())
11042 for (Expr *E :
C->varlists()) {
11043 ExprResult Locator = getDerived().TransformExpr(E);
11044 if (Locator.isInvalid())
11046 Locators.push_back(Locator.get());
11048 return getDerived().RebuildOMPAffinityClause(
11049 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11050 ModifierRes.get(), Locators);
11053template <
typename Derived>
11054OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
11055 return getDerived().RebuildOMPOrderClause(
11056 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11057 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11060template <
typename Derived>
11061OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
11062 return getDerived().RebuildOMPBindClause(
11063 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11064 C->getLParenLoc(),
C->getEndLoc());
11067template <
typename Derived>
11068OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
11069 OMPXDynCGroupMemClause *
C) {
11071 if (
Size.isInvalid())
11073 return getDerived().RebuildOMPXDynCGroupMemClause(
11074 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11077template <
typename Derived>
11079TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
11081 Vars.reserve(
C->varlist_size());
11082 for (
auto *VE :
C->varlists()) {
11083 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11084 if (EVar.isInvalid())
11086 Vars.push_back(EVar.get());
11088 return getDerived().RebuildOMPDoacrossClause(
11089 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11090 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11093template <
typename Derived>
11095TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11097 for (
auto *A :
C->getAttrs())
11098 NewAttrs.push_back(getDerived().TransformAttr(A));
11099 return getDerived().RebuildOMPXAttributeClause(
11100 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11103template <
typename Derived>
11104OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11105 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11112template <
typename Derived>
11113class OpenACCClauseTransform final
11114 :
public OpenACCClauseVisitor<OpenACCClauseTransform<Derived>> {
11115 TreeTransform<Derived> &Self;
11117 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11118 OpenACCClause *NewClause =
nullptr;
11122 for (Expr *CurVar : VarList) {
11123 ExprResult Res = Self.TransformExpr(CurVar);
11125 if (!Res.isUsable())
11128 Res = Self.getSema().OpenACC().ActOnVar(Res.get());
11130 if (Res.isUsable())
11131 InstantiatedVarList.push_back(Res.get());
11134 return InstantiatedVarList;
11138 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11140 SemaOpenACC::OpenACCParsedClause &PC)
11141 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11143 OpenACCClause *CreatedClause()
const {
return NewClause; }
11145#define VISIT_CLAUSE(CLAUSE_NAME) \
11146 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11147#include "clang/Basic/OpenACCClauses.def"
11150template <
typename Derived>
11151void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11152 const OpenACCDefaultClause &
C) {
11161template <
typename Derived>
11162void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11163 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11164 assert(Cond &&
"If constructed with invalid Condition");
11165 Sema::ConditionResult Res =
Self.TransformCondition(
11168 if (Res.isInvalid() || !Res.get().second)
11179template <
typename Derived>
11180void OpenACCClauseTransform<Derived>::VisitSelfClause(
11181 const OpenACCSelfClause &
C) {
11183 if (
C.hasConditionExpr()) {
11184 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
11185 Sema::ConditionResult Res =
11186 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
11189 if (Res.isInvalid() || !Res.get().second)
11201template <
typename Derived>
11202void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11203 const OpenACCNumGangsClause &
C) {
11206 for (Expr *CurIntExpr :
C.getIntExprs()) {
11209 if (!Res.isUsable())
11214 C.getBeginLoc(), Res.get());
11215 if (!Res.isUsable())
11218 InstantiatedIntExprs.push_back(Res.get());
11228template <
typename Derived>
11229void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11230 const OpenACCPrivateClause &
C) {
11240template <
typename Derived>
11241void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11242 const OpenACCFirstPrivateClause &
C) {
11252template <
typename Derived>
11253void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11254 const OpenACCNoCreateClause &
C) {
11264template <
typename Derived>
11265void OpenACCClauseTransform<Derived>::VisitPresentClause(
11266 const OpenACCPresentClause &
C) {
11276template <
typename Derived>
11277void OpenACCClauseTransform<Derived>::VisitCopyClause(
11278 const OpenACCCopyClause &
C) {
11288template <
typename Derived>
11289void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11290 const OpenACCCopyInClause &
C) {
11301template <
typename Derived>
11302void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11303 const OpenACCCopyOutClause &
C) {
11305 false,
C.isZero());
11314template <
typename Derived>
11315void OpenACCClauseTransform<Derived>::VisitCreateClause(
11316 const OpenACCCreateClause &
C) {
11318 false,
C.isZero());
11326template <
typename Derived>
11327void OpenACCClauseTransform<Derived>::VisitAttachClause(
11328 const OpenACCAttachClause &
C) {
11332 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *E) {
11333 return Self.getSema().OpenACC().CheckVarIsPointerType(
11334 OpenACCClauseKind::Attach, E);
11335 }), VarList.end());
11345template <
typename Derived>
11346void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
11347 const OpenACCDevicePtrClause &
C) {
11351 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](Expr *E) {
11352 return Self.getSema().OpenACC().CheckVarIsPointerType(
11353 OpenACCClauseKind::DevicePtr, E);
11354 }), VarList.end());
11364template <
typename Derived>
11365void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
11366 const OpenACCNumWorkersClause &
C) {
11367 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11368 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
11371 if (!Res.isUsable())
11376 C.getBeginLoc(), Res.get());
11377 if (!Res.isUsable())
11387template <
typename Derived>
11388void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
11389 const OpenACCVectorLengthClause &
C) {
11390 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
11391 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
11394 if (!Res.isUsable())
11399 C.getBeginLoc(), Res.get());
11400 if (!Res.isUsable())
11410template <
typename Derived>
11411void OpenACCClauseTransform<Derived>::VisitAsyncClause(
11412 const OpenACCAsyncClause &
C) {
11413 if (
C.hasIntExpr()) {
11414 ExprResult Res =
Self.TransformExpr(
const_cast<Expr *
>(
C.getIntExpr()));
11415 if (!Res.isUsable())
11420 C.getBeginLoc(), Res.get());
11421 if (!Res.isUsable())
11433template <
typename Derived>
11434void OpenACCClauseTransform<Derived>::VisitWaitClause(
11435 const OpenACCWaitClause &
C) {
11436 if (!
C.getLParenLoc().isInvalid()) {
11437 Expr *DevNumExpr =
nullptr;
11441 if (
C.getDevNumExpr()) {
11443 if (!Res.isUsable())
11447 C.getBeginLoc(), Res.get());
11448 if (!Res.isUsable())
11451 DevNumExpr = Res.get();
11455 for (Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
11457 if (!Res.isUsable())
11461 C.getBeginLoc(), Res.get());
11462 if (!Res.isUsable())
11465 InstantiatedQueueIdExprs.push_back(Res.get());
11469 std::move(InstantiatedQueueIdExprs));
11479template <
typename Derived>
11480void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
11481 const OpenACCDeviceTypeClause &
C) {
11484 Self.getSema().getASTContext(),
C.getClauseKind(),
11486 C.getArchitectures(), ParsedClause.
getEndLoc());
11489template <
typename Derived>
11490OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
11494 SemaOpenACC::OpenACCParsedClause ParsedClause(
11495 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
11496 ParsedClause.
setEndLoc(OldClause->getEndLoc());
11498 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
11501 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
11503 Transform.Visit(OldClause);
11505 return Transform.CreatedClause();
11508template <
typename Derived>
11510TreeTransform<Derived>::TransformOpenACCClauseList(
11513 for (
const auto *Clause : OldClauses) {
11514 if (OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
11515 TransformedClauses, DirKind, Clause))
11516 TransformedClauses.push_back(TransformedClause);
11518 return TransformedClauses;
11521template <
typename Derived>
11522StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
11523 OpenACCComputeConstruct *
C) {
11524 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
11528 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
11533 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
11537 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
11539 getSema().OpenACC().ActOnAssociatedStmt(
C->getDirectiveKind(), StrBlock);
11541 return getDerived().RebuildOpenACCComputeConstruct(
11542 C->getDirectiveKind(),
C->getBeginLoc(),
C->getEndLoc(),
11543 TransformedClauses, StrBlock);
11549template<
typename Derived>
11551TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *E) {
11552 return TransformExpr(E->getSubExpr());
11555template <
typename Derived>
11556ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
11557 SYCLUniqueStableNameExpr *E) {
11558 if (!E->isTypeDependent())
11561 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
11566 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
11569 return getDerived().RebuildSYCLUniqueStableNameExpr(
11570 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
11573template<
typename Derived>
11575TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) {
11576 if (!E->isTypeDependent())
11579 return getDerived().RebuildPredefinedExpr(E->getLocation(),
11580 E->getIdentKind());
11583template<
typename Derived>
11585TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
11586 NestedNameSpecifierLoc QualifierLoc;
11587 if (E->getQualifierLoc()) {
11589 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
11595 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
11600 NamedDecl *Found = ND;
11601 if (E->getFoundDecl() != E->getDecl()) {
11602 Found = cast_or_null<NamedDecl>(
11603 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
11608 DeclarationNameInfo NameInfo = E->getNameInfo();
11609 if (NameInfo.getName()) {
11610 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11611 if (!NameInfo.getName())
11615 if (!getDerived().AlwaysRebuild() &&
11616 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
11617 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
11618 Found == E->getFoundDecl() &&
11619 NameInfo.getName() == E->getDecl()->getDeclName() &&
11620 !E->hasExplicitTemplateArgs()) {
11629 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
11630 if (E->hasExplicitTemplateArgs()) {
11631 TemplateArgs = &TransArgs;
11632 TransArgs.setLAngleLoc(E->getLAngleLoc());
11633 TransArgs.setRAngleLoc(E->getRAngleLoc());
11634 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
11635 E->getNumTemplateArgs(),
11640 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
11641 Found, TemplateArgs);
11644template<
typename Derived>
11646TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) {
11650template <
typename Derived>
11651ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
11652 FixedPointLiteral *E) {
11656template<
typename Derived>
11658TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) {
11662template<
typename Derived>
11664TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) {
11668template<
typename Derived>
11670TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) {
11674template<
typename Derived>
11676TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
11680template<
typename Derived>
11682TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
11683 return getDerived().TransformCallExpr(E);
11686template<
typename Derived>
11688TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *E) {
11690 TypeSourceInfo *ControllingType =
nullptr;
11691 if (E->isExprPredicate())
11692 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
11694 ControllingType = getDerived().TransformType(E->getControllingType());
11696 if (ControllingExpr.isInvalid() && !ControllingType)
11702 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
11704 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
11707 AssocTypes.push_back(AssocType);
11709 AssocTypes.push_back(
nullptr);
11713 getDerived().TransformExpr(Assoc.getAssociationExpr());
11714 if (AssocExpr.isInvalid())
11716 AssocExprs.push_back(AssocExpr.get());
11719 if (!ControllingType)
11720 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
11721 E->getDefaultLoc(),
11723 ControllingExpr.get(),
11726 return getDerived().RebuildGenericSelectionExpr(
11727 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
11728 ControllingType, AssocTypes, AssocExprs);
11731template<
typename Derived>
11733TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) {
11734 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
11735 if (SubExpr.isInvalid())
11738 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
11741 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
11748template<
typename Derived>
11752 return getDerived().TransformDependentScopeDeclRefExpr(
11753 DRE,
true,
nullptr);
11755 return getDerived().TransformUnresolvedLookupExpr(
11758 return getDerived().TransformExpr(E);
11761template<
typename Derived>
11766 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
11772 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
11780template<
typename Derived>
11782TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
11784 TypeSourceInfo *
Type = getDerived().TransformType(E->getTypeSourceInfo());
11794 bool ExprChanged =
false;
11795 typedef Sema::OffsetOfComponent Component;
11797 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
11798 const OffsetOfNode &ON = E->getComponent(I);
11800 Comp.isBrackets =
true;
11801 Comp.LocStart = ON.getSourceRange().getBegin();
11802 Comp.LocEnd = ON.getSourceRange().getEnd();
11803 switch (ON.getKind()) {
11805 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
11806 ExprResult Index = getDerived().TransformExpr(FromIndex);
11807 if (Index.isInvalid())
11810 ExprChanged = ExprChanged || Index.get() != FromIndex;
11811 Comp.isBrackets =
true;
11812 Comp.U.E = Index.get();
11818 Comp.isBrackets =
false;
11819 Comp.U.IdentInfo = ON.getFieldName();
11820 if (!
Comp.U.IdentInfo)
11830 Components.push_back(Comp);
11834 if (!getDerived().AlwaysRebuild() &&
11835 Type == E->getTypeSourceInfo() &&
11840 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(), Type,
11841 Components, E->getRParenLoc());
11844template<
typename Derived>
11846TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *E) {
11847 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
11848 "opaque value expression requires transformation");
11852template<
typename Derived>
11854TreeTransform<Derived>::TransformTypoExpr(TypoExpr *E) {
11858template <
typename Derived>
11859ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *E) {
11862 for (Expr *
C : E->subExpressions()) {
11864 if (NewC.isInvalid())
11866 Children.push_back(NewC.get());
11870 if (!getDerived().AlwaysRebuild() && !Changed)
11872 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
11873 Children, E->getType());
11876template<
typename Derived>
11878TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *E) {
11886 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
11887 if (result.isInvalid())
return ExprError();
11892 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
11898template<
typename Derived>
11900TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
11901 UnaryExprOrTypeTraitExpr *E) {
11902 if (E->isArgumentType()) {
11903 TypeSourceInfo *OldT = E->getArgumentTypeInfo();
11905 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
11909 if (!getDerived().AlwaysRebuild() && OldT == NewT)
11912 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
11914 E->getSourceRange());
11926 TypeSourceInfo *RecoveryTSI =
nullptr;
11928 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
11930 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
11931 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
11932 PE, DRE,
false, &RecoveryTSI);
11934 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
11937 return getDerived().RebuildUnaryExprOrTypeTrait(
11938 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
11939 }
else if (SubExpr.isInvalid())
11942 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
11945 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
11946 E->getOperatorLoc(),
11948 E->getSourceRange());
11951template<
typename Derived>
11953TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
11954 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
11955 if (LHS.isInvalid())
11958 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
11959 if (RHS.isInvalid())
11963 if (!getDerived().AlwaysRebuild() &&
11964 LHS.get() == E->getLHS() &&
11965 RHS.get() == E->getRHS())
11968 return getDerived().RebuildArraySubscriptExpr(
11970 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
11973template <
typename Derived>
11975TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
11977 if (
Base.isInvalid())
11980 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
11981 if (RowIdx.isInvalid())
11984 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
11985 if (ColumnIdx.isInvalid())
11988 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
11989 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
11992 return getDerived().RebuildMatrixSubscriptExpr(
11993 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
11996template <
typename Derived>
11998TreeTransform<Derived>::TransformArraySectionExpr(ArraySectionExpr *E) {
12000 if (
Base.isInvalid())
12004 if (E->getLowerBound()) {
12005 LowerBound = getDerived().TransformExpr(E->getLowerBound());
12006 if (LowerBound.isInvalid())
12011 if (E->getLength()) {
12012 Length = getDerived().TransformExpr(E->getLength());
12013 if (Length.isInvalid())
12018 if (E->isOMPArraySection()) {
12019 if (Expr *Str = E->getStride()) {
12020 Stride = getDerived().TransformExpr(Str);
12021 if (Stride.isInvalid())
12026 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
12027 LowerBound.get() == E->getLowerBound() &&
12028 Length.get() == E->getLength() &&
12029 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
12032 return getDerived().RebuildArraySectionExpr(
12033 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
12034 LowerBound.get(), E->getColonLocFirst(),
12035 E->isOMPArraySection() ? E->getColonLocSecond() : SourceLocation{},
12036 Length.get(), Stride.get(), E->getRBracketLoc());
12039template <
typename Derived>
12041TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
12043 if (
Base.isInvalid())
12047 bool ErrorFound =
false;
12048 for (Expr *Dim : E->getDimensions()) {
12049 ExprResult DimRes = getDerived().TransformExpr(Dim);
12050 if (DimRes.isInvalid()) {
12054 Dims.push_back(DimRes.get());
12059 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
12060 E->getRParenLoc(), Dims,
12061 E->getBracketsRanges());
12064template <
typename Derived>
12066TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *E) {
12067 unsigned NumIterators = E->numOfIterators();
12070 bool ErrorFound =
false;
12071 bool NeedToRebuild = getDerived().AlwaysRebuild();
12072 for (
unsigned I = 0; I < NumIterators; ++I) {
12073 auto *D = cast<VarDecl>(E->getIteratorDecl(I));
12074 Data[I].DeclIdent = D->getIdentifier();
12075 Data[I].DeclIdentLoc = D->getLocation();
12076 if (D->getLocation() == D->getBeginLoc()) {
12078 "Implicit type must be int.");
12080 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
12081 QualType
DeclTy = getDerived().TransformType(D->getType());
12084 OMPIteratorExpr::IteratorRange
Range = E->getIteratorRange(I);
12088 ErrorFound = ErrorFound ||
12089 !(!D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
12090 !
Data[I].Type.get().isNull())) ||
12095 Data[I].Range.End = End.get();
12096 Data[I].Range.Step = Step.get();
12097 Data[I].AssignLoc = E->getAssignLoc(I);
12098 Data[I].ColonLoc = E->getColonLoc(I);
12099 Data[I].SecColonLoc = E->getSecondColonLoc(I);
12102 (D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
12103 D->getType().getTypePtrOrNull()) ||
12109 if (!NeedToRebuild)
12112 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
12113 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
12114 if (!Res.isUsable())
12116 auto *IE = cast<OMPIteratorExpr>(Res.get());
12117 for (
unsigned I = 0; I < NumIterators; ++I)
12118 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
12119 IE->getIteratorDecl(I));
12123template<
typename Derived>
12125TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
12132 bool ArgChanged =
false;
12134 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
12138 if (!getDerived().AlwaysRebuild() &&
12139 Callee.get() == E->getCallee() &&
12144 SourceLocation FakeLParenLoc
12147 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12148 if (E->hasStoredFPFeatures()) {
12149 FPOptionsOverride NewOverrides = E->getFPFeatures();
12150 getSema().CurFPFeatures =
12151 NewOverrides.applyOverrides(getSema().getLangOpts());
12152 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12155 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
12157 E->getRParenLoc());
12160template<
typename Derived>
12162TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
12164 if (
Base.isInvalid())
12167 NestedNameSpecifierLoc QualifierLoc;
12168 if (E->hasQualifier()) {
12170 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12175 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
12178 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
12179 E->getMemberDecl()));
12183 NamedDecl *FoundDecl = E->getFoundDecl();
12184 if (FoundDecl == E->getMemberDecl()) {
12187 FoundDecl = cast_or_null<NamedDecl>(
12188 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
12193 if (!getDerived().AlwaysRebuild() &&
12194 Base.get() == E->getBase() &&
12195 QualifierLoc == E->getQualifierLoc() &&
12196 Member == E->getMemberDecl() &&
12197 FoundDecl == E->getFoundDecl() &&
12198 !E->hasExplicitTemplateArgs()) {
12202 if (!(isa<CXXThisExpr>(E->getBase()) &&
12203 getSema().OpenMP().isOpenMPRebuildMemberExpr(
12204 cast<ValueDecl>(
Member)))) {
12212 TemplateArgumentListInfo TransArgs;
12213 if (E->hasExplicitTemplateArgs()) {
12214 TransArgs.setLAngleLoc(E->getLAngleLoc());
12215 TransArgs.setRAngleLoc(E->getRAngleLoc());
12216 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
12217 E->getNumTemplateArgs(),
12223 SourceLocation FakeOperatorLoc =
12230 NamedDecl *FirstQualifierInScope =
nullptr;
12231 DeclarationNameInfo MemberNameInfo = E->getMemberNameInfo();
12232 if (MemberNameInfo.getName()) {
12233 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
12234 if (!MemberNameInfo.getName())
12238 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
12245 (E->hasExplicitTemplateArgs()
12246 ? &TransArgs :
nullptr),
12247 FirstQualifierInScope);
12250template<
typename Derived>
12252TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
12253 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
12254 if (LHS.isInvalid())
12258 getDerived().TransformInitializer(E->getRHS(),
false);
12259 if (RHS.isInvalid())
12262 if (!getDerived().AlwaysRebuild() &&
12263 LHS.get() == E->getLHS() &&
12264 RHS.get() == E->getRHS())
12267 if (E->isCompoundAssignmentOp())
12269 return getDerived().RebuildBinaryOperator(
12270 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
12271 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12272 FPOptionsOverride NewOverrides(E->getFPFeatures());
12273 getSema().CurFPFeatures =
12274 NewOverrides.applyOverrides(getSema().getLangOpts());
12275 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12276 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
12277 LHS.get(), RHS.get());
12280template <
typename Derived>
12281ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
12282 CXXRewrittenBinaryOperator *E) {
12283 CXXRewrittenBinaryOperator::DecomposedForm Decomp = E->getDecomposedForm();
12285 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
12286 if (LHS.isInvalid())
12289 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
12290 if (RHS.isInvalid())
12295 UnresolvedSet<2> UnqualLookups;
12296 bool ChangedAnyLookups =
false;
12297 Expr *PossibleBinOps[] = {E->getSemanticForm(),
12298 const_cast<Expr *
>(Decomp.InnerBinOp)};
12299 for (Expr *PossibleBinOp : PossibleBinOps) {
12300 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
12303 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
12304 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
12309 NamedDecl *Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
12310 E->getOperatorLoc(),
Callee->getFoundDecl()));
12313 if (Found !=
Callee->getFoundDecl())
12314 ChangedAnyLookups =
true;
12315 UnqualLookups.addDecl(Found);
12318 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
12319 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
12325 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
12330 return getDerived().RebuildCXXRewrittenBinaryOperator(
12331 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
12334template<
typename Derived>
12336TreeTransform<Derived>::TransformCompoundAssignOperator(
12337 CompoundAssignOperator *E) {
12338 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12339 FPOptionsOverride NewOverrides(E->getFPFeatures());
12340 getSema().CurFPFeatures =
12341 NewOverrides.applyOverrides(getSema().getLangOpts());
12342 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12343 return getDerived().TransformBinaryOperator(E);
12346template<
typename Derived>
12348TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
12352 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
12353 if (commonExpr.isInvalid())
12356 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
12357 if (rhs.isInvalid())
12360 if (!getDerived().AlwaysRebuild() &&
12361 commonExpr.get() == e->getCommon() &&
12362 rhs.get() == e->getFalseExpr())
12365 return getDerived().RebuildConditionalOperator(commonExpr.get(),
12366 e->getQuestionLoc(),
12372template<
typename Derived>
12374TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) {
12375 ExprResult Cond = getDerived().TransformExpr(E->getCond());
12376 if (Cond.isInvalid())
12379 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
12380 if (LHS.isInvalid())
12383 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
12384 if (RHS.isInvalid())
12387 if (!getDerived().AlwaysRebuild() &&
12388 Cond.get() == E->getCond() &&
12389 LHS.get() == E->getLHS() &&
12390 RHS.get() == E->getRHS())
12393 return getDerived().RebuildConditionalOperator(Cond.get(),
12394 E->getQuestionLoc(),
12400template<
typename Derived>
12402TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) {
12405 return getDerived().TransformExpr(E->getSubExprAsWritten());
12408template<
typename Derived>
12410TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
12411 TypeSourceInfo *
Type = getDerived().TransformType(E->getTypeInfoAsWritten());
12416 = getDerived().TransformExpr(E->getSubExprAsWritten());
12417 if (SubExpr.isInvalid())
12420 if (!getDerived().AlwaysRebuild() &&
12421 Type == E->getTypeInfoAsWritten() &&
12422 SubExpr.get() == E->getSubExpr())
12425 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
12431template<
typename Derived>
12433TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
12434 TypeSourceInfo *OldT = E->getTypeSourceInfo();
12435 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
12439 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
12440 if (
Init.isInvalid())
12443 if (!getDerived().AlwaysRebuild() &&
12445 Init.get() == E->getInitializer())
12452 return getDerived().RebuildCompoundLiteralExpr(
12453 E->getLParenLoc(), NewT,
12454 E->getInitializer()->getEndLoc(),
Init.get());
12457template<
typename Derived>
12459TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) {
12461 if (
Base.isInvalid())
12464 if (!getDerived().AlwaysRebuild() &&
12465 Base.get() == E->getBase())
12469 SourceLocation FakeOperatorLoc =
12471 return getDerived().RebuildExtVectorElementExpr(
12472 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
12476template<
typename Derived>
12478TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) {
12479 if (InitListExpr *Syntactic = E->getSyntacticForm())
12482 bool InitChanged =
false;
12484 EnterExpressionEvaluationContext Context(
12488 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
12489 Inits, &InitChanged))
12492 if (!getDerived().AlwaysRebuild() && !InitChanged) {
12499 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
12500 E->getRBraceLoc());
12503template<
typename Derived>
12505TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
12510 if (
Init.isInvalid())
12515 bool ExprChanged =
false;
12516 for (
const DesignatedInitExpr::Designator &D : E->designators()) {
12517 if (D.isFieldDesignator()) {
12518 if (D.getFieldDecl()) {
12519 FieldDecl *
Field = cast_or_null<FieldDecl>(
12520 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
12521 if (Field != D.getFieldDecl())
12524 ExprChanged =
true;
12525 if (
Field->isAnonymousStructOrUnion())
12531 ExprChanged =
true;
12534 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
12538 if (D.isArrayDesignator()) {
12539 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
12540 if (Index.isInvalid())
12543 Desig.AddDesignator(
12546 ExprChanged = ExprChanged ||
Init.get() != E->getArrayIndex(D);
12547 ArrayExprs.push_back(Index.get());
12551 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
12553 = getDerived().TransformExpr(E->getArrayRangeStart(D));
12554 if (Start.isInvalid())
12557 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
12558 if (End.isInvalid())
12562 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
12564 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
12565 End.get() != E->getArrayRangeEnd(D);
12567 ArrayExprs.push_back(Start.get());
12568 ArrayExprs.push_back(End.get());
12571 if (!getDerived().AlwaysRebuild() &&
12572 Init.get() == E->getInit() &&
12576 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
12577 E->getEqualOrColonLoc(),
12578 E->usesGNUSyntax(),
Init.get());
12583template<
typename Derived>
12585TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
12586 DesignatedInitUpdateExpr *E) {
12587 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
12592template<
typename Derived>
12594TreeTransform<Derived>::TransformNoInitExpr(
12596 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
12600template<
typename Derived>
12602TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *E) {
12603 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
12607template<
typename Derived>
12609TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *E) {
12610 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
12614template<
typename Derived>
12616TreeTransform<Derived>::TransformImplicitValueInitExpr(
12617 ImplicitValueInitExpr *E) {
12618 TemporaryBase Rebase(*
this, E->getBeginLoc(), DeclarationName());
12622 QualType
T = getDerived().TransformType(E->getType());
12626 if (!getDerived().AlwaysRebuild() &&
12630 return getDerived().RebuildImplicitValueInitExpr(
T);
12633template<
typename Derived>
12635TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) {
12636 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
12640 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
12641 if (SubExpr.isInvalid())
12644 if (!getDerived().AlwaysRebuild() &&
12645 TInfo == E->getWrittenTypeInfo() &&
12646 SubExpr.get() == E->getSubExpr())
12649 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
12650 TInfo, E->getRParenLoc());
12653template<
typename Derived>
12655TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) {
12656 bool ArgumentChanged =
false;
12658 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
12662 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
12664 E->getRParenLoc());
12672template<
typename Derived>
12674TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) {
12675 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
12680 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
12681 cast<LabelDecl>(LD));
12684template<
typename Derived>
12686TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
12689 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
12690 if (SubStmt.isInvalid()) {
12695 unsigned OldDepth = E->getTemplateDepth();
12696 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
12698 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
12699 SubStmt.get() == E->getSubStmt()) {
12705 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
12706 E->getRParenLoc(), NewDepth);
12709template<
typename Derived>
12711TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
12712 ExprResult Cond = getDerived().TransformExpr(E->getCond());
12713 if (Cond.isInvalid())
12716 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
12717 if (LHS.isInvalid())
12720 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
12721 if (RHS.isInvalid())
12724 if (!getDerived().AlwaysRebuild() &&
12725 Cond.get() == E->getCond() &&
12726 LHS.get() == E->getLHS() &&
12727 RHS.get() == E->getRHS())
12730 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
12731 Cond.get(), LHS.get(), RHS.get(),
12732 E->getRParenLoc());
12735template<
typename Derived>
12737TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) {
12741template<
typename Derived>
12743TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
12744 switch (E->getOperator()) {
12748 case OO_Array_Delete:
12749 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
12754 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
12763 static_cast<Expr *
>(
Object.get())->getEndLoc());
12767 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
12771 if (E->getOperator() == OO_Subscript)
12772 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
12773 Args, E->getEndLoc());
12775 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
12779#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
12783#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
12784#include "clang/Basic/OperatorKinds.def"
12786 case OO_Conditional:
12787 llvm_unreachable(
"conditional operator is not actually overloadable");
12791 llvm_unreachable(
"not an overloaded operator?");
12795 if (E->getOperator() == OO_Amp)
12796 First = getDerived().TransformAddressOfOperand(E->getArg(0));
12798 First = getDerived().TransformExpr(E->getArg(0));
12799 if (
First.isInvalid())
12803 if (E->getNumArgs() == 2) {
12805 getDerived().TransformInitializer(E->getArg(1),
false);
12806 if (Second.isInvalid())
12810 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12811 FPOptionsOverride NewOverrides(E->getFPFeatures());
12812 getSema().CurFPFeatures =
12813 NewOverrides.applyOverrides(getSema().getLangOpts());
12814 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12816 Expr *
Callee = E->getCallee();
12817 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
12818 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
12820 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
12823 return getDerived().RebuildCXXOperatorCallExpr(
12824 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
12825 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
12828 UnresolvedSet<1> Functions;
12829 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
12830 Callee = ICE->getSubExprAsWritten();
12831 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
12832 ValueDecl *VD = cast_or_null<ValueDecl>(
12833 getDerived().TransformDecl(DR->getLocation(), DR));
12837 if (!isa<CXXMethodDecl>(VD))
12838 Functions.addDecl(VD);
12840 return getDerived().RebuildCXXOperatorCallExpr(
12841 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
12842 false, Functions,
First.get(), Second.get());
12845template<
typename Derived>
12847TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) {
12848 return getDerived().TransformCallExpr(E);
12851template <
typename Derived>
12852ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *E) {
12854 getSema().CurContext != E->getParentContext();
12856 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
12859 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
12860 E->getBeginLoc(), E->getEndLoc(),
12861 getSema().CurContext);
12864template<
typename Derived>
12866TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
12873 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
12874 if (EC.isInvalid())
12878 bool ArgChanged =
false;
12880 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
12884 if (!getDerived().AlwaysRebuild() &&
12885 Callee.get() == E->getCallee() &&
12890 SourceLocation FakeLParenLoc
12892 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
12894 E->getRParenLoc(), EC.get());
12897template<
typename Derived>
12909 if (!getDerived().AlwaysRebuild() &&
12913 return getDerived().RebuildCXXNamedCastExpr(
12920template<
typename Derived>
12929 if (Sub.isInvalid())
12932 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
12936template<
typename Derived>
12938TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
12939 return getDerived().TransformCXXNamedCastExpr(E);
12942template<
typename Derived>
12944TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
12945 return getDerived().TransformCXXNamedCastExpr(E);
12948template<
typename Derived>
12950TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
12951 CXXReinterpretCastExpr *E) {
12952 return getDerived().TransformCXXNamedCastExpr(E);
12955template<
typename Derived>
12957TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) {
12958 return getDerived().TransformCXXNamedCastExpr(E);
12961template<
typename Derived>
12963TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
12964 return getDerived().TransformCXXNamedCastExpr(E);
12967template<
typename Derived>
12969TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
12970 CXXFunctionalCastExpr *E) {
12971 TypeSourceInfo *
Type =
12972 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
12977 = getDerived().TransformExpr(E->getSubExprAsWritten());
12978 if (SubExpr.isInvalid())
12981 if (!getDerived().AlwaysRebuild() &&
12982 Type == E->getTypeInfoAsWritten() &&
12983 SubExpr.get() == E->getSubExpr())
12986 return getDerived().RebuildCXXFunctionalCastExpr(Type,
12990 E->isListInitialization());
12993template<
typename Derived>
12995TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
12996 if (E->isTypeOperand()) {
12997 TypeSourceInfo *TInfo
12998 = getDerived().TransformType(E->getTypeOperandSourceInfo());
13002 if (!getDerived().AlwaysRebuild() &&
13003 TInfo == E->getTypeOperandSourceInfo())
13006 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
13007 TInfo, E->getEndLoc());
13013 Expr *Op = E->getExprOperand();
13015 if (E->isGLValue())
13016 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
13017 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
13020 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
13023 ExprResult SubExpr = getDerived().TransformExpr(Op);
13024 if (SubExpr.isInvalid())
13027 if (!getDerived().AlwaysRebuild() &&
13028 SubExpr.get() == E->getExprOperand())
13031 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
13032 SubExpr.get(), E->getEndLoc());
13035template<
typename Derived>
13037TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *E) {
13038 if (E->isTypeOperand()) {
13039 TypeSourceInfo *TInfo
13040 = getDerived().TransformType(E->getTypeOperandSourceInfo());
13044 if (!getDerived().AlwaysRebuild() &&
13045 TInfo == E->getTypeOperandSourceInfo())
13048 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
13049 TInfo, E->getEndLoc());
13055 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
13056 if (SubExpr.isInvalid())
13059 if (!getDerived().AlwaysRebuild() &&
13060 SubExpr.get() == E->getExprOperand())
13063 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
13064 SubExpr.get(), E->getEndLoc());
13067template<
typename Derived>
13069TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
13073template<
typename Derived>
13075TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
13076 CXXNullPtrLiteralExpr *E) {
13080template<
typename Derived>
13082TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
13093 QualType
T = [&]() {
13094 auto &S = getSema();
13095 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
13098 return getDerived().TransformType(E->getType());
13102 if (!getDerived().AlwaysRebuild() &&
T == E->getType()) {
13105 getSema().MarkThisReferenced(E);
13109 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
13112template<
typename Derived>
13114TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
13115 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13116 if (SubExpr.isInvalid())
13119 if (!getDerived().AlwaysRebuild() &&
13120 SubExpr.get() == E->getSubExpr())
13123 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
13124 E->isThrownVariableInScope());
13127template<
typename Derived>
13129TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
13130 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
13131 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
13136 if (E->hasRewrittenInit()) {
13137 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
13138 if (InitRes.isInvalid())
13142 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
13143 E->getUsedContext() == SemaRef.
CurContext &&
13144 InitRes.get() == E->getRewrittenExpr())
13147 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
13151template<
typename Derived>
13153TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
13154 FieldDecl *
Field = cast_or_null<FieldDecl>(
13155 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
13159 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
13163 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
13166template<
typename Derived>
13168TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
13169 CXXScalarValueInitExpr *E) {
13170 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
13174 if (!getDerived().AlwaysRebuild() &&
13175 T == E->getTypeSourceInfo())
13178 return getDerived().RebuildCXXScalarValueInitExpr(
T,
13179 T->getTypeLoc().getEndLoc(),
13180 E->getRParenLoc());
13183template<
typename Derived>
13185TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
13187 TypeSourceInfo *AllocTypeInfo =
13188 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
13189 if (!AllocTypeInfo)
13193 std::optional<Expr *> ArraySize;
13194 if (E->isArray()) {
13196 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
13197 NewArraySize = getDerived().TransformExpr(*OldArraySize);
13198 if (NewArraySize.isInvalid())
13201 ArraySize = NewArraySize.get();
13205 bool ArgumentChanged =
false;
13207 if (getDerived().TransformExprs(E->getPlacementArgs(),
13208 E->getNumPlacementArgs(),
true,
13209 PlacementArgs, &ArgumentChanged))
13213 Expr *OldInit = E->getInitializer();
13216 NewInit = getDerived().TransformInitializer(OldInit,
true);
13217 if (NewInit.isInvalid())
13221 FunctionDecl *OperatorNew =
nullptr;
13222 if (E->getOperatorNew()) {
13223 OperatorNew = cast_or_null<FunctionDecl>(
13224 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
13229 FunctionDecl *OperatorDelete =
nullptr;
13230 if (E->getOperatorDelete()) {
13231 OperatorDelete = cast_or_null<FunctionDecl>(
13232 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
13233 if (!OperatorDelete)
13237 if (!getDerived().AlwaysRebuild() &&
13238 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
13239 ArraySize == E->getArraySize() &&
13240 NewInit.get() == OldInit &&
13241 OperatorNew == E->getOperatorNew() &&
13242 OperatorDelete == E->getOperatorDelete() &&
13243 !ArgumentChanged) {
13248 if (OperatorDelete)
13251 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
13252 QualType ElementType
13254 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
13255 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
13265 QualType AllocType = AllocTypeInfo->getType();
13275 }
else if (
const ConstantArrayType *ConsArrayT
13276 = dyn_cast<ConstantArrayType>(ArrayT)) {
13280 AllocType = ConsArrayT->getElementType();
13281 }
else if (
const DependentSizedArrayType *DepArrayT
13282 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
13283 if (DepArrayT->getSizeExpr()) {
13284 ArraySize = DepArrayT->getSizeExpr();
13285 AllocType = DepArrayT->getElementType();
13290 return getDerived().RebuildCXXNewExpr(
13291 E->getBeginLoc(), E->isGlobalNew(),
13292 E->getBeginLoc(), PlacementArgs,
13293 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
13294 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
13297template<
typename Derived>
13299TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
13305 FunctionDecl *OperatorDelete =
nullptr;
13306 if (E->getOperatorDelete()) {
13307 OperatorDelete = cast_or_null<FunctionDecl>(
13308 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
13309 if (!OperatorDelete)
13313 if (!getDerived().AlwaysRebuild() &&
13314 Operand.get() == E->getArgument() &&
13315 OperatorDelete == E->getOperatorDelete()) {
13318 if (OperatorDelete)
13321 if (!E->getArgument()->isTypeDependent()) {
13323 E->getDestroyedType());
13324 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
13325 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
13334 return getDerived().RebuildCXXDeleteExpr(
13335 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
13338template<
typename Derived>
13340TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
13341 CXXPseudoDestructorExpr *E) {
13343 if (
Base.isInvalid())
13347 bool MayBePseudoDestructor =
false;
13349 E->getOperatorLoc(),
13350 E->isArrow()? tok::arrow : tok::period,
13352 MayBePseudoDestructor);
13353 if (
Base.isInvalid())
13356 QualType ObjectType = ObjectTypePtr.get();
13357 NestedNameSpecifierLoc QualifierLoc = E->getQualifierLoc();
13358 if (QualifierLoc) {
13360 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
13365 SS.Adopt(QualifierLoc);
13367 PseudoDestructorTypeStorage Destroyed;
13368 if (E->getDestroyedTypeInfo()) {
13369 TypeSourceInfo *DestroyedTypeInfo
13370 = getDerived().TransformTypeInObjectScope(E->getDestroyedTypeInfo(),
13371 ObjectType,
nullptr, SS);
13372 if (!DestroyedTypeInfo)
13374 Destroyed = DestroyedTypeInfo;
13375 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
13378 Destroyed = PseudoDestructorTypeStorage(E->getDestroyedTypeIdentifier(),
13379 E->getDestroyedTypeLoc());
13383 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
13384 nullptr, SS, ObjectTypePtr,
false);
13390 E->getDestroyedTypeLoc());
13393 TypeSourceInfo *ScopeTypeInfo =
nullptr;
13394 if (E->getScopeTypeInfo()) {
13395 CXXScopeSpec EmptySS;
13396 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
13397 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
13398 if (!ScopeTypeInfo)
13402 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
13403 E->getOperatorLoc(),
13407 E->getColonColonLoc(),
13412template <
typename Derived>
13417 bool AllEmptyPacks =
true;
13418 for (
auto *OldD : Old->
decls()) {
13419 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
13423 if (isa<UsingShadowDecl>(OldD))
13432 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
13434 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
13435 Decls = UPD->expansions();
13438 for (
auto *D : Decls) {
13439 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
13440 for (
auto *SD : UD->shadows())
13447 AllEmptyPacks &= Decls.empty();
13456 if (AllEmptyPacks && !RequiresADL) {
13457 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
13458 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
13468 getSema().FilterAcceptableTemplateNames(R,
13475 diag::err_template_kw_refers_to_non_template)
13479 diag::note_template_kw_refers_to_non_template)
13488template <
typename Derived>
13491 return TransformUnresolvedLookupExpr(Old,
false);
13494template <
typename Derived>
13497 bool IsAddressOfOperand) {
13502 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
13509 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
13513 SS.
Adopt(QualifierLoc);
13517 CXXRecordDecl *NamingClass
13518 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
13521 if (!NamingClass) {
13526 R.setNamingClass(NamingClass);
13547 SS, TemplateKWLoc, R,
13554 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
13557 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
13561template<
typename Derived>
13563TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *E) {
13564 bool ArgChanged =
false;
13566 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
13567 TypeSourceInfo *From = E->getArg(I);
13568 TypeLoc FromTL = From->getTypeLoc();
13569 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
13570 TypeLocBuilder TLB;
13571 TLB.reserve(FromTL.getFullDataSize());
13572 QualType To = getDerived().TransformType(TLB, FromTL);
13576 if (To == From->getType())
13577 Args.push_back(From);
13579 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13588 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
13589 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
13595 bool Expand =
true;
13596 bool RetainExpansion =
false;
13597 std::optional<unsigned> OrigNumExpansions =
13598 ExpansionTL.getTypePtr()->getNumExpansions();
13599 std::optional<unsigned> NumExpansions = OrigNumExpansions;
13600 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
13601 PatternTL.getSourceRange(),
13603 Expand, RetainExpansion,
13611 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
13613 TypeLocBuilder TLB;
13614 TLB.reserve(From->getTypeLoc().getFullDataSize());
13616 QualType To = getDerived().TransformType(TLB, PatternTL);
13620 To = getDerived().RebuildPackExpansionType(To,
13621 PatternTL.getSourceRange(),
13622 ExpansionTL.getEllipsisLoc(),
13627 PackExpansionTypeLoc ToExpansionTL
13628 = TLB.push<PackExpansionTypeLoc>(To);
13629 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13630 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13636 for (
unsigned I = 0; I != *NumExpansions; ++I) {
13637 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
13638 TypeLocBuilder TLB;
13639 TLB.reserve(PatternTL.getFullDataSize());
13640 QualType To = getDerived().TransformType(TLB, PatternTL);
13644 if (To->containsUnexpandedParameterPack()) {
13645 To = getDerived().RebuildPackExpansionType(To,
13646 PatternTL.getSourceRange(),
13647 ExpansionTL.getEllipsisLoc(),
13652 PackExpansionTypeLoc ToExpansionTL
13653 = TLB.push<PackExpansionTypeLoc>(To);
13654 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13657 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13660 if (!RetainExpansion)
13665 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
13667 TypeLocBuilder TLB;
13668 TLB.reserve(From->getTypeLoc().getFullDataSize());
13670 QualType To = getDerived().TransformType(TLB, PatternTL);
13674 To = getDerived().RebuildPackExpansionType(To,
13675 PatternTL.getSourceRange(),
13676 ExpansionTL.getEllipsisLoc(),
13681 PackExpansionTypeLoc ToExpansionTL
13682 = TLB.push<PackExpansionTypeLoc>(To);
13683 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13684 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13687 if (!getDerived().AlwaysRebuild() && !ArgChanged)
13690 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
13694template<
typename Derived>
13696TreeTransform<Derived>::TransformConceptSpecializationExpr(
13697 ConceptSpecializationExpr *E) {
13698 const ASTTemplateArgumentListInfo *Old = E->getTemplateArgsAsWritten();
13699 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
13700 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
13701 Old->NumTemplateArgs, TransArgs))
13704 return getDerived().RebuildConceptSpecializationExpr(
13705 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
13706 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
13710template<
typename Derived>
13712TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *E) {
13715 Sema::ExtParameterInfoBuilder ExtParamInfos;
13719 EnterExpressionEvaluationContext Ctx(
13724 getSema().Context, getSema().CurContext,
13725 E->getBody()->getBeginLoc());
13727 Sema::ContextRAII SavedContext(getSema(), Body,
false);
13729 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
13730 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
13731 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
13733 for (ParmVarDecl *Param : TransParams)
13735 Param->setDeclContext(Body);
13741 if (!TypeParamResult.isUnset())
13742 return TypeParamResult;
13745 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
13749 for (concepts::Requirement *Req : TransReqs) {
13750 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
13751 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
13752 ER->getReturnTypeRequirement()
13753 .getTypeConstraintTemplateParameterList()->getParam(0)
13754 ->setDeclContext(Body);
13759 return getDerived().RebuildRequiresExpr(
13760 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
13761 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
13764template<
typename Derived>
13770 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
13771 TransReq = getDerived().TransformTypeRequirement(TypeReq);
13772 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
13773 TransReq = getDerived().TransformExprRequirement(ExprReq);
13775 TransReq = getDerived().TransformNestedRequirement(
13776 cast<concepts::NestedRequirement>(Req));
13779 Transformed.push_back(TransReq);
13784template<
typename Derived>
13789 if (getDerived().AlwaysRebuild())
13790 return getDerived().RebuildTypeRequirement(
13797 return getDerived().RebuildTypeRequirement(TransType);
13800template<
typename Derived>
13803 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
13812 TransExpr = TransExprRes.
get();
13815 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
13817 if (RetReq.isEmpty())
13818 TransRetReq.emplace();
13819 else if (RetReq.isSubstitutionFailure())
13820 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
13821 else if (RetReq.isTypeConstraint()) {
13823 RetReq.getTypeConstraintTemplateParameterList();
13825 getDerived().TransformTemplateParameterList(OrigTPL);
13828 TransRetReq.emplace(TPL);
13830 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
13831 if (
Expr *E = TransExpr.dyn_cast<
Expr *>())
13832 return getDerived().RebuildExprRequirement(E, Req->
isSimple(),
13834 std::move(*TransRetReq));
13835 return getDerived().RebuildExprRequirement(
13840template<
typename Derived>
13845 if (getDerived().AlwaysRebuild())
13846 return getDerived().RebuildNestedRequirement(
13854 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
13857template<
typename Derived>
13864 if (!getDerived().AlwaysRebuild() &&
13884template<
typename Derived>
13886TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *E) {
13891 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
13892 if (SubExpr.isInvalid())
13895 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
13899 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
13900 SubExpr.get(), E->getEndLoc());
13903template <
typename Derived>
13907 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
13908 DRE, AddrTaken, RecoveryTSI);
13915 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
13917 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
13921template <
typename Derived>
13924 return TransformDependentScopeDeclRefExpr(E,
false,
13928template <
typename Derived>
13944 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
13949 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
13955 return getDerived().RebuildDependentScopeDeclRefExpr(
13956 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
13957 IsAddressOfOperand, RecoveryTSI);
13961 if (getDerived().TransformTemplateArguments(
13965 return getDerived().RebuildDependentScopeDeclRefExpr(
13966 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
13970template<
typename Derived>
13972TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
13976 if (getDerived().AllowSkippingCXXConstructExpr() &&
13977 ((E->getNumArgs() == 1 ||
13978 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
13979 (!getDerived().DropCallArgument(E->getArg(0))) &&
13980 !E->isListInitialization()))
13981 return getDerived().TransformInitializer(E->getArg(0),
13984 TemporaryBase Rebase(*
this, E->getBeginLoc(), DeclarationName());
13986 QualType
T = getDerived().TransformType(E->getType());
13990 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
13991 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
13995 bool ArgumentChanged =
false;
13998 EnterExpressionEvaluationContext Context(
14000 E->isListInitialization());
14001 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14006 if (!getDerived().AlwaysRebuild() &&
14007 T == E->getType() &&
14008 Constructor == E->getConstructor() &&
14009 !ArgumentChanged) {
14016 return getDerived().RebuildCXXConstructExpr(
14017 T, E->getBeginLoc(), Constructor, E->isElidable(), Args,
14018 E->hadMultipleCandidates(), E->isListInitialization(),
14019 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
14020 E->getConstructionKind(), E->getParenOrBraceRange());
14023template<
typename Derived>
14024ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
14025 CXXInheritedCtorInitExpr *E) {
14026 QualType
T = getDerived().TransformType(E->getType());
14030 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14031 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
14035 if (!getDerived().AlwaysRebuild() &&
14036 T == E->getType() &&
14037 Constructor == E->getConstructor()) {
14044 return getDerived().RebuildCXXInheritedCtorInitExpr(
14045 T, E->getLocation(), Constructor,
14046 E->constructsVBase(), E->inheritedFromVBase());
14053template<
typename Derived>
14055TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
14056 if (
auto *Dtor = E->getTemporary()->getDestructor())
14058 const_cast<CXXDestructorDecl *
>(Dtor));
14059 return getDerived().TransformExpr(E->getSubExpr());
14067template<
typename Derived>
14069TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *E) {
14070 return getDerived().TransformExpr(E->getSubExpr());
14073template<
typename Derived>
14075TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
14076 CXXTemporaryObjectExpr *E) {
14077 TypeSourceInfo *
T =
14078 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
14082 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
14083 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
14087 bool ArgumentChanged =
false;
14089 Args.reserve(E->getNumArgs());
14091 EnterExpressionEvaluationContext Context(
14093 E->isListInitialization());
14094 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14099 if (!getDerived().AlwaysRebuild() &&
14100 T == E->getTypeSourceInfo() &&
14101 Constructor == E->getConstructor() &&
14102 !ArgumentChanged) {
14110 SourceLocation LParenLoc =
T->getTypeLoc().getEndLoc();
14111 return getDerived().RebuildCXXTemporaryObjectExpr(
14112 T, LParenLoc, Args, E->getEndLoc(),
14113 LParenLoc.isInvalid());
14116template<
typename Derived>
14118TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
14121 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
14122 struct TransformedInitCapture {
14124 SourceLocation EllipsisLoc;
14129 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
14131 CEnd = E->capture_end();
14133 if (!E->isInitCapture(
C))
14136 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
14137 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
14139 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
14140 std::optional<unsigned> NumExpansions) {
14141 ExprResult NewExprInitResult = getDerived().TransformInitializer(
14144 if (NewExprInitResult.isInvalid()) {
14145 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
14148 Expr *NewExprInit = NewExprInitResult.get();
14150 QualType NewInitCaptureType =
14151 getSema().buildLambdaInitCaptureInitialization(
14152 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
14153 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
14154 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
14157 Result.Expansions.push_back(
14158 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
14162 if (OldVD->isParameterPack()) {
14163 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
14165 .castAs<PackExpansionTypeLoc>();
14171 bool Expand =
true;
14172 bool RetainExpansion =
false;
14173 std::optional<unsigned> OrigNumExpansions =
14174 ExpansionTL.getTypePtr()->getNumExpansions();
14175 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14176 if (getDerived().TryExpandParameterPacks(
14177 ExpansionTL.getEllipsisLoc(),
14178 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
14179 RetainExpansion, NumExpansions))
14182 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14183 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14184 SubstInitCapture(SourceLocation(), std::nullopt);
14187 if (!Expand || RetainExpansion) {
14188 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14189 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
14190 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
14193 SubstInitCapture(SourceLocation(), std::nullopt);
14197 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
14198 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
14209 DeclContext *DC = getSema().CurContext;
14227 while (DC->getDeclKind() == Decl::Kind::RequiresExprBody)
14228 DC = DC->getParent();
14229 if ((getSema().isUnevaluatedContext() ||
14230 getSema().isConstantEvaluatedContext()) &&
14231 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
14234 CXXRecordDecl *OldClass = E->getLambdaClass();
14235 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
14236 E->getIntroducerRange(),
nullptr, DependencyKind,
14237 E->getCaptureDefault());
14238 getDerived().transformedLocalDecl(OldClass, {
Class});
14240 CXXMethodDecl *NewCallOperator =
14241 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
14242 NewCallOperator->setLexicalDeclContext(getSema().CurContext);
14245 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
14246 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
14247 E->hasExplicitParameters(), E->isMutable());
14250 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
14257 CEnd = E->capture_end();
14261 if (
C->isImplicit())
14265 if (
C->capturesThis()) {
14271 Sema::CXXThisScopeRAII ThisScope(
14273 dyn_cast_if_present<CXXRecordDecl>(
14274 getSema().getFunctionLevelDeclContext()),
14276 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
14283 if (
C->capturesVLAType())
14287 if (E->isInitCapture(
C)) {
14288 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
14290 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
14293 for (InitCaptureInfoTy &Info : NewC.Expansions) {
14295 QualType InitQualType = Info.second;
14296 if (
Init.isInvalid() || InitQualType.isNull()) {
14300 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
14301 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
14302 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
14303 getSema().CurContext);
14308 NewVDs.push_back(NewVD);
14309 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
14315 getDerived().transformedLocalDecl(OldVD, NewVDs);
14319 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
14327 SourceLocation EllipsisLoc;
14328 if (
C->isPackExpansion()) {
14330 bool ShouldExpand =
false;
14331 bool RetainExpansion =
false;
14332 std::optional<unsigned> NumExpansions;
14333 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
14336 ShouldExpand, RetainExpansion,
14342 if (ShouldExpand) {
14346 auto *Pack = cast<VarDecl>(
C->getCapturedVar());
14347 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14348 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14349 VarDecl *CapturedVar
14350 = cast_or_null<VarDecl>(getDerived().TransformDecl(
C->getLocation(),
14352 if (!CapturedVar) {
14358 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
14366 EllipsisLoc =
C->getEllipsisLoc();
14370 auto *CapturedVar = cast_or_null<ValueDecl>(
14371 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
14372 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
14378 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
14381 getSema().finishLambdaExplicitCaptures(LSI);
14385 auto TPL = getDerived().TransformTemplateParameterList(
14386 E->getTemplateParameterList());
14387 LSI->GLTemplateParameterList = TPL;
14389 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
14396 TypeSourceInfo *NewCallOpTSI =
nullptr;
14398 auto OldCallOpTypeLoc =
14399 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
14401 auto TransformFunctionProtoTypeLoc =
14402 [
this](TypeLocBuilder &TLB, FunctionProtoTypeLoc FPTL) -> QualType {
14404 return this->TransformFunctionProtoType(
14405 TLB, FPTL,
nullptr, Qualifiers(),
14406 [&](FunctionProtoType::ExceptionSpecInfo &ESI,
bool &Changed) {
14407 return TransformExceptionSpec(FPTL.getBeginLoc(), ESI,
14408 ExceptionStorage, Changed);
14412 QualType NewCallOpType;
14413 TypeLocBuilder NewCallOpTLBuilder;
14415 if (
auto ATL = OldCallOpTypeLoc.getAs<AttributedTypeLoc>()) {
14416 NewCallOpType = this->TransformAttributedType(
14417 NewCallOpTLBuilder, ATL,
14418 [&](TypeLocBuilder &TLB, TypeLoc TL) -> QualType {
14419 return TransformFunctionProtoTypeLoc(
14420 TLB, TL.castAs<FunctionProtoTypeLoc>());
14423 auto FPTL = OldCallOpTypeLoc.castAs<FunctionProtoTypeLoc>();
14424 NewCallOpType = TransformFunctionProtoTypeLoc(NewCallOpTLBuilder, FPTL);
14427 if (NewCallOpType.isNull())
14430 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
14434 if (
auto ATL = NewCallOpTSI->getTypeLoc().getAs<AttributedTypeLoc>()) {
14435 Params = ATL.getModifiedLoc().castAs<FunctionProtoTypeLoc>().getParams();
14437 auto FPTL = NewCallOpTSI->getTypeLoc().castAs<FunctionProtoTypeLoc>();
14438 Params = FPTL.getParams();
14441 getSema().CompleteLambdaCallOperator(
14442 NewCallOperator, E->getCallOperator()->getLocation(),
14443 E->getCallOperator()->getInnerLocStart(),
14444 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
14445 E->getCallOperator()->getConstexprKind(),
14446 E->getCallOperator()->getStorageClass(), Params,
14447 E->hasExplicitResultType());
14449 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
14450 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
14454 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
14456 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
14457 if (getDerived().ReplacingOriginal()) {
14458 Numbering = OldClass->getLambdaNumbering();
14461 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
14466 getSema().PushExpressionEvaluationContext(
14467 E->getCallOperator()->isConsteval() ?
14471 Sema::CodeSynthesisContext
C;
14473 C.PointOfInstantiation = E->getBody()->getBeginLoc();
14474 getSema().pushCodeSynthesisContext(
C);
14478 Invalid ?
StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
14480 getSema().popCodeSynthesisContext();
14483 FuncScopeCleanup.disable();
14485 if (Body.isInvalid()) {
14486 SavedContext.pop();
14487 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
14495 auto LSICopy = *LSI;
14496 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
14498 SavedContext.pop();
14533 DependencyKind = getDerived().ComputeLambdaDependency(&LSICopy);
14534 Class->setLambdaDependencyKind(DependencyKind);
14537 Class->setTypeForDecl(
nullptr);
14538 getSema().Context.getTypeDeclType(
Class);
14540 return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getEndLoc(),
14544template<
typename Derived>
14547 return TransformStmt(S);
14550template<
typename Derived>
14559 if (!
C->isImplicit())
14563 if (
C->capturesThis()) {
14564 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
14571 if (
C->capturesVLAType())
14574 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
14578 VarDecl *CapturedVar = cast_or_null<VarDecl>(
14579 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
14584 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
14590template<
typename Derived>
14599 bool ArgumentChanged =
false;
14611 if (!getDerived().AlwaysRebuild() &&
14617 return getDerived().RebuildCXXUnresolvedConstructExpr(
14621template<
typename Derived>
14623TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
14624 CXXDependentScopeMemberExpr *E) {
14629 QualType ObjectType;
14630 if (!E->isImplicitAccess()) {
14631 OldBase = E->getBase();
14632 Base = getDerived().TransformExpr(OldBase);
14633 if (
Base.isInvalid())
14638 bool MayBePseudoDestructor =
false;
14640 E->getOperatorLoc(),
14641 E->isArrow()? tok::arrow : tok::period,
14643 MayBePseudoDestructor);
14644 if (
Base.isInvalid())
14647 ObjectType = ObjectTy.get();
14648 BaseType = ((Expr*)
Base.get())->getType();
14651 BaseType = getDerived().TransformType(E->getBaseType());
14652 ObjectType = BaseType->castAs<PointerType>()->getPointeeType();
14657 NamedDecl *FirstQualifierInScope
14658 = getDerived().TransformFirstQualifierInScope(
14659 E->getFirstQualifierFoundInScope(),
14660 E->getQualifierLoc().getBeginLoc());
14662 NestedNameSpecifierLoc QualifierLoc;
14663 if (E->getQualifier()) {
14665 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
14667 FirstQualifierInScope);
14672 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
14678 DeclarationNameInfo NameInfo
14679 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
14680 if (!NameInfo.getName())
14683 if (!E->hasExplicitTemplateArgs()) {
14686 if (!getDerived().AlwaysRebuild() &&
14687 Base.get() == OldBase &&
14688 BaseType == E->getBaseType() &&
14689 QualifierLoc == E->getQualifierLoc() &&
14690 NameInfo.getName() == E->getMember() &&
14691 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
14694 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
14697 E->getOperatorLoc(),
14700 FirstQualifierInScope,
14705 TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
14706 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14707 E->getNumTemplateArgs(),
14711 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
14714 E->getOperatorLoc(),
14717 FirstQualifierInScope,
14722template <
typename Derived>
14723ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
14724 UnresolvedMemberExpr *Old) {
14728 if (!Old->isImplicitAccess()) {
14729 Base = getDerived().TransformExpr(Old->getBase());
14730 if (
Base.isInvalid())
14733 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
14734 if (
Base.isInvalid())
14736 BaseType =
Base.get()->getType();
14738 BaseType = getDerived().TransformType(Old->getBaseType());
14741 NestedNameSpecifierLoc QualifierLoc;
14742 if (Old->getQualifierLoc()) {
14744 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
14749 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
14754 if (TransformOverloadExprDecls(Old,
false, R))
14758 if (Old->getNamingClass()) {
14759 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
14760 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
14764 R.setNamingClass(NamingClass);
14767 TemplateArgumentListInfo TransArgs;
14768 if (Old->hasExplicitTemplateArgs()) {
14769 TransArgs.setLAngleLoc(Old->getLAngleLoc());
14770 TransArgs.setRAngleLoc(Old->getRAngleLoc());
14771 if (getDerived().TransformTemplateArguments(
14772 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
14780 NamedDecl *FirstQualifierInScope =
nullptr;
14782 return getDerived().RebuildUnresolvedMemberExpr(
14783 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
14784 TemplateKWLoc, FirstQualifierInScope, R,
14785 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
14788template<
typename Derived>
14790TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) {
14793 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
14794 if (SubExpr.isInvalid())
14797 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
14800 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
14803template<
typename Derived>
14805TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *E) {
14806 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
14807 if (Pattern.isInvalid())
14810 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
14813 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
14814 E->getNumExpansions());
14817template<
typename Derived>
14819TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
14822 if (!E->isValueDependent())
14829 TemplateArgument ArgStorage;
14832 if (E->isPartiallySubstituted()) {
14833 PackArgs = E->getPartialArguments();
14834 }
else if (E->isValueDependent()) {
14836 bool ShouldExpand =
false;
14837 bool RetainExpansion =
false;
14838 std::optional<unsigned> NumExpansions;
14839 if (getDerived().TryExpandParameterPacks(E->getOperatorLoc(), E->getPackLoc(),
14841 ShouldExpand, RetainExpansion,
14847 if (ShouldExpand) {
14848 auto *Pack = E->getPack();
14849 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
14850 ArgStorage = getSema().Context.getPackExpansionType(
14852 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
14853 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
14855 auto *VD = cast<ValueDecl>(Pack);
14856 ExprResult DRE = getSema().BuildDeclRefExpr(
14857 VD, VD->getType().getNonLValueExprType(getSema().Context),
14860 if (DRE.isInvalid())
14862 ArgStorage =
new (getSema().Context)
14863 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
14864 E->getPackLoc(), std::nullopt);
14866 PackArgs = ArgStorage;
14871 if (!PackArgs.size()) {
14872 auto *Pack = cast_or_null<NamedDecl>(
14873 getDerived().TransformDecl(E->getPackLoc(), E->getPack()));
14876 return getDerived().RebuildSizeOfPackExpr(
14877 E->getOperatorLoc(), Pack, E->getPackLoc(), E->getRParenLoc(),
14878 std::nullopt, std::nullopt);
14882 std::optional<unsigned>
Result = 0;
14883 for (
const TemplateArgument &Arg : PackArgs) {
14884 if (!Arg.isPackExpansion()) {
14889 TemplateArgumentLoc ArgLoc;
14890 InventTemplateArgumentLoc(Arg, ArgLoc);
14893 SourceLocation Ellipsis;
14894 std::optional<unsigned> OrigNumExpansions;
14895 TemplateArgumentLoc Pattern =
14896 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
14897 OrigNumExpansions);
14900 TemplateArgumentLoc OutPattern;
14901 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14902 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
14907 std::optional<unsigned> NumExpansions =
14908 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
14909 if (!NumExpansions) {
14922 return getDerived().RebuildSizeOfPackExpr(
14923 E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(),
14926 TemplateArgumentListInfo TransformedPackArgs(E->getPackLoc(),
14929 TemporaryBase Rebase(*
this, E->getPackLoc(), getBaseEntity());
14930 typedef TemplateArgumentLocInventIterator<
14931 Derived,
const TemplateArgument*> PackLocIterator;
14932 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
14933 PackLocIterator(*
this, PackArgs.end()),
14934 TransformedPackArgs,
true))
14941 bool PartialSubstitution =
false;
14942 for (
auto &
Loc : TransformedPackArgs.arguments()) {
14943 Args.push_back(
Loc.getArgument());
14944 if (
Loc.getArgument().isPackExpansion())
14945 PartialSubstitution =
true;
14948 if (PartialSubstitution)
14949 return getDerived().RebuildSizeOfPackExpr(
14950 E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(),
14951 std::nullopt, Args);
14953 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
14954 E->getPackLoc(), E->getRParenLoc(),
14955 Args.size(), std::nullopt);
14958template <
typename Derived>
14960TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *E) {
14961 if (!E->isValueDependent())
14965 ExprResult IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
14966 if (IndexExpr.isInvalid())
14970 if (E->getExpressions().empty()) {
14971 Expr *Pattern = E->getPackIdExpression();
14973 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
14975 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
14979 bool ShouldExpand =
true;
14980 bool RetainExpansion =
false;
14981 std::optional<unsigned> OrigNumExpansions;
14982 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14983 if (getDerived().TryExpandParameterPacks(
14984 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
14985 ShouldExpand, RetainExpansion, NumExpansions))
14987 if (!ShouldExpand) {
14988 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14989 ExprResult Pack = getDerived().TransformExpr(Pattern);
14990 if (Pack.isInvalid())
14992 return getDerived().RebuildPackIndexingExpr(
14993 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
14996 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14997 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14998 ExprResult Out = getDerived().TransformExpr(Pattern);
14999 if (Out.isInvalid())
15001 if (Out.get()->containsUnexpandedParameterPack()) {
15002 Out = getDerived().RebuildPackExpansion(Out.get(), E->getEllipsisLoc(),
15003 OrigNumExpansions);
15004 if (Out.isInvalid())
15007 ExpandedExprs.push_back(Out.get());
15011 if (RetainExpansion) {
15012 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15014 ExprResult Out = getDerived().TransformExpr(Pattern);
15015 if (Out.isInvalid())
15018 Out = getDerived().RebuildPackExpansion(Out.get(), E->getEllipsisLoc(),
15019 OrigNumExpansions);
15020 if (Out.isInvalid())
15022 ExpandedExprs.push_back(Out.get());
15027 if (getDerived().TransformExprs(E->getExpressions().data(),
15028 E->getExpressions().size(),
false,
15033 return getDerived().RebuildPackIndexingExpr(
15034 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
15035 IndexExpr.get(), ExpandedExprs,
15036 ExpandedExprs.size() == 0);
15039template<
typename Derived>
15041TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
15042 SubstNonTypeTemplateParmPackExpr *E) {
15047template<
typename Derived>
15049TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
15050 SubstNonTypeTemplateParmExpr *E) {
15055template<
typename Derived>
15057TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) {
15062template<
typename Derived>
15064TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
15065 MaterializeTemporaryExpr *E) {
15066 return getDerived().TransformExpr(E->getSubExpr());
15069template<
typename Derived>
15071TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
15072 UnresolvedLookupExpr *
Callee =
nullptr;
15073 if (Expr *OldCallee = E->getCallee()) {
15074 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
15075 if (CalleeResult.isInvalid())
15077 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
15080 Expr *Pattern = E->getPattern();
15083 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
15084 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15088 bool Expand =
true;
15089 bool RetainExpansion =
false;
15090 std::optional<unsigned> OrigNumExpansions = E->getNumExpansions(),
15091 NumExpansions = OrigNumExpansions;
15092 if (getDerived().TryExpandParameterPacks(E->getEllipsisLoc(),
15093 Pattern->getSourceRange(),
15095 Expand, RetainExpansion,
15102 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15105 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
15106 if (LHS.isInvalid())
15110 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
15111 if (RHS.isInvalid())
15114 if (!getDerived().AlwaysRebuild() &&
15115 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
15118 return getDerived().RebuildCXXFoldExpr(
15119 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
15120 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
15126 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
15127 SemaRef.
Diag(E->getEllipsisLoc(),
15128 clang::diag::err_fold_expression_limit_exceeded)
15129 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
15130 << E->getSourceRange();
15131 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
15140 bool LeftFold = E->isLeftFold();
15144 if (!LeftFold && RetainExpansion) {
15145 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15147 ExprResult Out = getDerived().TransformExpr(Pattern);
15148 if (Out.isInvalid())
15151 Result = getDerived().RebuildCXXFoldExpr(
15152 Callee, E->getBeginLoc(), Out.get(), E->getOperator(),
15153 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
15158 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15159 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
15160 getSema(), LeftFold ? I : *NumExpansions - I - 1);
15161 ExprResult Out = getDerived().TransformExpr(Pattern);
15162 if (Out.isInvalid())
15165 if (Out.get()->containsUnexpandedParameterPack()) {
15167 Result = getDerived().RebuildCXXFoldExpr(
15168 Callee, E->getBeginLoc(), LeftFold ?
Result.get() : Out.get(),
15169 E->getOperator(), E->getEllipsisLoc(),
15170 LeftFold ? Out.get() :
Result.get(), E->getEndLoc(),
15171 OrigNumExpansions);
15172 }
else if (
Result.isUsable()) {
15174 Expr *LHS = LeftFold ?
Result.get() : Out.get();
15175 Expr *RHS = LeftFold ? Out.get() :
Result.get();
15177 UnresolvedSet<16> Functions;
15178 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
15179 Result = getDerived().RebuildCXXOperatorCallExpr(
15181 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
15182 Functions, LHS, RHS);
15184 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
15185 E->getOperator(), LHS, RHS);
15196 if (LeftFold && RetainExpansion) {
15197 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15199 ExprResult Out = getDerived().TransformExpr(Pattern);
15200 if (Out.isInvalid())
15203 Result = getDerived().RebuildCXXFoldExpr(
15204 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
15205 E->getEllipsisLoc(), Out.get(), E->getEndLoc(), OrigNumExpansions);
15213 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
15219template <
typename Derived>
15221TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *E) {
15224 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
15228 return getDerived().RebuildParenListExpr(E->getBeginLoc(), TransformedInits,
15232template<
typename Derived>
15234TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
15235 CXXStdInitializerListExpr *E) {
15236 return getDerived().TransformExpr(E->getSubExpr());
15239template<
typename Derived>
15241TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) {
15245template<
typename Derived>
15247TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
15251template<
typename Derived>
15253TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *E) {
15254 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15255 if (SubExpr.isInvalid())
15258 if (!getDerived().AlwaysRebuild() &&
15259 SubExpr.get() == E->getSubExpr())
15262 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
15265template<
typename Derived>
15267TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *E) {
15270 bool ArgChanged =
false;
15271 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
15272 false, Elements, &ArgChanged))
15275 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15278 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
15283template<
typename Derived>
15285TreeTransform<Derived>::TransformObjCDictionaryLiteral(
15286 ObjCDictionaryLiteral *E) {
15289 bool ArgChanged =
false;
15290 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
15291 ObjCDictionaryElement OrigElement = E->getKeyValueElement(I);
15293 if (OrigElement.isPackExpansion()) {
15296 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
15297 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
15298 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
15302 bool Expand =
true;
15303 bool RetainExpansion =
false;
15304 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
15305 std::optional<unsigned> NumExpansions = OrigNumExpansions;
15306 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
15307 OrigElement.Value->getEndLoc());
15308 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
15309 PatternRange, Unexpanded, Expand,
15310 RetainExpansion, NumExpansions))
15317 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15318 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15319 if (Key.isInvalid())
15322 if (Key.get() != OrigElement.Key)
15326 if (
Value.isInvalid())
15329 if (
Value.get() != OrigElement.Value)
15332 ObjCDictionaryElement Expansion = {
15333 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
15335 Elements.push_back(Expansion);
15345 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15346 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
15347 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15348 if (Key.isInvalid())
15352 if (
Value.isInvalid())
15355 ObjCDictionaryElement Element = {
15356 Key.get(),
Value.get(), SourceLocation(), NumExpansions
15362 if (Key.get()->containsUnexpandedParameterPack() ||
15363 Value.get()->containsUnexpandedParameterPack())
15364 Element.EllipsisLoc = OrigElement.EllipsisLoc;
15366 Elements.push_back(Element);
15376 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
15377 if (Key.isInvalid())
15380 if (Key.get() != OrigElement.Key)
15385 = getDerived().TransformExpr(OrigElement.Value);
15386 if (
Value.isInvalid())
15389 if (
Value.get() != OrigElement.Value)
15392 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
15394 Elements.push_back(Element);
15397 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15400 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
15404template<
typename Derived>
15406TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) {
15407 TypeSourceInfo *EncodedTypeInfo
15408 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
15409 if (!EncodedTypeInfo)
15412 if (!getDerived().AlwaysRebuild() &&
15413 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
15416 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
15418 E->getRParenLoc());
15421template<
typename Derived>
15423TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
15428 return getDerived().TransformExpr(E->getSubExpr());
15431template<
typename Derived>
15433TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
15434 TypeSourceInfo *TSInfo
15435 = getDerived().TransformType(E->getTypeInfoAsWritten());
15443 if (!getDerived().AlwaysRebuild() &&
15444 TSInfo == E->getTypeInfoAsWritten() &&
15445 Result.get() == E->getSubExpr())
15449 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
15453template <
typename Derived>
15454ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
15455 ObjCAvailabilityCheckExpr *E) {
15459template<
typename Derived>
15461TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
15463 bool ArgChanged =
false;
15465 Args.reserve(E->getNumArgs());
15466 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
15472 TypeSourceInfo *ReceiverTypeInfo
15473 = getDerived().TransformType(E->getClassReceiverTypeInfo());
15474 if (!ReceiverTypeInfo)
15478 if (!getDerived().AlwaysRebuild() &&
15479 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
15484 E->getSelectorLocs(SelLocs);
15485 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
15488 E->getMethodDecl(),
15495 if (!E->getMethodDecl())
15500 E->getSelectorLocs(SelLocs);
15501 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
15504 E->getReceiverType(),
15505 E->getMethodDecl(),
15513 "Only class and instance messages may be instantiated");
15515 = getDerived().TransformExpr(E->getInstanceReceiver());
15516 if (Receiver.isInvalid())
15520 if (!getDerived().AlwaysRebuild() &&
15521 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
15526 E->getSelectorLocs(SelLocs);
15527 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
15530 E->getMethodDecl(),
15536template<
typename Derived>
15538TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) {
15542template<
typename Derived>
15544TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) {
15548template<
typename Derived>
15550TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
15553 if (
Base.isInvalid())
15559 if (!getDerived().AlwaysRebuild() &&
15560 Base.get() == E->getBase())
15563 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
15565 E->isArrow(), E->isFreeIvar());
15568template<
typename Derived>
15570TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
15573 if (!E->isObjectReceiver())
15578 if (
Base.isInvalid())
15584 if (!getDerived().AlwaysRebuild() &&
15585 Base.get() == E->getBase())
15588 if (E->isExplicitProperty())
15589 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
15590 E->getExplicitProperty(),
15593 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
15595 E->getImplicitPropertyGetter(),
15596 E->getImplicitPropertySetter(),
15600template<
typename Derived>
15602TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
15605 if (
Base.isInvalid())
15609 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
15610 if (Key.isInvalid())
15614 if (!getDerived().AlwaysRebuild() &&
15615 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
15618 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
15619 Base.get(), Key.get(),
15620 E->getAtIndexMethodDecl(),
15621 E->setAtIndexMethodDecl());
15624template<
typename Derived>
15626TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) {
15629 if (
Base.isInvalid())
15633 if (!getDerived().AlwaysRebuild() &&
15634 Base.get() == E->getBase())
15637 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
15642template<
typename Derived>
15644TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) {
15645 bool ArgumentChanged =
false;
15647 SubExprs.reserve(E->getNumSubExprs());
15648 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
15649 SubExprs, &ArgumentChanged))
15652 if (!getDerived().AlwaysRebuild() &&
15656 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
15658 E->getRParenLoc());
15661template<
typename Derived>
15663TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *E) {
15664 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
15665 if (SrcExpr.isInvalid())
15668 TypeSourceInfo *
Type = getDerived().TransformType(E->getTypeSourceInfo());
15672 if (!getDerived().AlwaysRebuild() &&
15673 Type == E->getTypeSourceInfo() &&
15674 SrcExpr.get() == E->getSrcExpr())
15677 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
15678 SrcExpr.get(), Type,
15679 E->getRParenLoc());
15682template<
typename Derived>
15684TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
15685 BlockDecl *oldBlock = E->getBlockDecl();
15688 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
15691 blockScope->TheDecl->setBlockMissingReturnType(
15692 oldBlock->blockMissingReturnType());
15697 const FunctionProtoType *exprFunctionType = E->getFunctionType();
15700 Sema::ExtParameterInfoBuilder extParamInfos;
15701 if (getDerived().TransformFunctionTypeParams(
15702 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
15703 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
15705 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
15709 QualType exprResultType =
15710 getDerived().TransformType(exprFunctionType->getReturnType());
15712 auto epi = exprFunctionType->getExtProtoInfo();
15713 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
15716 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
15720 if (!params.empty())
15721 blockScope->TheDecl->setParams(params);
15723 if (!oldBlock->blockMissingReturnType()) {
15724 blockScope->HasImplicitReturnType =
false;
15725 blockScope->ReturnType = exprResultType;
15729 StmtResult body = getDerived().TransformStmt(E->getBody());
15730 if (body.isInvalid()) {
15731 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
15739 for (
const auto &I : oldBlock->captures()) {
15740 VarDecl *oldCapture = I.getVariable();
15743 if (oldCapture->isParameterPack())
15746 VarDecl *newCapture =
15747 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
15749 assert(blockScope->CaptureMap.count(newCapture));
15755 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
15756 "this pointer isn't captured in the old block");
15764template<
typename Derived>
15766TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *E) {
15767 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
15768 if (SrcExpr.isInvalid())
15771 QualType
Type = getDerived().TransformType(E->getType());
15773 return SemaRef.
BuildAsTypeExpr(SrcExpr.get(), Type, E->getBuiltinLoc(),
15774 E->getRParenLoc());
15777template<
typename Derived>
15779TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *E) {
15780 bool ArgumentChanged =
false;
15782 SubExprs.reserve(E->getNumSubExprs());
15783 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
15784 SubExprs, &ArgumentChanged))
15787 if (!getDerived().AlwaysRebuild() &&
15791 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
15792 E->getOp(), E->getRParenLoc());
15799template<
typename Derived>
15803 getDerived().getBaseEntity());
15806template<
typename Derived>
15810 getDerived().getBaseEntity());
15813template<
typename Derived>
15816 bool WrittenAsLValue,
15819 Sigil, getDerived().getBaseEntity());
15822template<
typename Derived>
15828 getDerived().getBaseEntity());
15831template<
typename Derived>
15839 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
15843template<
typename Derived>
15855 BaseType,
Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
15856 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
15861template<
typename Derived>
15868template <
typename Derived>
15871 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15872 if (SizeExpr || !Size)
15874 IndexTypeQuals, BracketsRange,
15875 getDerived().getBaseEntity());
15883 for (
const auto &
T : Types)
15895 IndexTypeQuals, BracketsRange,
15896 getDerived().getBaseEntity());
15899template <
typename Derived>
15902 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15903 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
15904 IndexTypeQuals, BracketsRange);
15907template <
typename Derived>
15911 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
15912 IndexTypeQuals, BracketsRange);
15915template <
typename Derived>
15918 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15919 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
15921 IndexTypeQuals, BracketsRange);
15924template <
typename Derived>
15927 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15928 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
15930 IndexTypeQuals, BracketsRange);
15933template <
typename Derived>
15940template <
typename Derived>
15942 unsigned NumElements,
15948template <
typename Derived>
15955template<
typename Derived>
15957 unsigned NumElements,
15960 NumElements,
true);
15967template<
typename Derived>
15975template <
typename Derived>
15977 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
15982template <
typename Derived>
15990template<
typename Derived>
15996 getDerived().getBaseLocation(),
15997 getDerived().getBaseEntity(),
16001template<
typename Derived>
16006template<
typename Derived>
16009 assert(D &&
"no decl found");
16013 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
16017 if (UPD->expansions().empty()) {
16018 getSema().Diag(
Loc, diag::err_using_pack_expansion_empty)
16019 << UPD->isCXXClassMember() << UPD;
16028 for (
auto *E : UPD->expansions()) {
16029 QualType ThisT = RebuildUnresolvedUsingType(
Loc, E);
16034 else if (
T.isNull())
16038 "mismatched resolved types in using pack expansion");
16040 return T.isNull() ? FallbackT :
T;
16041 }
else if (
auto *Using = dyn_cast<UsingDecl>(D)) {
16042 assert(Using->hasTypename() &&
16043 "UnresolvedUsingTypenameDecl transformed to non-typename using");
16046 assert(++Using->shadow_begin() == Using->shadow_end());
16055 assert(isa<UnresolvedUsingTypenameDecl>(D) &&
16056 "UnresolvedUsingTypenameDecl transformed to non-using decl");
16058 cast<UnresolvedUsingTypenameDecl>(D));
16062template <
typename Derived>
16068template<
typename Derived>
16074template <
typename Derived>
16079template <
typename Derived>
16085 FullySubstituted, Expansions);
16088template<
typename Derived>
16095template<
typename Derived>
16103template<
typename Derived>
16109template<
typename Derived>
16117template <
typename Derived>
16128template <
typename Derived>
16134template<
typename Derived>
16143template<
typename Derived>
16151 bool AllowInjectedClassName) {
16155 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
16158 AllowInjectedClassName);
16159 return Template.
get();
16162template<
typename Derived>
16169 bool AllowInjectedClassName) {
16172 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
16173 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
16175 getSema().ActOnTemplateName(
16177 false, Template, AllowInjectedClassName);
16178 return Template.
get();
16181template <
typename Derived>
16186 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
16207 if (Op == OO_Subscript) {
16208 if (!
First->getType()->isOverloadableType() &&
16210 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
16212 }
else if (Op == OO_Arrow) {
16215 if (
First->getType()->isDependentType())
16219 }
else if (Second ==
nullptr || isPostIncDec) {
16220 if (!
First->getType()->isOverloadableType() ||
16221 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
16228 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
16232 !
First->getType()->isOverloadableType() &&
16247 if (!Second || isPostIncDec) {
16257 First, Second, RequiresADL);
16264template<
typename Derived>
16279 ->template getAs<RecordType>())){
16282 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
16283 CCLoc, TildeLoc, Destroyed);
16295 if (!ScopeType->getType()->getAs<
TagType>()) {
16296 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
16297 diag::err_expected_class_or_namespace)
16298 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
16306 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
16307 OperatorLoc, isArrow,
16315template<
typename Derived>
16323 for (
unsigned I = 0; I < NumParams; ++I) {
16324 if (I != ContextParamPos) {
16330 Params.push_back(std::make_pair(StringRef(), QualType()));
16333 getSema().ActOnCapturedRegionStart(
Loc,
nullptr,
16334 S->getCapturedRegionKind(), Params);
16337 Sema::CompoundScopeRAII CompoundScope(getSema());
16338 Body = getDerived().TransformStmt(S->getCapturedStmt());
16341 if (Body.isInvalid()) {
16342 getSema().ActOnCapturedRegionError();
16346 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 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.
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 getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
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.
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
SourceRange getAngleBrackets() const LLVM_READONLY
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
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...
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
bool isListInitialization() const
Determine whether this expression models list-initialization.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
unsigned getNumArgs() const
Retrieve the number of arguments.
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.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
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...
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.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
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.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
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
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 isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
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 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...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
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.
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
OpenMPDirectiveKind getDirectiveKind() const
const Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
SourceLocation getBeginLoc() const
Returns starting location of directive kind.
const Stmt * getRawStmt() const
ArrayRef< OMPClause * > clauses() const
OpenMPDirectiveKind getMappedDirective() const
SourceLocation getEndLoc() const
Returns ending location of 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)
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 OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static 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 parethesized 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 that was expressed as a qualified name.
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 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.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind PrevMappedDirective=llvm::omp::OMPD_unknown)
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
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 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)
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()
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.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
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".
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
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 checkPseudoObjectRValue(Expr *E)
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)
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...
QualType BuildCountAttributedArrayType(QualType WrappedTy, Expr *CountExpr)
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.
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
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),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
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.
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
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.