13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
42#include "llvm/ADT/ArrayRef.h"
43#include "llvm/Support/ErrorHandling.h"
47using namespace llvm::omp;
103template<
typename Derived>
108 class ForgetPartiallySubstitutedPackRAII {
113 ForgetPartiallySubstitutedPackRAII(Derived &
Self) :
Self(
Self) {
114 Old =
Self.ForgetPartiallySubstitutedPack();
117 ~ForgetPartiallySubstitutedPackRAII() {
118 Self.RememberPartiallySubstitutedPack(Old);
135 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
139 return static_cast<const Derived&
>(*this);
204 OldLocation =
Self.getDerived().getBaseLocation();
205 OldEntity =
Self.getDerived().getBaseEntity();
208 Self.getDerived().setBase(Location, Entity);
212 Self.getDerived().setBase(OldLocation, OldEntity);
285 bool &ShouldExpand,
bool &RetainExpansion,
286 std::optional<unsigned> &NumExpansions) {
287 ShouldExpand =
false;
402 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
403#include "clang/Basic/AttrList.inc"
413 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
414 const X##Attr *A) { \
415 return getDerived().Transform##X##Attr(A); \
417#include "clang/Basic/AttrList.inc"
463 bool *ArgChanged =
nullptr);
472 llvm::DenseMap<Decl *, Decl *>::iterator Known
475 return Known->second;
503 assert(New.size() == 1 &&
504 "must override transformedLocalDecl if performing pack expansion");
542 NamedDecl *FirstQualifierInScope =
nullptr);
587 NamedDecl *FirstQualifierInScope =
nullptr,
588 bool AllowInjectedClassName =
false);
600 bool Uneval =
false);
623 bool Uneval =
false) {
642 template<
typename InputIterator>
646 bool Uneval =
false);
658#define ABSTRACT_TYPELOC(CLASS, PARENT)
659#define TYPELOC(CLASS, PARENT) \
660 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
661#include "clang/AST/TypeLocNodes.def"
665 bool SuppressObjCLifetime);
669 bool SuppressObjCLifetime);
671 template<
typename Fn>
678 template <
typename Fn>
680 Fn TransformModifiedType);
728 return getDerived().TransformFunctionTypeParams(
729 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
747 KWLoc, Params,
nullptr,
748 nullptr, PTypes, &TransParams, PInfos))
761 std::optional<unsigned> NumExpansions,
762 bool ExpectParameterPack);
783 bool IsAddressOfOperand,
794#define STMT(Node, Parent) \
795 LLVM_ATTRIBUTE_NOINLINE \
796 StmtResult Transform##Node(Node *S);
797#define VALUESTMT(Node, Parent) \
798 LLVM_ATTRIBUTE_NOINLINE \
799 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
800#define EXPR(Node, Parent) \
801 LLVM_ATTRIBUTE_NOINLINE \
802 ExprResult Transform##Node(Node *E);
803#define ABSTRACT_STMT(Stmt)
804#include "clang/AST/StmtNodes.inc"
806#define GEN_CLANG_CLAUSE_CLASS
807#define CLAUSE_CLASS(Enum, Str, Class) \
808 LLVM_ATTRIBUTE_NOINLINE \
809 OMPClause *Transform##Class(Class *S);
810#include "llvm/Frontend/OpenMP/OMP.inc"
887 const llvm::APInt *Size,
Expr *SizeExpr,
888 unsigned IndexTypeQuals,
SourceRange BracketsRange);
897 const llvm::APInt &Size,
Expr *SizeExpr,
898 unsigned IndexTypeQuals,
908 unsigned IndexTypeQuals,
918 unsigned IndexTypeQuals,
929 unsigned IndexTypeQuals,
967 unsigned NumColumns);
1054 bool FullySubstituted,
1068 TypeConstraintConcept,
1069 TypeConstraintArgs);
1077 Template, Deduced,
false);
1123 bool AllowInjectedClassName) {
1127 SS.
Adopt(QualifierLoc);
1129 SS, TemplateKWLoc, *Name, NameLoc,
QualType(),
nullptr,
1130 AllowInjectedClassName);
1144 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1161 bool DeducedTSTContext) {
1163 SS.
Adopt(QualifierLoc);
1176 *
Id, IdLoc, DeducedTSTContext);
1194 switch (
Result.getResultKind()) {
1205 llvm_unreachable(
"Tag lookup cannot find non-tags");
1217 switch (
Result.getResultKind()) {
1223 SemaRef.
Diag(IdLoc, diag::err_tag_reference_non_tag)
1224 << SomeDecl << NTK << llvm::to_underlying(Kind);
1230 << llvm::to_underlying(Kind) <<
Id << DC
1239 SemaRef.
Diag(KeywordLoc, diag::err_use_with_wrong_tag) <<
Id;
1257 std::optional<unsigned> NumExpansions) {
1302 bool AllowInjectedClassName);
1315 bool AllowInjectedClassName);
1325 Decl *AssociatedDecl,
unsigned Index,
1328 ArgPack, AssociatedDecl, Index, Final);
1406 Then, ElseLoc, Else);
1460 Inc, RParenLoc, Body);
1505 bool IsVolatile,
unsigned NumOutputs,
1512 NumInputs, Names, Constraints, Exprs,
1513 AsmString, Clobbers, NumLabels, RParenLoc);
1522 StringRef AsmString,
1523 unsigned NumOutputs,
unsigned NumInputs,
1529 NumOutputs, NumInputs,
1530 Constraints, Clobbers, Exprs, EndLoc);
1559 CoawaitLoc, Operand, OpCoawaitLookup);
1563 Suspend.
get(),
true);
1665 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc,
1666 PrevMappedDirective);
1680 LParenLoc, NameModifierLoc, ColonLoc,
1778 StartLoc, LParenLoc, EndLoc);
1791 StartLoc, LParenLoc, EndLoc);
1804 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1854 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1881 VarList, Modifier, StartLoc, LParenLoc, ModifierLoc, ColonLoc, EndLoc,
1882 ReductionIdScopeSpec, ReductionId, UnresolvedReductions);
1896 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1897 ReductionId, UnresolvedReductions);
1912 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1913 ReductionId, UnresolvedReductions);
1926 Modifier, ModifierLoc, ColonLoc,
1927 StepModifierLoc, EndLoc);
1940 LParenLoc, ColonLoc, EndLoc);
2000 StartLoc, LParenLoc, EndLoc);
2013 LParenLoc, ModifierLoc, EndLoc);
2028 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2029 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2030 ColonLoc, VarList, Locs,
2031 false, UnresolvedMappers);
2044 LParenLoc, ColonLoc, EndLoc);
2091 LParenLoc, ModifierLoc, EndLoc);
2104 LParenLoc, ModifierLoc, EndLoc);
2137 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2152 MapperIdScopeSpec, MapperId, ColonLoc,
2153 VarList, Locs, UnresolvedMappers);
2168 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2169 ColonLoc, VarList, Locs, UnresolvedMappers);
2220 MLoc, KindLoc, EndLoc);
2280 EndLoc, Modifier, Locators);
2292 ModifierKwLoc, KindKwLoc, EndLoc);
2305 LParenLoc, VarLoc, EndLoc);
2465 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2524 StartLoc, IdLoc,
Id);
2561 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2562 if (RangeStmt->isSingleDecl()) {
2563 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2564 if (RangeVar->isInvalidDecl())
2567 Expr *RangeExpr = RangeVar->getInit();
2574 diag::err_objc_for_range_init_stmt)
2575 <<
Init->getSourceRange();
2578 RangeExpr, RParenLoc);
2585 ForLoc, CoawaitLoc,
Init, ColonLoc, Range,
Begin, End, Cond, Inc,
2599 QualifierLoc, NameInfo, Nested);
2660 SS.
Adopt(QualifierLoc);
2772 ColonLocFirst, ColonLocSecond,
2773 Length, Stride, RBracketLoc);
2806 Expr *ExecConfig =
nullptr) {
2808 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2815 nullptr, Callee, LParenLoc, Args, RParenLoc);
2833 if (!
Member->getDeclName()) {
2837 assert(
Member->getType()->isRecordType() &&
2838 "unnamed member not of record type?");
2850 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(
Member),
2855 SS.
Adopt(QualifierLoc);
2869 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2870 isa<FieldDecl, IndirectFieldDecl, MSPropertyDecl>(
Member)) {
2871 if (
auto *ThisClass = cast<CXXThisExpr>(
Base)
2874 ->getAsCXXRecordDecl()) {
2875 auto *
Class = cast<CXXRecordDecl>(
Member->getDeclContext());
2878 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2886 FirstQualifierInScope,
2887 R, ExplicitTemplateArgs,
3065 Expr *ControllingExpr,
3070 ControllingExpr, Types, Exprs);
3085 ControllingType, Types, Exprs);
3118 case Stmt::CXXStaticCastExprClass:
3119 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3120 RAngleLoc, LParenLoc,
3121 SubExpr, RParenLoc);
3123 case Stmt::CXXDynamicCastExprClass:
3124 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3125 RAngleLoc, LParenLoc,
3126 SubExpr, RParenLoc);
3128 case Stmt::CXXReinterpretCastExprClass:
3129 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3130 RAngleLoc, LParenLoc,
3134 case Stmt::CXXConstCastExprClass:
3135 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3136 RAngleLoc, LParenLoc,
3137 SubExpr, RParenLoc);
3139 case Stmt::CXXAddrspaceCastExprClass:
3140 return getDerived().RebuildCXXAddrspaceCastExpr(
3141 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3144 llvm_unreachable(
"Invalid C++ named cast");
3222 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3234 bool ListInitialization) {
3238 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3240 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3241 RParenLoc, ListInitialization);
3244 ListInitialization);
3317 bool IsThrownVariableInScope) {
3327 Expr *RewrittenExpr) {
3329 RewrittenExpr,
getSema().CurContext);
3364 std::optional<Expr *> ArraySize,
3383 bool IsGlobalDelete,
3434 bool IsAddressOfOperand,
3437 SS.
Adopt(QualifierLoc);
3439 if (TemplateArgs || TemplateKWLoc.
isValid())
3444 SS, NameInfo, IsAddressOfOperand,
nullptr, RecoveryTSI);
3466 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3467 bool ListInitialization,
bool StdInitListInitialization,
3473 if (Constructor->isInheritingConstructor())
3474 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3477 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3484 HadMultipleCandidates,
3486 StdInitListInitialization,
3487 RequiresZeroInit, ConstructKind,
3495 bool ConstructsVBase,
3496 bool InheritedFromVBase) {
3498 Loc, T, Constructor, ConstructsVBase, InheritedFromVBase);
3509 bool ListInitialization) {
3511 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3522 bool ListInitialization) {
3524 RParenLoc, ListInitialization);
3541 SS.
Adopt(QualifierLoc);
3544 OperatorLoc, IsArrow,
3546 FirstQualifierInScope,
3548 TemplateArgs,
nullptr);
3564 SS.
Adopt(QualifierLoc);
3567 OperatorLoc, IsArrow,
3569 FirstQualifierInScope,
3570 R, TemplateArgs,
nullptr);
3585 std::optional<unsigned> Length,
3588 RParenLoc, Length, PartialArgs);
3593 Expr *PackIdExpression,
Expr *IndexExpr,
3595 bool EmptyPack =
false) {
3597 IndexExpr, RSquareLoc, ExpandedExprs,
3627 NamedConcept, TALI);
3645 LocalParameters, RParenLoc, Requirements,
3699 Expr **Elements,
unsigned NumElements) {
3709 getterMethod, setterMethod);
3742 Sel, Method, LBracLoc, SelectorLocs,
3757 Sel, Method, LBracLoc, SelectorLocs,
3773 Sel, Method, LBracLoc, SelectorLocs,
3778 Sel, Method, LBracLoc, SelectorLocs,
3790 bool IsArrow,
bool IsFreeIvar) {
3799 if (IsFreeIvar &&
Result.isUsable())
3800 cast<ObjCIvarRefExpr>(
Result.get())->setIsFreeIvar(IsFreeIvar);
3836 PropertyLoc,
Base));
3868 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3877 CK_BuiltinFnToFnPtr).
get();
3894 BuiltinLoc, RParenLoc);
3904 std::optional<unsigned> NumExpansions) {
3909 EllipsisLoc, NumExpansions);
3931 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
3952 std::optional<unsigned> NumExpansions) {
3965 std::optional<unsigned> NumExpansions) {
3967 EllipsisLoc, RHS, RParenLoc,
4006 if (
getSema().ActOnStartOpenACCStmtDirective(K, BeginLoc))
4032 bool DeducibleTSTContext);
4035template <
typename Derived>
4040 switch (S->getStmtClass()) {
4045#define STMT(Node, Parent) \
4046 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4047#define VALUESTMT(Node, Parent) \
4048 case Stmt::Node##Class: \
4049 return getDerived().Transform##Node(cast<Node>(S), SDK);
4050#define ABSTRACT_STMT(Node)
4051#define EXPR(Node, Parent)
4052#include "clang/AST/StmtNodes.inc"
4055#define STMT(Node, Parent)
4056#define ABSTRACT_STMT(Stmt)
4057#define EXPR(Node, Parent) case Stmt::Node##Class:
4058#include "clang/AST/StmtNodes.inc"
4060 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
4062 if (SDK == SDK_StmtExprResult)
4063 E = getSema().ActOnStmtExprResult(E);
4064 return getSema().ActOnExprStmt(E, SDK == SDK_Discarded);
4071template<
typename Derived>
4076 switch (S->getClauseKind()) {
4079#define GEN_CLANG_CLAUSE_CLASS
4080#define CLAUSE_CLASS(Enum, Str, Class) \
4082 return getDerived().Transform##Class(cast<Class>(S));
4083#include "llvm/Frontend/OpenMP/OMP.inc"
4090template<
typename Derived>
4097#define STMT(Node, Parent) case Stmt::Node##Class: break;
4098#define ABSTRACT_STMT(Stmt)
4099#define EXPR(Node, Parent) \
4100 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4101#include "clang/AST/StmtNodes.inc"
4107template<
typename Derived>
4115 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4116 Init = FE->getSubExpr();
4118 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4124 Init = MTE->getSubExpr();
4127 Init = Binder->getSubExpr();
4130 Init = ICE->getSubExprAsWritten();
4133 dyn_cast<CXXStdInitializerListExpr>(
Init))
4134 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4141 return getDerived().TransformExpr(
Init);
4146 return getDerived().RebuildParenListExpr(
Parens.getBegin(), std::nullopt,
4151 if (isa<ImplicitValueInitExpr>(
Init))
4152 return getDerived().RebuildParenListExpr(
SourceLocation(), std::nullopt,
4157 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
4158 return getDerived().TransformExpr(
Init);
4163 return TransformInitializer(Construct->
getArg(0), NotCopyInit);
4170 getSema().keepInLifetimeExtendingContext();
4171 getSema().keepInLifetimeExtendingContext();
4173 bool ArgChanged =
false;
4175 true, NewArgs, &ArgChanged))
4180 return getDerived().RebuildInitList(Construct->
getBeginLoc(), NewArgs,
4185 if (
Parens.isInvalid()) {
4188 assert(NewArgs.empty() &&
4189 "no parens or braces but have direct init with arguments?");
4192 return getDerived().RebuildParenListExpr(
Parens.getBegin(), NewArgs,
4196template<
typename Derived>
4202 for (
unsigned I = 0; I != NumInputs; ++I) {
4204 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
4212 Expr *Pattern = Expansion->getPattern();
4215 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4216 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4221 bool RetainExpansion =
false;
4222 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4223 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4224 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4227 Expand, RetainExpansion,
4236 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
4240 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.
get(),
4241 Expansion->getEllipsisLoc(),
4243 if (Out.isInvalid())
4248 Outputs.push_back(Out.get());
4254 if (ArgChanged) *ArgChanged =
true;
4258 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4260 ExprResult Out = getDerived().TransformExpr(Pattern);
4261 if (Out.isInvalid())
4264 if (Out.get()->containsUnexpandedParameterPack()) {
4265 Out = getDerived().RebuildPackExpansion(
4266 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4267 if (Out.isInvalid())
4271 Outputs.push_back(Out.get());
4276 if (RetainExpansion) {
4277 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4279 ExprResult Out = getDerived().TransformExpr(Pattern);
4280 if (Out.isInvalid())
4283 Out = getDerived().RebuildPackExpansion(
4284 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4285 if (Out.isInvalid())
4288 Outputs.push_back(Out.get());
4295 IsCall ? getDerived().TransformInitializer(Inputs[I],
false)
4296 : getDerived().TransformExpr(Inputs[I]);
4300 if (
Result.get() != Inputs[I] && ArgChanged)
4303 Outputs.push_back(
Result.get());
4309template <
typename Derived>
4313 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4314 getDerived().TransformDefinition(Var->
getLocation(), Var));
4319 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4328 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4335template <
typename Derived>
4343 Qualifier = Qualifier.getPrefix())
4359 SS, FirstQualifierInScope,
false))
4366 cast_or_null<NamespaceDecl>(getDerived().TransformDecl(
4374 cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl(
4389 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
4398 FirstQualifierInScope, SS);
4408 diag::warn_cxx98_compat_enum_nested_name_spec);
4411 SS.
Adopt(ETL.getQualifierLoc());
4412 TL = ETL.getNamedTypeLoc();
4431 FirstQualifierInScope =
nullptr;
4437 !getDerived().AlwaysRebuild())
4450template<
typename Derived>
4458 switch (Name.getNameKind()) {
4469 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
4470 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4471 getDerived().TransformDecl(NameInfo.
getLoc(), OldTemplate));
4487 NewTInfo = getDerived().TransformType(OldTInfo);
4495 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
4511 llvm_unreachable(
"Unknown name kind.");
4514template<
typename Derived>
4521 bool AllowInjectedClassName) {
4523 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4524 assert(Template &&
"qualified template name must refer to a template");
4527 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4532 if (!getDerived().AlwaysRebuild() &&
4534 TransTemplate == Template)
4537 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4545 FirstQualifierInScope =
nullptr;
4548 if (!getDerived().AlwaysRebuild() &&
4556 if (DTN->isIdentifier()) {
4557 return getDerived().RebuildTemplateName(SS,
4559 *DTN->getIdentifier(),
4562 FirstQualifierInScope,
4563 AllowInjectedClassName);
4566 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
4567 DTN->getOperator(), NameLoc,
4568 ObjectType, AllowInjectedClassName);
4571 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
4573 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
4578 if (!getDerived().AlwaysRebuild() &&
4579 TransTemplate == Template)
4586 = Name.getAsSubstTemplateTemplateParmPack()) {
4587 return getDerived().RebuildTemplateName(
4588 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4589 SubstPack->getIndex(), SubstPack->getFinal());
4593 llvm_unreachable(
"overloaded function decl survived to here");
4596template<
typename Derived>
4600 Output = getSema().getTrivialTemplateArgumentLoc(
4601 Arg,
QualType(), getDerived().getBaseLocation());
4604template <
typename Derived>
4612 llvm_unreachable(
"Unexpected TemplateArgument");
4622 QualType NewT = getDerived().TransformType(T);
4629 ValueDecl *NewD = D ? cast_or_null<ValueDecl>(getDerived().TransformDecl(
4630 getDerived().getBaseLocation(), D))
4635 if (NewT == T && D == NewD)
4652 llvm_unreachable(
"unexpected template argument kind");
4662 DI = getDerived().TransformType(DI);
4673 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4679 SS.
Adopt(QualifierLoc);
4680 TemplateName Template = getDerived().TransformTemplateName(
4691 llvm_unreachable(
"Caller should expand pack expansions");
4706 ExprResult E = getDerived().TransformExpr(InputExpr);
4721template<
typename Derived,
typename InputIterator>
4729 typedef typename std::iterator_traits<InputIterator>::difference_type
4769 return X.Iter == Y.Iter;
4774 return X.Iter != Y.Iter;
4778template<
typename Derived>
4779template<
typename InputIterator>
4790 if (getSema().CodeSynthesisContexts.back().Kind ==
4792 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
4804 if (TransformTemplateArguments(PackLocIterator(*
this,
4805 In.getArgument().pack_begin()),
4806 PackLocIterator(*
this,
4807 In.getArgument().pack_end()),
4814 if (In.getArgument().isPackExpansion()) {
4818 std::optional<unsigned> OrigNumExpansions;
4820 = getSema().getTemplateArgumentPackExpansionPattern(
4821 In, Ellipsis, OrigNumExpansions);
4824 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4825 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4830 bool RetainExpansion =
false;
4831 std::optional<unsigned> NumExpansions = OrigNumExpansions;
4832 if (getDerived().TryExpandParameterPacks(Ellipsis,
4846 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
4849 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
4851 if (Out.getArgument().isNull())
4860 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4863 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4866 if (Out.getArgument().containsUnexpandedParameterPack()) {
4867 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4869 if (Out.getArgument().isNull())
4878 if (RetainExpansion) {
4879 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4881 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4884 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4886 if (Out.getArgument().isNull())
4896 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
4910template<
typename Derived>
4912 if (getDerived().AlreadyTransformed(T))
4917 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(T,
4918 getDerived().getBaseLocation());
4928template<
typename Derived>
4932 getDerived().getBaseEntity());
4933 if (getDerived().AlreadyTransformed(DI->
getType()))
4948template<
typename Derived>
4952#define ABSTRACT_TYPELOC(CLASS, PARENT)
4953#define TYPELOC(CLASS, PARENT) \
4954 case TypeLoc::CLASS: \
4955 return getDerived().Transform##CLASS##Type(TLB, \
4956 T.castAs<CLASS##TypeLoc>());
4957#include "clang/AST/TypeLocNodes.def"
4960 llvm_unreachable(
"unhandled type loc!");
4963template<
typename Derived>
4965 if (!isa<DependentNameType>(T))
4966 return TransformType(T);
4968 if (getDerived().AlreadyTransformed(T))
4970 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(T,
4971 getDerived().getBaseLocation());
4972 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
4976template<
typename Derived>
4979 if (!isa<DependentNameType>(DI->
getType()))
4980 return TransformType(DI);
4984 getDerived().getBaseEntity());
4985 if (getDerived().AlreadyTransformed(DI->
getType()))
5005 Result = getDerived().RebuildQualifiedType(
Result, QTL);
5014template<
typename Derived>
5020 auto SuppressObjCLifetime =
5023 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5024 SuppressObjCLifetime);
5025 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5026 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5027 TLB, STTP, SuppressObjCLifetime);
5029 Result = getDerived().TransformType(TLB, UnqualTL);
5048template <
typename Derived>
5058 SemaRef.
Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5094 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->
isDeduced()) {
5110 SemaRef.
Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5119template<
typename Derived>
5125 if (getDerived().AlreadyTransformed(TL.
getType()))
5129 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
5135template<
typename Derived>
5137TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
5138 QualType ObjectType,
5139 NamedDecl *UnqualLookup,
5141 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5144 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5148template <
typename Derived>
5149TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
5150 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
5153 assert(!getDerived().AlreadyTransformed(T));
5158 if (isa<TemplateSpecializationType>(T)) {
5159 TemplateSpecializationTypeLoc SpecTL =
5160 TL.castAs<TemplateSpecializationTypeLoc>();
5162 TemplateName Template = getDerived().TransformTemplateName(
5163 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5164 ObjectType, UnqualLookup,
true);
5165 if (Template.isNull())
5168 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
5170 }
else if (isa<DependentTemplateSpecializationType>(T)) {
5171 DependentTemplateSpecializationTypeLoc SpecTL =
5172 TL.castAs<DependentTemplateSpecializationTypeLoc>();
5174 TemplateName Template
5175 = getDerived().RebuildTemplateName(SS,
5176 SpecTL.getTemplateKeywordLoc(),
5177 *SpecTL.getTypePtr()->getIdentifier(),
5178 SpecTL.getTemplateNameLoc(),
5179 ObjectType, UnqualLookup,
5181 if (Template.isNull())
5184 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
5190 Result = getDerived().TransformType(TLB, TL);
5199template <
class TyLoc>
static inline
5201 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5202 NewT.setNameLoc(T.getNameLoc());
5206template<
typename Derived>
5207QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5209 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5210 NewT.setBuiltinLoc(T.getBuiltinLoc());
5211 if (T.needsExtraLocalData())
5212 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5216template<
typename Derived>
5217QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
5223template <
typename Derived>
5224QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
5225 AdjustedTypeLoc TL) {
5227 return getDerived().TransformType(TLB, TL.getOriginalLoc());
5230template<
typename Derived>
5231QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
5232 DecayedTypeLoc TL) {
5233 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5234 if (OriginalType.isNull())
5237 QualType
Result = TL.getType();
5238 if (getDerived().AlwaysRebuild() ||
5239 OriginalType != TL.getOriginalLoc().getType())
5241 TLB.push<DecayedTypeLoc>(
Result);
5246template<
typename Derived>
5247QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
5248 PointerTypeLoc TL) {
5249 QualType PointeeType
5250 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5251 if (PointeeType.isNull())
5254 QualType
Result = TL.getType();
5255 if (PointeeType->getAs<ObjCObjectType>()) {
5262 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
5263 NewT.setStarLoc(TL.getStarLoc());
5267 if (getDerived().AlwaysRebuild() ||
5268 PointeeType != TL.getPointeeLoc().getType()) {
5269 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5276 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5278 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(
Result);
5279 NewT.setSigilLoc(TL.getSigilLoc());
5283template<
typename Derived>
5285TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
5286 BlockPointerTypeLoc TL) {
5287 QualType PointeeType
5288 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5289 if (PointeeType.isNull())
5292 QualType
Result = TL.getType();
5293 if (getDerived().AlwaysRebuild() ||
5294 PointeeType != TL.getPointeeLoc().getType()) {
5295 Result = getDerived().RebuildBlockPointerType(PointeeType,
5301 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(
Result);
5302 NewT.setSigilLoc(TL.getSigilLoc());
5310template<
typename Derived>
5318 if (PointeeType.
isNull())
5322 if (getDerived().AlwaysRebuild() ||
5324 Result = getDerived().RebuildReferenceType(PointeeType,
5338 if (isa<LValueReferenceType>(
Result))
5347template<
typename Derived>
5351 return TransformReferenceType(TLB, TL);
5354template<
typename Derived>
5356TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5357 RValueReferenceTypeLoc TL) {
5358 return TransformReferenceType(TLB, TL);
5361template<
typename Derived>
5363TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
5364 MemberPointerTypeLoc TL) {
5365 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5366 if (PointeeType.isNull())
5369 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
5370 TypeSourceInfo *NewClsTInfo =
nullptr;
5372 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
5377 const MemberPointerType *T = TL.getTypePtr();
5378 QualType OldClsType = QualType(T->getClass(), 0);
5379 QualType NewClsType;
5381 NewClsType = NewClsTInfo->getType();
5383 NewClsType = getDerived().TransformType(OldClsType);
5384 if (NewClsType.isNull())
5388 QualType
Result = TL.getType();
5389 if (getDerived().AlwaysRebuild() ||
5390 PointeeType != T->getPointeeType() ||
5391 NewClsType != OldClsType) {
5392 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
5400 const MemberPointerType *MPT =
Result->getAs<MemberPointerType>();
5401 if (MPT && PointeeType != MPT->getPointeeType()) {
5402 assert(isa<AdjustedType>(MPT->getPointeeType()));
5403 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5406 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(
Result);
5407 NewTL.setSigilLoc(TL.getSigilLoc());
5408 NewTL.setClassTInfo(NewClsTInfo);
5413template<
typename Derived>
5415TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
5416 ConstantArrayTypeLoc TL) {
5417 const ConstantArrayType *T = TL.getTypePtr();
5418 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5419 if (ElementType.isNull())
5423 Expr *OldSize = TL.getSizeExpr();
5425 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5426 Expr *NewSize =
nullptr;
5430 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5434 QualType
Result = TL.getType();
5435 if (getDerived().AlwaysRebuild() ||
5436 ElementType != T->getElementType() ||
5437 (T->getSizeExpr() && NewSize != OldSize)) {
5438 Result = getDerived().RebuildConstantArrayType(ElementType,
5439 T->getSizeModifier(),
5440 T->getSize(), NewSize,
5441 T->getIndexTypeCVRQualifiers(),
5442 TL.getBracketsRange());
5451 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5452 NewTL.setLBracketLoc(TL.getLBracketLoc());
5453 NewTL.setRBracketLoc(TL.getRBracketLoc());
5454 NewTL.setSizeExpr(NewSize);
5459template<
typename Derived>
5460QualType TreeTransform<Derived>::TransformIncompleteArrayType(
5461 TypeLocBuilder &TLB,
5462 IncompleteArrayTypeLoc TL) {
5463 const IncompleteArrayType *T = TL.getTypePtr();
5464 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5465 if (ElementType.isNull())
5468 QualType
Result = TL.getType();
5469 if (getDerived().AlwaysRebuild() ||
5470 ElementType != T->getElementType()) {
5471 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5472 T->getSizeModifier(),
5473 T->getIndexTypeCVRQualifiers(),
5474 TL.getBracketsRange());
5479 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(
Result);
5480 NewTL.setLBracketLoc(TL.getLBracketLoc());
5481 NewTL.setRBracketLoc(TL.getRBracketLoc());
5482 NewTL.setSizeExpr(
nullptr);
5487template<
typename Derived>
5489TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
5490 VariableArrayTypeLoc TL) {
5491 const VariableArrayType *T = TL.getTypePtr();
5492 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5493 if (ElementType.isNull())
5498 EnterExpressionEvaluationContext Context(
5500 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5502 if (SizeResult.isInvalid())
5506 if (SizeResult.isInvalid())
5509 Expr *
Size = SizeResult.get();
5511 QualType
Result = TL.getType();
5512 if (getDerived().AlwaysRebuild() ||
5513 ElementType != T->getElementType() ||
5514 Size != T->getSizeExpr()) {
5515 Result = getDerived().RebuildVariableArrayType(ElementType,
5516 T->getSizeModifier(),
5518 T->getIndexTypeCVRQualifiers(),
5519 TL.getBracketsRange());
5526 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5527 NewTL.setLBracketLoc(TL.getLBracketLoc());
5528 NewTL.setRBracketLoc(TL.getRBracketLoc());
5529 NewTL.setSizeExpr(Size);
5534template<
typename Derived>
5536TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
5537 DependentSizedArrayTypeLoc TL) {
5538 const DependentSizedArrayType *T = TL.getTypePtr();
5539 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5540 if (ElementType.isNull())
5548 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5551 Expr *origSize = TL.getSizeExpr();
5552 if (!origSize) origSize = T->getSizeExpr();
5555 = getDerived().TransformExpr(origSize);
5557 if (sizeResult.isInvalid())
5560 Expr *size = sizeResult.get();
5562 QualType
Result = TL.getType();
5563 if (getDerived().AlwaysRebuild() ||
5564 ElementType != T->getElementType() ||
5566 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5567 T->getSizeModifier(),
5569 T->getIndexTypeCVRQualifiers(),
5570 TL.getBracketsRange());
5577 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(
Result);
5578 NewTL.setLBracketLoc(TL.getLBracketLoc());
5579 NewTL.setRBracketLoc(TL.getRBracketLoc());
5580 NewTL.setSizeExpr(size);
5585template <
typename Derived>
5586QualType TreeTransform<Derived>::TransformDependentVectorType(
5587 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
5588 const DependentVectorType *T = TL.getTypePtr();
5589 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5590 if (ElementType.isNull())
5598 if (
Size.isInvalid())
5601 QualType
Result = TL.getType();
5602 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
5603 Size.get() != T->getSizeExpr()) {
5604 Result = getDerived().RebuildDependentVectorType(
5605 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
5611 if (isa<DependentVectorType>(
Result)) {
5612 DependentVectorTypeLoc NewTL =
5613 TLB.push<DependentVectorTypeLoc>(
Result);
5614 NewTL.setNameLoc(TL.getNameLoc());
5616 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5617 NewTL.setNameLoc(TL.getNameLoc());
5623template<
typename Derived>
5624QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5625 TypeLocBuilder &TLB,
5626 DependentSizedExtVectorTypeLoc TL) {
5627 const DependentSizedExtVectorType *T = TL.getTypePtr();
5630 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5631 if (ElementType.isNull())
5640 if (
Size.isInvalid())
5643 QualType
Result = TL.getType();
5644 if (getDerived().AlwaysRebuild() ||
5645 ElementType != T->getElementType() ||
5646 Size.get() != T->getSizeExpr()) {
5647 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5649 T->getAttributeLoc());
5655 if (isa<DependentSizedExtVectorType>(
Result)) {
5656 DependentSizedExtVectorTypeLoc NewTL
5657 = TLB.push<DependentSizedExtVectorTypeLoc>(
Result);
5658 NewTL.setNameLoc(TL.getNameLoc());
5660 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5661 NewTL.setNameLoc(TL.getNameLoc());
5667template <
typename Derived>
5669TreeTransform<Derived>::TransformConstantMatrixType(TypeLocBuilder &TLB,
5670 ConstantMatrixTypeLoc TL) {
5671 const ConstantMatrixType *T = TL.getTypePtr();
5672 QualType ElementType = getDerived().TransformType(T->getElementType());
5673 if (ElementType.isNull())
5676 QualType
Result = TL.getType();
5677 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
5678 Result = getDerived().RebuildConstantMatrixType(
5679 ElementType, T->getNumRows(), T->getNumColumns());
5684 ConstantMatrixTypeLoc NewTL = TLB.push<ConstantMatrixTypeLoc>(
Result);
5685 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5686 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5687 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
5688 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
5693template <
typename Derived>
5694QualType TreeTransform<Derived>::TransformDependentSizedMatrixType(
5695 TypeLocBuilder &TLB, DependentSizedMatrixTypeLoc TL) {
5696 const DependentSizedMatrixType *T = TL.getTypePtr();
5698 QualType ElementType = getDerived().TransformType(T->getElementType());
5699 if (ElementType.isNull()) {
5707 Expr *origRows = TL.getAttrRowOperand();
5709 origRows = T->getRowExpr();
5710 Expr *origColumns = TL.getAttrColumnOperand();
5712 origColumns = T->getColumnExpr();
5714 ExprResult rowResult = getDerived().TransformExpr(origRows);
5716 if (rowResult.isInvalid())
5719 ExprResult columnResult = getDerived().TransformExpr(origColumns);
5721 if (columnResult.isInvalid())
5724 Expr *rows = rowResult.get();
5725 Expr *columns = columnResult.get();
5727 QualType
Result = TL.getType();
5728 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
5729 rows != origRows || columns != origColumns) {
5730 Result = getDerived().RebuildDependentSizedMatrixType(
5731 ElementType, rows, columns, T->getAttributeLoc());
5739 MatrixTypeLoc NewTL = TLB.push<MatrixTypeLoc>(
Result);
5740 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5741 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5742 NewTL.setAttrRowOperand(rows);
5743 NewTL.setAttrColumnOperand(columns);
5747template <
typename Derived>
5748QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5749 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5750 const DependentAddressSpaceType *T = TL.getTypePtr();
5752 QualType pointeeType = getDerived().TransformType(T->getPointeeType());
5754 if (pointeeType.isNull())
5761 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
5763 if (AddrSpace.isInvalid())
5766 QualType
Result = TL.getType();
5767 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
5768 AddrSpace.get() != T->getAddrSpaceExpr()) {
5769 Result = getDerived().RebuildDependentAddressSpaceType(
5770 pointeeType, AddrSpace.get(), T->getAttributeLoc());
5776 if (isa<DependentAddressSpaceType>(
Result)) {
5777 DependentAddressSpaceTypeLoc NewTL =
5778 TLB.push<DependentAddressSpaceTypeLoc>(
Result);
5780 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5781 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
5782 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5785 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(
5786 Result, getDerived().getBaseLocation());
5787 TransformType(TLB, DI->getTypeLoc());
5793template <
typename Derived>
5794QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
5796 const VectorType *T = TL.getTypePtr();
5797 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5798 if (ElementType.isNull())
5801 QualType
Result = TL.getType();
5802 if (getDerived().AlwaysRebuild() ||
5803 ElementType != T->getElementType()) {
5804 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
5805 T->getVectorKind());
5810 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(
Result);
5811 NewTL.setNameLoc(TL.getNameLoc());
5816template<
typename Derived>
5817QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
5818 ExtVectorTypeLoc TL) {
5819 const VectorType *T = TL.getTypePtr();
5820 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5821 if (ElementType.isNull())
5824 QualType
Result = TL.getType();
5825 if (getDerived().AlwaysRebuild() ||
5826 ElementType != T->getElementType()) {
5827 Result = getDerived().RebuildExtVectorType(ElementType,
5828 T->getNumElements(),
5834 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(
Result);
5835 NewTL.setNameLoc(TL.getNameLoc());
5840template <
typename Derived>
5843 std::optional<unsigned> NumExpansions,
bool ExpectParameterPack) {
5847 if (NumExpansions && isa<PackExpansionType>(OldDI->
getType())) {
5874 NewDI = getDerived().TransformType(OldDI);
5878 if (NewDI == OldDI && indexAdjustment == 0)
5892 transformedLocalDecl(OldParm, {newParm});
5896template <
typename Derived>
5904 unsigned *LastParamTransformed) {
5905 int indexAdjustment = 0;
5907 unsigned NumParams = Params.size();
5908 for (
unsigned i = 0; i != NumParams; ++i) {
5909 if (LastParamTransformed)
5910 *LastParamTransformed = i;
5912 assert(OldParm->getFunctionScopeIndex() == i);
5914 std::optional<unsigned> NumExpansions;
5916 if (OldParm->isParameterPack()) {
5921 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
5927 bool ShouldExpand =
false;
5928 bool RetainExpansion =
false;
5929 std::optional<unsigned> OrigNumExpansions;
5930 if (Unexpanded.size() > 0) {
5932 NumExpansions = OrigNumExpansions;
5933 if (getDerived().TryExpandParameterPacks(ExpansionTL.
getEllipsisLoc(),
5934 Pattern.getSourceRange(),
5946 "Could not find parameter packs or undeduced auto type!");
5953 getDerived().ExpandingFunctionParameterPack(OldParm);
5954 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5957 = getDerived().TransformFunctionTypeParam(OldParm,
5965 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
5966 OutParamTypes.push_back(NewParm->
getType());
5968 PVars->push_back(NewParm);
5973 if (RetainExpansion) {
5974 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5976 = getDerived().TransformFunctionTypeParam(OldParm,
5984 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
5985 OutParamTypes.push_back(NewParm->
getType());
5987 PVars->push_back(NewParm);
6003 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
6008 "Parameter pack no longer a parameter pack after "
6011 NewParm = getDerived().TransformFunctionTypeParam(
6012 OldParm, indexAdjustment, std::nullopt,
6020 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6021 OutParamTypes.push_back(NewParm->
getType());
6023 PVars->push_back(NewParm);
6031 bool IsPackExpansion =
false;
6032 std::optional<unsigned> NumExpansions;
6035 = dyn_cast<PackExpansionType>(OldType)) {
6037 QualType Pattern = Expansion->getPattern();
6039 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6042 bool ShouldExpand =
false;
6043 bool RetainExpansion =
false;
6044 if (getDerived().TryExpandParameterPacks(Loc,
SourceRange(),
6055 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6057 QualType NewType = getDerived().TransformType(Pattern);
6062 NewType = getSema().getASTContext().getPackExpansionType(
6063 NewType, std::nullopt);
6070 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6071 OutParamTypes.push_back(NewType);
6073 PVars->push_back(
nullptr);
6082 if (RetainExpansion) {
6083 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6084 QualType NewType = getDerived().TransformType(Pattern);
6089 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6090 OutParamTypes.push_back(NewType);
6092 PVars->push_back(
nullptr);
6097 OldType = Expansion->getPattern();
6098 IsPackExpansion =
true;
6100 NewType = getDerived().TransformType(OldType);
6102 NewType = getDerived().TransformType(OldType);
6108 if (IsPackExpansion)
6109 NewType = getSema().Context.getPackExpansionType(NewType,
6113 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6114 OutParamTypes.push_back(NewType);
6116 PVars->push_back(
nullptr);
6121 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6123 assert(parm->getFunctionScopeIndex() == i);
6130template<
typename Derived>
6135 return getDerived().TransformFunctionProtoType(
6138 return getDerived().TransformExceptionSpec(TL.
getBeginLoc(), ESI,
6139 ExceptionStorage, Changed);
6143template<
typename Derived>
template<
typename Fn>
6146 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
6163 if (getDerived().TransformFunctionTypeParams(
6167 ParamTypes, &ParamDecls, ExtParamInfos))
6179 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6181 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6187 ResultType = getDerived().TransformType(TLB, TL.
getReturnLoc());
6191 if (getDerived().TransformFunctionTypeParams(
6195 ParamTypes, &ParamDecls, ExtParamInfos))
6201 bool EPIChanged =
false;
6206 if (
auto NewExtParamInfos =
6220 if (getDerived().AlwaysRebuild() || ResultType != T->
getReturnType() ||
6222 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6233 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6239template<
typename Derived>
6249 auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.
SourceTemplate);
6251 SemaRef, Method ? Method->getParent() :
nullptr,
6252 Method ? Method->getMethodQualifiers() :
Qualifiers{},
6262 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6285 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6290 bool Expand =
false;
6291 bool RetainExpansion =
false;
6292 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6295 if (getDerived().TryExpandParameterPacks(
6297 RetainExpansion, NumExpansions))
6305 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6310 Exceptions.push_back(
U);
6316 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6319 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6323 Exceptions.push_back(
U);
6326 QualType U = getDerived().TransformType(T);
6332 Exceptions.push_back(
U);
6342template<
typename Derived>
6352 if (getDerived().AlwaysRebuild() || ResultType != T->
getReturnType())
6353 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6364template <
typename Derived>
6365QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6366 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6367 const UnresolvedUsingType *T = TL.getTypePtr();
6368 Decl *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6372 QualType
Result = TL.getType();
6373 if (getDerived().AlwaysRebuild() || D != T->getDecl()) {
6374 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(), D);
6381 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(
Result);
6382 NewTL.setNameLoc(TL.getNameLoc());
6387template <
typename Derived>
6388QualType TreeTransform<Derived>::TransformUsingType(TypeLocBuilder &TLB,
6390 const UsingType *T = TL.getTypePtr();
6392 auto *Found = cast_or_null<UsingShadowDecl>(getDerived().TransformDecl(
6393 TL.getLocalSourceRange().getBegin(), T->getFoundDecl()));
6397 QualType Underlying = getDerived().TransformType(T->desugar());
6398 if (Underlying.isNull())
6401 QualType
Result = TL.getType();
6402 if (getDerived().AlwaysRebuild() || Found != T->getFoundDecl() ||
6403 Underlying != T->getUnderlyingType()) {
6404 Result = getDerived().RebuildUsingType(Found, Underlying);
6409 TLB.pushTypeSpec(
Result).setNameLoc(TL.getNameLoc());
6413template<
typename Derived>
6414QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
6415 TypedefTypeLoc TL) {
6416 const TypedefType *T = TL.getTypePtr();
6417 TypedefNameDecl *Typedef
6418 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6423 QualType
Result = TL.getType();
6424 if (getDerived().AlwaysRebuild() ||
6425 Typedef != T->getDecl()) {
6426 Result = getDerived().RebuildTypedefType(Typedef);
6431 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(
Result);
6432 NewTL.setNameLoc(TL.getNameLoc());
6437template<
typename Derived>
6438QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
6439 TypeOfExprTypeLoc TL) {
6445 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6453 QualType
Result = TL.getType();
6455 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6457 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6462 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(
Result);
6463 NewTL.setTypeofLoc(TL.getTypeofLoc());
6464 NewTL.setLParenLoc(TL.getLParenLoc());
6465 NewTL.setRParenLoc(TL.getRParenLoc());
6470template<
typename Derived>
6471QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
6473 TypeSourceInfo* Old_Under_TI = TL.getUnmodifiedTInfo();
6474 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6478 QualType
Result = TL.getType();
6480 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6481 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6486 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(
Result);
6487 NewTL.setTypeofLoc(TL.getTypeofLoc());
6488 NewTL.setLParenLoc(TL.getLParenLoc());
6489 NewTL.setRParenLoc(TL.getRParenLoc());
6490 NewTL.setUnmodifiedTInfo(New_Under_TI);
6495template<
typename Derived>
6496QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
6497 DecltypeTypeLoc TL) {
6498 const DecltypeType *T = TL.getTypePtr();
6505 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
6509 E = getSema().ActOnDecltypeExpression(E.get());
6513 QualType
Result = TL.getType();
6514 if (getDerived().AlwaysRebuild() ||
6515 E.get() != T->getUnderlyingExpr()) {
6516 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
6522 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(
Result);
6523 NewTL.setDecltypeLoc(TL.getDecltypeLoc());
6524 NewTL.setRParenLoc(TL.getRParenLoc());
6528template <
typename Derived>
6530TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
6531 PackIndexingTypeLoc TL) {
6533 ExprResult IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6534 if (IndexExpr.isInvalid())
6536 QualType Pattern = TL.getPattern();
6538 const PackIndexingType *PIT = TL.getTypePtr();
6542 bool NotYetExpanded = Types.empty();
6543 bool FullySubstituted =
true;
6548 for (
const QualType &T : Types) {
6549 if (!T->containsUnexpandedParameterPack()) {
6550 QualType Transformed = getDerived().TransformType(T);
6551 if (Transformed.isNull())
6553 SubtitutedTypes.push_back(Transformed);
6558 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
6559 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6562 bool ShouldExpand =
true;
6563 bool RetainExpansion =
false;
6564 std::optional<unsigned> OrigNumExpansions;
6565 std::optional<unsigned> NumExpansions = OrigNumExpansions;
6566 if (getDerived().TryExpandParameterPacks(TL.getEllipsisLoc(), SourceRange(),
6567 Unexpanded, ShouldExpand,
6568 RetainExpansion, NumExpansions))
6570 if (!ShouldExpand) {
6571 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6574 TypeSourceInfo *TI =
6576 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6579 if (NotYetExpanded) {
6580 FullySubstituted =
false;
6581 QualType Out = getDerived().RebuildPackIndexingType(
6582 Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6587 PackIndexingTypeLoc Loc = TLB.push<PackIndexingTypeLoc>(Out);
6588 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6591 SubtitutedTypes.push_back(Pack);
6594 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6595 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
6596 QualType Out = getDerived().TransformType(T);
6599 SubtitutedTypes.push_back(Out);
6603 if (RetainExpansion) {
6604 FullySubstituted =
false;
6605 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
6606 QualType Out = getDerived().TransformType(T);
6609 SubtitutedTypes.push_back(Out);
6613 QualType
Result = getDerived().TransformType(TLB, TL.getPatternLoc());
6615 QualType Out = getDerived().RebuildPackIndexingType(
6616 Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
6617 FullySubstituted, SubtitutedTypes);
6621 PackIndexingTypeLoc Loc = TLB.push<PackIndexingTypeLoc>(Out);
6622 Loc.setEllipsisLoc(TL.getEllipsisLoc());
6626template<
typename Derived>
6627QualType TreeTransform<Derived>::TransformUnaryTransformType(
6628 TypeLocBuilder &TLB,
6629 UnaryTransformTypeLoc TL) {
6630 QualType
Result = TL.getType();
6631 if (
Result->isDependentType()) {
6632 const UnaryTransformType *T = TL.getTypePtr();
6634 getDerived().TransformType(TL.getUnderlyingTInfo())->getType();
6635 Result = getDerived().RebuildUnaryTransformType(NewBase,
6642 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(
Result);
6643 NewTL.setKWLoc(TL.getKWLoc());
6644 NewTL.setParensRange(TL.getParensRange());
6645 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
6649template<
typename Derived>
6650QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
6651 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
6652 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
6655 TemplateName TemplateName = getDerived().TransformTemplateName(
6656 SS, T->getTemplateName(), TL.getTemplateNameLoc());
6657 if (TemplateName.isNull())
6660 QualType OldDeduced = T->getDeducedType();
6661 QualType NewDeduced;
6662 if (!OldDeduced.isNull()) {
6663 NewDeduced = getDerived().TransformType(OldDeduced);
6664 if (NewDeduced.isNull())
6668 QualType
Result = getDerived().RebuildDeducedTemplateSpecializationType(
6669 TemplateName, NewDeduced);
6673 DeducedTemplateSpecializationTypeLoc NewTL =
6674 TLB.push<DeducedTemplateSpecializationTypeLoc>(
Result);
6675 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6680template<
typename Derived>
6681QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
6683 const RecordType *T = TL.getTypePtr();
6685 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6690 QualType
Result = TL.getType();
6691 if (getDerived().AlwaysRebuild() ||
6692 Record != T->getDecl()) {
6698 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(
Result);
6699 NewTL.setNameLoc(TL.getNameLoc());
6704template<
typename Derived>
6705QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
6707 const EnumType *T = TL.getTypePtr();
6709 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
6714 QualType
Result = TL.getType();
6715 if (getDerived().AlwaysRebuild() ||
6716 Enum != T->getDecl()) {
6722 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(
Result);
6723 NewTL.setNameLoc(TL.getNameLoc());
6728template<
typename Derived>
6729QualType TreeTransform<Derived>::TransformInjectedClassNameType(
6730 TypeLocBuilder &TLB,
6731 InjectedClassNameTypeLoc TL) {
6732 Decl *D = getDerived().TransformDecl(TL.getNameLoc(),
6733 TL.getTypePtr()->getDecl());
6734 if (!D)
return QualType();
6737 TLB.pushTypeSpec(T).setNameLoc(TL.getNameLoc());
6741template<
typename Derived>
6745 return getDerived().TransformTemplateTypeParmType(
6750template <
typename Derived>
6756template<
typename Derived>
6757QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
6758 TypeLocBuilder &TLB,
6759 SubstTemplateTypeParmTypeLoc TL) {
6760 const SubstTemplateTypeParmType *T = TL.getTypePtr();
6763 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
6768 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
6769 QualType Replacement = getDerived().TransformType(T->getReplacementType());
6770 if (Replacement.isNull())
6774 Replacement, NewReplaced, T->getIndex(), T->getPackIndex());
6777 SubstTemplateTypeParmTypeLoc NewTL
6778 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
6779 NewTL.setNameLoc(TL.getNameLoc());
6784template<
typename Derived>
6788 return getDerived().TransformSubstTemplateTypeParmPackType(
6792template <
typename Derived>
6798template<
typename Derived>
6813 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
6816template<
typename Derived>
6824 if (getDerived().AlwaysRebuild() ||
6826 Result = getDerived().RebuildAtomicType(ValueType, TL.
getKWLoc());
6831 AtomicTypeLoc NewTL = TLB.
push<AtomicTypeLoc>(
Result);
6839template <
typename Derived>
6840QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
6842 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
6843 if (ValueType.isNull())
6846 QualType
Result = TL.getType();
6847 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
6848 const PipeType *PT =
Result->castAs<PipeType>();
6849 bool isReadPipe = PT->isReadOnly();
6850 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
6855 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(
Result);
6856 NewTL.setKWLoc(TL.getKWLoc());
6861template <
typename Derived>
6862QualType TreeTransform<Derived>::TransformBitIntType(TypeLocBuilder &TLB,
6864 const BitIntType *EIT = TL.getTypePtr();
6865 QualType
Result = TL.getType();
6867 if (getDerived().AlwaysRebuild()) {
6868 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
6869 EIT->getNumBits(), TL.getNameLoc());
6874 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
6875 NewTL.setNameLoc(TL.getNameLoc());
6879template <
typename Derived>
6880QualType TreeTransform<Derived>::TransformDependentBitIntType(
6881 TypeLocBuilder &TLB, DependentBitIntTypeLoc TL) {
6882 const DependentBitIntType *EIT = TL.getTypePtr();
6886 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
6889 if (BitsExpr.isInvalid())
6892 QualType
Result = TL.getType();
6894 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
6895 Result = getDerived().RebuildDependentBitIntType(
6896 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
6902 if (isa<DependentBitIntType>(
Result)) {
6903 DependentBitIntTypeLoc NewTL = TLB.push<DependentBitIntTypeLoc>(
Result);
6904 NewTL.setNameLoc(TL.getNameLoc());
6906 BitIntTypeLoc NewTL = TLB.push<BitIntTypeLoc>(
Result);
6907 NewTL.setNameLoc(TL.getNameLoc());
6917 template<
typename ArgLocContainer>
6919 ArgLocContainer *Container;
6944 : Container(&Container), Index(Index) { }
6958 return Container->getArgLoc(Index);
6962 return pointer(Container->getArgLoc(Index));
6967 return X.Container == Y.Container &&
X.Index == Y.Index;
6976template<
typename Derived>
6977QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
6979 const AutoType *T = TL.getTypePtr();
6980 QualType OldDeduced = T->getDeducedType();
6981 QualType NewDeduced;
6982 if (!OldDeduced.isNull()) {
6983 NewDeduced = getDerived().TransformType(OldDeduced);
6984 if (NewDeduced.isNull())
6988 ConceptDecl *NewCD =
nullptr;
6989 TemplateArgumentListInfo NewTemplateArgs;
6990 NestedNameSpecifierLoc NewNestedNameSpec;
6991 if (T->isConstrained()) {
6992 assert(TL.getConceptReference());
6993 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
6994 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
6996 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
6997 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
6998 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
6999 if (getDerived().TransformTemplateArguments(
7000 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7004 if (TL.getNestedNameSpecifierLoc()) {
7006 = getDerived().TransformNestedNameSpecifierLoc(
7007 TL.getNestedNameSpecifierLoc());
7008 if (!NewNestedNameSpec)
7013 QualType
Result = TL.getType();
7014 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7015 T->isDependentType() || T->isConstrained()) {
7018 NewArgList.reserve(NewTemplateArgs.size());
7019 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7020 NewArgList.push_back(ArgLoc.getArgument());
7021 Result = getDerived().RebuildAutoType(NewDeduced, T->getKeyword(), NewCD,
7027 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(
Result);
7028 NewTL.setNameLoc(TL.getNameLoc());
7029 NewTL.setRParenLoc(TL.getRParenLoc());
7030 NewTL.setConceptReference(
nullptr);
7032 if (T->isConstrained()) {
7033 DeclarationNameInfo DNI = DeclarationNameInfo(
7034 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7035 TL.getConceptNameLoc(),
7036 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7038 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7039 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7041 NewTL.setConceptReference(CR);
7047template <
typename Derived>
7049 TypeLocBuilder &TLB,
7050 TemplateSpecializationTypeLoc TL,
7051 TemplateName Template) {
7052 TemplateArgumentListInfo NewTemplateArgs;
7053 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7054 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7055 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
7057 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7058 ArgIterator(TL, TL.getNumArgs()),
7065 getDerived().RebuildTemplateSpecializationType(Template,
7066 TL.getTemplateNameLoc(),
7074 if (isa<DependentTemplateSpecializationType>(
Result)) {
7075 DependentTemplateSpecializationTypeLoc NewTL
7076 = TLB.push<DependentTemplateSpecializationTypeLoc>(
Result);
7077 NewTL.setElaboratedKeywordLoc(SourceLocation());
7078 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
7079 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7080 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7081 NewTL.setLAngleLoc(TL.getLAngleLoc());
7082 NewTL.setRAngleLoc(TL.getRAngleLoc());
7083 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7084 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7088 TemplateSpecializationTypeLoc NewTL
7089 = TLB.push<TemplateSpecializationTypeLoc>(
Result);
7090 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
7091 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7092 NewTL.setLAngleLoc(TL.getLAngleLoc());
7093 NewTL.setRAngleLoc(TL.getRAngleLoc());
7094 for (
unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
7095 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
7101template <
typename Derived>
7112 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7120 QualType Result = getSema().Context.getDependentTemplateSpecializationType(
7122 DTN->getIdentifier(), NewTemplateArgs.
arguments());
7132 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7138 = getDerived().RebuildTemplateSpecializationType(Template,
7150 for (
unsigned i = 0, e = NewTemplateArgs.
size(); i != e; ++i)
7157template<
typename Derived>
7172 QualType NamedT = getDerived().TransformType(TLB, TL.
getNamedTypeLoc());
7173 if (NamedT.isNull())
7182 if (
const TemplateSpecializationType *TST =
7183 NamedT->getAs<TemplateSpecializationType>()) {
7184 TemplateName Template = TST->getTemplateName();
7185 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
7186 Template.getAsTemplateDecl())) {
7188 diag::err_tag_reference_non_tag)
7190 << llvm::to_underlying(
7192 SemaRef.
Diag(TAT->getLocation(), diag::note_declared_at);
7198 if (getDerived().AlwaysRebuild() ||
7203 QualifierLoc, NamedT);
7208 ElaboratedTypeLoc NewTL = TLB.
push<ElaboratedTypeLoc>(
Result);
7210 NewTL.setQualifierLoc(QualifierLoc);
7214template <
typename Derived>
7215template <
typename Fn>
7220 if (modifiedType.
isNull())
7225 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7226 if (oldAttr && !newAttr)
7232 if (getDerived().AlwaysRebuild() ||
7238 if (equivalentType.
isNull())
7247 diag::err_nullability_nonpointer)
7263template <
typename Derived>
7266 return getDerived().TransformAttributedType(
7268 return getDerived().TransformType(TLB, ModifiedLoc);
7272template <
typename Derived>
7276 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7279template<
typename Derived>
7281TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
7283 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7287 QualType
Result = TL.getType();
7288 if (getDerived().AlwaysRebuild() ||
7289 Inner != TL.getInnerLoc().getType()) {
7290 Result = getDerived().RebuildParenType(Inner);
7295 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(
Result);
7296 NewTL.setLParenLoc(TL.getLParenLoc());
7297 NewTL.setRParenLoc(TL.getRParenLoc());
7301template <
typename Derived>
7303TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
7304 MacroQualifiedTypeLoc TL) {
7305 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7309 QualType
Result = TL.getType();
7310 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7312 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7317 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(
Result);
7318 NewTL.setExpansionLoc(TL.getExpansionLoc());
7322template<
typename Derived>
7323QualType TreeTransform<Derived>::TransformDependentNameType(
7324 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
7325 return TransformDependentNameType(TLB, TL,
false);
7328template<
typename Derived>
7329QualType TreeTransform<Derived>::TransformDependentNameType(
7330 TypeLocBuilder &TLB, DependentNameTypeLoc TL,
bool DeducedTSTContext) {
7331 const DependentNameType *T = TL.getTypePtr();
7333 NestedNameSpecifierLoc QualifierLoc
7334 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7339 = getDerived().RebuildDependentNameType(T->getKeyword(),
7340 TL.getElaboratedKeywordLoc(),
7348 if (
const ElaboratedType* ElabT =
Result->getAs<ElaboratedType>()) {
7349 QualType NamedT = ElabT->getNamedType();
7350 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
7352 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(
Result);
7353 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7354 NewTL.setQualifierLoc(QualifierLoc);
7356 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(
Result);
7357 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
7358 NewTL.setQualifierLoc(QualifierLoc);
7359 NewTL.setNameLoc(TL.getNameLoc());
7364template<
typename Derived>
7367 DependentTemplateSpecializationTypeLoc TL) {
7368 NestedNameSpecifierLoc QualifierLoc;
7369 if (TL.getQualifierLoc()) {
7371 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
7377 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
7380template<
typename Derived>
7393 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7398 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
7406 QualType NamedT = ElabT->getNamedType();
7415 for (
unsigned I = 0, E = NewTemplateArgs.
size(); I != E; ++I)
7422 }
else if (isa<DependentTemplateSpecializationType>(
Result)) {
7431 for (
unsigned I = 0, E = NewTemplateArgs.
size(); I != E; ++I)
7440 for (
unsigned I = 0, E = NewTemplateArgs.
size(); I != E; ++I)
7446template<
typename Derived>
7455 if (getDerived().AlwaysRebuild() ||
7457 Result = getDerived().RebuildPackExpansionType(Pattern,
7465 PackExpansionTypeLoc NewT = TLB.
push<PackExpansionTypeLoc>(
Result);
7470template<
typename Derived>
7472TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
7473 ObjCInterfaceTypeLoc TL) {
7475 TLB.pushFullCopy(TL);
7476 return TL.getType();
7479template<
typename Derived>
7481TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
7482 ObjCTypeParamTypeLoc TL) {
7483 const ObjCTypeParamType *T = TL.getTypePtr();
7484 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
7485 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7489 QualType
Result = TL.getType();
7490 if (getDerived().AlwaysRebuild() ||
7491 OTP != T->getDecl()) {
7492 Result = getDerived().RebuildObjCTypeParamType(
7493 OTP, TL.getProtocolLAngleLoc(),
7494 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7495 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7500 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(
Result);
7501 if (TL.getNumProtocols()) {
7502 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7503 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7504 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7505 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7510template<
typename Derived>
7512TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
7513 ObjCObjectTypeLoc TL) {
7515 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7516 if (BaseType.isNull())
7519 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7523 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7524 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
7525 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7526 QualType TypeArg = TypeArgInfo->getType();
7527 if (
auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
7531 const auto *PackExpansion = PackExpansionLoc.getType()
7532 ->castAs<PackExpansionType>();
7536 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7540 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7541 bool Expand =
false;
7542 bool RetainExpansion =
false;
7543 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7544 if (getDerived().TryExpandParameterPacks(
7545 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7546 Unexpanded, Expand, RetainExpansion, NumExpansions))
7553 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7555 TypeLocBuilder TypeArgBuilder;
7556 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7557 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7559 if (NewPatternType.isNull())
7563 NewPatternType, NumExpansions);
7564 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
7565 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7566 NewTypeArgInfos.push_back(
7567 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7573 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7574 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
7576 TypeLocBuilder TypeArgBuilder;
7577 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
7579 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7581 if (NewTypeArg.isNull())
7584 NewTypeArgInfos.push_back(
7585 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7591 TypeLocBuilder TypeArgBuilder;
7592 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
7593 QualType NewTypeArg =
7594 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7595 if (NewTypeArg.isNull())
7599 if (NewTypeArg == TypeArg) {
7600 NewTypeArgInfos.push_back(TypeArgInfo);
7604 NewTypeArgInfos.push_back(
7605 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7609 QualType
Result = TL.getType();
7610 if (getDerived().AlwaysRebuild() || AnyChanged) {
7612 Result = getDerived().RebuildObjCObjectType(
7613 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7614 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7615 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7616 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7622 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(
Result);
7623 NewT.setHasBaseTypeAsWritten(
true);
7624 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7625 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7626 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7627 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7628 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7629 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7630 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7631 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7635template<
typename Derived>
7637TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
7638 ObjCObjectPointerTypeLoc TL) {
7639 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7640 if (PointeeType.isNull())
7643 QualType
Result = TL.getType();
7644 if (getDerived().AlwaysRebuild() ||
7645 PointeeType != TL.getPointeeLoc().getType()) {
7646 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
7652 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(
Result);
7653 NewT.setStarLoc(TL.getStarLoc());
7660template<
typename Derived>
7662TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
7666template<
typename Derived>
7669 return getDerived().TransformCompoundStmt(S,
false);
7672template<
typename Derived>
7678 if (S->hasStoredFPFeatures())
7679 getSema().resetFPOptions(
7680 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
7683 bool SubStmtInvalid =
false;
7684 bool SubStmtChanged =
false;
7686 for (
auto *B : S->body()) {
7688 B, IsStmtExpr && B ==
ExprResult ? SDK_StmtExprResult : SDK_Discarded);
7690 if (
Result.isInvalid()) {
7693 if (isa<DeclStmt>(B))
7697 SubStmtInvalid =
true;
7701 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
7702 Statements.push_back(
Result.getAs<Stmt>());
7708 if (!getDerived().AlwaysRebuild() &&
7712 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
7718template<
typename Derived>
7720TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
7727 LHS = getDerived().TransformExpr(S->getLHS());
7729 if (LHS.isInvalid())
7733 RHS = getDerived().TransformExpr(S->getRHS());
7735 if (RHS.isInvalid())
7742 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
7744 S->getEllipsisLoc(),
7747 if (Case.isInvalid())
7752 getDerived().TransformStmt(S->getSubStmt());
7753 if (SubStmt.isInvalid())
7757 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
7760template <
typename Derived>
7761StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
7764 getDerived().TransformStmt(S->getSubStmt());
7765 if (SubStmt.isInvalid())
7769 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
7773template<
typename Derived>
7775TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
7776 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7777 if (SubStmt.isInvalid())
7780 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
7788 if (LD == S->getDecl())
7789 S->getDecl()->setStmt(
nullptr);
7792 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
7793 cast<LabelDecl>(LD), SourceLocation(),
7797template <
typename Derived>
7806 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
7807#include "clang/Basic/AttrList.inc"
7812template <
typename Derived>
7823 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
7824#include "clang/Basic/AttrList.inc"
7826 return TransformAttr(R);
7829template <
typename Derived>
7832 StmtDiscardKind SDK) {
7833 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
7837 bool AttrsChanged =
false;
7841 for (
const auto *I : S->getAttrs()) {
7843 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.
get(), I);
7844 AttrsChanged |= (I != R);
7849 if (SubStmt.
get() == S->getSubStmt() && !AttrsChanged)
7857 return getDerived().RebuildAttributedStmt(S->getAttrLoc(), Attrs,
7861template<
typename Derived>
7863TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
7866 if (
Init.isInvalid())
7869 Sema::ConditionResult Cond;
7870 if (!S->isConsteval()) {
7872 Cond = getDerived().TransformCondition(
7873 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
7876 if (Cond.isInvalid())
7881 std::optional<bool> ConstexprConditionValue;
7882 if (S->isConstexpr())
7883 ConstexprConditionValue = Cond.getKnownValue();
7887 if (!ConstexprConditionValue || *ConstexprConditionValue) {
7888 Then = getDerived().TransformStmt(S->getThen());
7889 if (Then.isInvalid())
7895 Then =
new (getSema().Context)
7896 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
7901 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
7902 Else = getDerived().TransformStmt(S->getElse());
7903 if (Else.isInvalid())
7905 }
else if (S->getElse() && ConstexprConditionValue &&
7906 *ConstexprConditionValue) {
7910 Else =
new (getSema().Context)
7911 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
7914 if (!getDerived().AlwaysRebuild() &&
7915 Init.get() == S->getInit() &&
7916 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
7917 Then.get() == S->getThen() &&
7918 Else.get() == S->getElse())
7921 return getDerived().RebuildIfStmt(
7922 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
7923 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
7926template<
typename Derived>
7928TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
7931 if (
Init.isInvalid())
7935 Sema::ConditionResult Cond = getDerived().TransformCondition(
7936 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
7938 if (Cond.isInvalid())
7943 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
7944 Init.get(), Cond, S->getRParenLoc());
7949 StmtResult Body = getDerived().TransformStmt(S->getBody());
7950 if (Body.isInvalid())
7954 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
7958template<
typename Derived>
7960TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
7962 Sema::ConditionResult Cond = getDerived().TransformCondition(
7963 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
7965 if (Cond.isInvalid())
7969 StmtResult Body = getDerived().TransformStmt(S->getBody());
7970 if (Body.isInvalid())
7973 if (!getDerived().AlwaysRebuild() &&
7974 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
7975 Body.get() == S->getBody())
7978 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
7979 Cond, S->getRParenLoc(), Body.get());
7982template<
typename Derived>
7984TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
7986 StmtResult Body = getDerived().TransformStmt(S->getBody());
7987 if (Body.isInvalid())
7991 ExprResult Cond = getDerived().TransformExpr(S->getCond());
7992 if (Cond.isInvalid())
7995 if (!getDerived().AlwaysRebuild() &&
7996 Cond.get() == S->getCond() &&
7997 Body.get() == S->getBody())
8000 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8001 S->getWhileLoc(), Cond.get(),
8005template<
typename Derived>
8007TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
8008 if (getSema().getLangOpts().OpenMP)
8009 getSema().startOpenMPLoop();
8013 if (
Init.isInvalid())
8018 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8019 getSema().ActOnOpenMPLoopInitialization(S->getForLoc(),
Init.get());
8022 Sema::ConditionResult Cond = getDerived().TransformCondition(
8023 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8025 if (Cond.isInvalid())
8030 if (
Inc.isInvalid())
8033 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(
Inc.get()));
8034 if (S->getInc() && !FullInc.get())
8038 StmtResult Body = getDerived().TransformStmt(S->getBody());
8039 if (Body.isInvalid())
8042 if (!getDerived().AlwaysRebuild() &&
8043 Init.get() == S->getInit() &&
8044 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8045 Inc.get() == S->getInc() &&
8046 Body.get() == S->getBody())
8049 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8050 Init.get(), Cond, FullInc,
8051 S->getRParenLoc(), Body.get());
8054template<
typename Derived>
8056TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
8057 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8063 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8064 cast<LabelDecl>(LD));
8067template<
typename Derived>
8069TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
8075 if (!getDerived().AlwaysRebuild() &&
8076 Target.get() == S->getTarget())
8079 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8083template<
typename Derived>
8085TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
8089template<
typename Derived>
8091TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
8095template<
typename Derived>
8097TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
8105 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8108template<
typename Derived>
8110TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
8111 bool DeclChanged =
false;
8113 for (
auto *D : S->decls()) {
8114 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8118 if (Transformed != D)
8121 Decls.push_back(Transformed);
8124 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8127 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8130template<
typename Derived>
8132TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
8141 bool ExprsChanged =
false;
8144 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8145 Names.push_back(S->getOutputIdentifier(I));
8148 Constraints.push_back(S->getOutputConstraintLiteral(I));
8151 Expr *OutputExpr = S->getOutputExpr(I);
8156 ExprsChanged |=
Result.get() != OutputExpr;
8158 Exprs.push_back(
Result.get());
8162 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8163 Names.push_back(S->getInputIdentifier(I));
8166 Constraints.push_back(S->getInputConstraintLiteral(I));
8169 Expr *InputExpr = S->getInputExpr(I);
8174 ExprsChanged |=
Result.get() != InputExpr;
8176 Exprs.push_back(
Result.get());
8180 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8181 Names.push_back(S->getLabelIdentifier(I));
8186 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8187 Exprs.push_back(
Result.get());
8189 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8193 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I)
8194 Clobbers.push_back(S->getClobberStringLiteral(I));
8197 AsmString = S->getAsmString();
8198 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8199 S->isVolatile(), S->getNumOutputs(),
8200 S->getNumInputs(), Names.data(),
8201 Constraints, Exprs, AsmString.get(),
8202 Clobbers, S->getNumLabels(),
8206template<
typename Derived>
8208TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
8211 bool HadError =
false, HadChange =
false;
8215 TransformedExprs.reserve(SrcExprs.size());
8216 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8218 if (!
Result.isUsable()) {
8221 HadChange |= (
Result.get() != SrcExprs[i]);
8222 TransformedExprs.push_back(
Result.get());
8227 if (!HadChange && !getDerived().AlwaysRebuild())
8230 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8231 AsmToks, S->getAsmString(),
8232 S->getNumOutputs(), S->getNumInputs(),
8233 S->getAllConstraints(), S->getClobbers(),
8234 TransformedExprs, S->getEndLoc());
8238template<
typename Derived>
8240TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
8242 auto *FD = cast<FunctionDecl>(SemaRef.
CurContext);
8243 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8244 ScopeInfo->NeedsCoroutineSuspends &&
8245 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8246 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8247 "expected clean scope info");
8251 ScopeInfo->setNeedsCoroutineSuspends(
false);
8264 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8265 ScopeInfo->CoroutinePromise = Promise;
8270 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8271 if (InitSuspend.isInvalid())
8274 getDerived().TransformStmt(S->getFinalSuspendStmt());
8275 if (FinalSuspend.isInvalid() ||
8278 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8279 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
8281 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8282 if (BodyRes.isInvalid())
8285 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
8286 if (Builder.isInvalid())
8289 Expr *ReturnObject = S->getReturnValueInit();
8290 assert(ReturnObject &&
"the return object is expected to be valid");
8291 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8293 if (Res.isInvalid())
8295 Builder.ReturnValue = Res.get();
8300 if (S->hasDependentPromiseType()) {
8303 if (!Promise->getType()->isDependentType()) {
8304 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8305 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8306 "these nodes should not have been built yet");
8307 if (!Builder.buildDependentStatements())
8311 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8312 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8313 if (Res.isInvalid())
8315 Builder.OnFallthrough = Res.get();
8318 if (
auto *OnException = S->getExceptionHandler()) {
8319 StmtResult Res = getDerived().TransformStmt(OnException);
8320 if (Res.isInvalid())
8322 Builder.OnException = Res.get();
8325 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8326 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8327 if (Res.isInvalid())
8329 Builder.ReturnStmtOnAllocFailure = Res.get();
8333 assert(S->getAllocate() && S->getDeallocate() &&
8334 "allocation and deallocation calls must already be built");
8335 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8336 if (AllocRes.isInvalid())
8338 Builder.Allocate = AllocRes.get();
8340 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8341 if (DeallocRes.isInvalid())
8343 Builder.Deallocate = DeallocRes.get();
8345 if (
auto *ResultDecl = S->getResultDecl()) {
8346 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8347 if (Res.isInvalid())
8349 Builder.ResultDecl = Res.get();
8352 if (
auto *ReturnStmt = S->getReturnStmt()) {
8353 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
8354 if (Res.isInvalid())
8356 Builder.ReturnStmt = Res.get();
8360 return getDerived().RebuildCoroutineBodyStmt(Builder);
8363template<
typename Derived>
8365TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
8373 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8377template <
typename Derived>
8378ExprResult TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *E) {
8390 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8391 getSema().getCurScope(), E->getKeywordLoc());
8395 return getDerived().RebuildCoawaitExpr(
8396 E->getKeywordLoc(),
Operand.get(),
8397 cast<UnresolvedLookupExpr>(Lookup.get()), E->isImplicit());
8400template <
typename Derived>
8402TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *E) {
8403 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8405 if (OperandResult.isInvalid())
8408 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
8409 E->getOperatorCoawaitLookup());
8411 if (LookupResult.isInvalid())
8416 return getDerived().RebuildDependentCoawaitExpr(
8417 E->getKeywordLoc(), OperandResult.get(),
8418 cast<UnresolvedLookupExpr>(LookupResult.get()));
8421template<
typename Derived>
8423TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *E) {
8431 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8436template<
typename Derived>
8438TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
8440 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8441 if (TryBody.isInvalid())
8445 bool AnyCatchChanged =
false;
8447 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8448 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8449 if (Catch.isInvalid())
8451 if (Catch.get() != S->getCatchStmt(I))
8452 AnyCatchChanged =
true;
8453 CatchStmts.push_back(Catch.get());
8458 if (S->getFinallyStmt()) {
8459 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8460 if (Finally.isInvalid())
8465 if (!getDerived().AlwaysRebuild() &&
8466 TryBody.get() == S->getTryBody() &&
8468 Finally.get() == S->getFinallyStmt())
8472 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8473 CatchStmts, Finally.get());
8476template<
typename Derived>
8478TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
8480 VarDecl *Var =
nullptr;
8481 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8482 TypeSourceInfo *TSInfo =
nullptr;
8483 if (FromVar->getTypeSourceInfo()) {
8484 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8491 T = TSInfo->getType();
8493 T = getDerived().TransformType(FromVar->getType());
8498 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
8503 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8504 if (Body.isInvalid())
8507 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8512template<
typename Derived>
8514TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
8516 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8517 if (Body.isInvalid())
8521 if (!getDerived().AlwaysRebuild() &&
8522 Body.get() == S->getFinallyBody())
8526 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8530template<
typename Derived>
8532TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
8534 if (S->getThrowExpr()) {
8535 Operand = getDerived().TransformExpr(S->getThrowExpr());
8540 if (!getDerived().AlwaysRebuild() &&
8541 Operand.get() == S->getThrowExpr())
8544 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8547template<
typename Derived>
8549TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
8550 ObjCAtSynchronizedStmt *S) {
8556 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8562 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8563 if (Body.isInvalid())
8567 if (!getDerived().AlwaysRebuild() &&
8568 Object.get() == S->getSynchExpr() &&
8569 Body.get() == S->getSynchBody())
8573 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8574 Object.get(), Body.get());
8577template<
typename Derived>
8579TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
8580 ObjCAutoreleasePoolStmt *S) {
8582 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8583 if (Body.isInvalid())
8587 if (!getDerived().AlwaysRebuild() &&
8588 Body.get() == S->getSubStmt())
8592 return getDerived().RebuildObjCAutoreleasePoolStmt(
8593 S->getAtLoc(), Body.get());
8596template<
typename Derived>
8598TreeTransform<Derived>::TransformObjCForCollectionStmt(
8599 ObjCForCollectionStmt *S) {
8602 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
8603 if (Element.isInvalid())
8607 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
8608 if (Collection.isInvalid())
8612 StmtResult Body = getDerived().TransformStmt(S->getBody());
8613 if (Body.isInvalid())
8617 if (!getDerived().AlwaysRebuild() &&
8618 Element.get() == S->getElement() &&
8619 Collection.get() == S->getCollection() &&
8620 Body.get() == S->getBody())
8624 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
8631template <
typename Derived>
8632StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
8634 VarDecl *Var =
nullptr;
8635 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
8637 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
8641 Var = getDerived().RebuildExceptionDecl(
8642 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
8643 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
8644 if (!Var || Var->isInvalidDecl())
8649 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
8650 if (Handler.isInvalid())
8653 if (!getDerived().AlwaysRebuild() && !Var &&
8654 Handler.get() == S->getHandlerBlock())
8657 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
8660template <
typename Derived>
8661StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
8663 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
8664 if (TryBlock.isInvalid())
8668 bool HandlerChanged =
false;
8670 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
8671 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
8672 if (Handler.isInvalid())
8675 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
8676 Handlers.push_back(Handler.getAs<Stmt>());
8679 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
8683 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
8687template<
typename Derived>
8689TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
8690 EnterExpressionEvaluationContext ForRangeInitContext(
8698 auto &LastRecord = getSema().ExprEvalContexts.back();
8699 LastRecord.InLifetimeExtendingContext =
true;
8703 LastRecord.InMaterializeTemporaryObjectContext =
true;
8706 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
8707 if (
Init.isInvalid())
8711 if (
Range.isInvalid())
8716 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
8717 auto ForRangeLifetimeExtendTemps =
8718 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
8723 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
8724 if (End.isInvalid())
8727 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8728 if (Cond.isInvalid())
8732 if (Cond.isInvalid())
8738 if (
Inc.isInvalid())
8743 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
8744 if (LoopVar.isInvalid())
8748 if (getDerived().AlwaysRebuild() ||
8749 Init.get() != S->getInit() ||
8750 Range.get() != S->getRangeStmt() ||
8751 Begin.get() != S->getBeginStmt() ||
8752 End.get() != S->getEndStmt() ||
8753 Cond.get() != S->getCond() ||
8754 Inc.get() != S->getInc() ||
8755 LoopVar.get() != S->getLoopVarStmt()) {
8756 NewStmt = getDerived().RebuildCXXForRangeStmt(
8757 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8759 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8760 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
8763 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
8768 StmtResult Body = getDerived().TransformStmt(S->getBody());
8769 if (Body.isInvalid())
8774 if (Body.get() != S->getBody() && NewStmt.get() == S) {
8775 NewStmt = getDerived().RebuildCXXForRangeStmt(
8776 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
8778 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
8779 if (NewStmt.isInvalid())
8783 if (NewStmt.get() == S)
8786 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
8789template<
typename Derived>
8791TreeTransform<Derived>::TransformMSDependentExistsStmt(
8792 MSDependentExistsStmt *S) {
8794 NestedNameSpecifierLoc QualifierLoc;
8795 if (S->getQualifierLoc()) {
8797 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
8803 DeclarationNameInfo NameInfo = S->getNameInfo();
8804 if (NameInfo.getName()) {
8805 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
8806 if (!NameInfo.getName())
8811 if (!getDerived().AlwaysRebuild() &&
8812 QualifierLoc == S->getQualifierLoc() &&
8813 NameInfo.getName() == S->getNameInfo().getName())
8818 SS.Adopt(QualifierLoc);
8819 bool Dependent =
false;
8820 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
8822 if (S->isIfExists())
8825 return new (getSema().Context) NullStmt(S->getKeywordLoc());
8828 if (S->isIfNotExists())
8831 return new (getSema().Context) NullStmt(S->getKeywordLoc());
8842 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
8843 if (SubStmt.isInvalid())
8851 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
8858template<
typename Derived>
8860TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *E) {
8861 NestedNameSpecifierLoc QualifierLoc;
8862 if (E->getQualifierLoc()) {
8864 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
8869 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
8870 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
8875 if (
Base.isInvalid())
8879 MSPropertyRefExpr(
Base.get(), PD, E->isArrow(),
8881 QualifierLoc, E->getMemberLoc());
8884template <
typename Derived>
8885ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
8886 MSPropertySubscriptExpr *E) {
8887 auto BaseRes = getDerived().TransformExpr(E->getBase());
8888 if (BaseRes.isInvalid())
8890 auto IdxRes = getDerived().TransformExpr(E->getIdx());
8891 if (IdxRes.isInvalid())
8894 if (!getDerived().AlwaysRebuild() &&
8895 BaseRes.get() == E->getBase() &&
8896 IdxRes.get() == E->getIdx())
8899 return getDerived().RebuildArraySubscriptExpr(
8900 BaseRes.get(), SourceLocation(), IdxRes.get(), E->getRBracketLoc());
8903template <
typename Derived>
8904StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
8905 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
8906 if (TryBlock.isInvalid())
8909 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
8910 if (Handler.isInvalid())
8913 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
8914 Handler.get() == S->getHandler())
8917 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
8918 TryBlock.get(), Handler.get());
8921template <
typename Derived>
8922StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
8924 if (
Block.isInvalid())
8927 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
8930template <
typename Derived>
8931StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
8932 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
8933 if (FilterExpr.isInvalid())
8937 if (
Block.isInvalid())
8940 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
8944template <
typename Derived>
8946 if (isa<SEHFinallyStmt>(Handler))
8947 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
8949 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
8952template<
typename Derived>
8962template <
typename Derived>
8964TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
8968 return getDerived().TransformStmt(L->getLoopStmt());
8971template <
typename Derived>
8978 TClauses.reserve(Clauses.size());
8982 getDerived().getSema().StartOpenMPClause((*I)->getClauseKind());
8983 OMPClause *Clause = getDerived().TransformOMPClause(*I);
8984 getDerived().getSema().EndOpenMPClause();
8986 TClauses.push_back(Clause);
8988 TClauses.push_back(
nullptr);
9006 Body = getDerived().TransformStmt(CS);
9008 getSema().getLangOpts().OpenMPIRBuilder)
9009 Body = getDerived().RebuildOMPCanonicalLoop(Body.
get());
9012 getDerived().getSema().ActOnOpenMPRegionEnd(Body, TClauses);
9017 if (TClauses.size() != Clauses.size()) {
9024 DirName = cast<OMPCriticalDirective>(D)->getDirectiveName();
9025 DirName = getDerived().TransformDeclarationNameInfo(DirName);
9029 CancelRegion = cast<OMPCancellationPointDirective>(D)->getCancelRegion();
9031 CancelRegion = cast<OMPCancelDirective>(D)->getCancelRegion();
9034 return getDerived().RebuildOMPExecutableDirective(
9040template <
typename Derived>
9044 SemaRef.
Diag(D->
getBeginLoc(), diag::err_omp_instantiation_not_supported)
9049template <
typename Derived>
9051TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9052 DeclarationNameInfo DirName;
9053 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel, DirName,
nullptr,
9055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9056 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9060template <
typename Derived>
9062TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *D) {
9063 DeclarationNameInfo DirName;
9064 getDerived().getSema().StartOpenMPDSABlock(OMPD_simd, DirName,
nullptr,
9066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9067 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9071template <
typename Derived>
9073TreeTransform<Derived>::TransformOMPTileDirective(OMPTileDirective *D) {
9074 DeclarationNameInfo DirName;
9075 getDerived().getSema().StartOpenMPDSABlock(D->getDirectiveKind(), DirName,
9076 nullptr, D->getBeginLoc());
9077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9078 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9082template <
typename Derived>
9084TreeTransform<Derived>::TransformOMPUnrollDirective(OMPUnrollDirective *D) {
9085 DeclarationNameInfo DirName;
9086 getDerived().getSema().StartOpenMPDSABlock(D->getDirectiveKind(), DirName,
9087 nullptr, D->getBeginLoc());
9088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9089 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9093template <
typename Derived>
9095TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *D) {
9096 DeclarationNameInfo DirName;
9097 getDerived().getSema().StartOpenMPDSABlock(OMPD_for, DirName,
nullptr,
9099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9100 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9104template <
typename Derived>
9106TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *D) {
9107 DeclarationNameInfo DirName;
9108 getDerived().getSema().StartOpenMPDSABlock(OMPD_for_simd, DirName,
nullptr,
9110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9111 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9115template <
typename Derived>
9117TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *D) {
9118 DeclarationNameInfo DirName;
9119 getDerived().getSema().StartOpenMPDSABlock(OMPD_sections, DirName,
nullptr,
9121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9122 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9126template <
typename Derived>
9128TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *D) {
9129 DeclarationNameInfo DirName;
9130 getDerived().getSema().StartOpenMPDSABlock(OMPD_section, DirName,
nullptr,
9132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9133 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9137template <
typename Derived>
9139TreeTransform<Derived>::TransformOMPScopeDirective(OMPScopeDirective *D) {
9140 DeclarationNameInfo DirName;
9141 getDerived().getSema().StartOpenMPDSABlock(OMPD_scope, DirName,
nullptr,
9143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9144 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9148template <
typename Derived>
9150TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *D) {
9151 DeclarationNameInfo DirName;
9152 getDerived().getSema().StartOpenMPDSABlock(OMPD_single, DirName,
nullptr,
9154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9155 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9159template <
typename Derived>
9161TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *D) {
9162 DeclarationNameInfo DirName;
9163 getDerived().getSema().StartOpenMPDSABlock(OMPD_master, DirName,
nullptr,
9165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9166 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9170template <
typename Derived>
9172TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *D) {
9173 getDerived().getSema().StartOpenMPDSABlock(
9174 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9175 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9176 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9180template <
typename Derived>
9181StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
9182 OMPParallelForDirective *D) {
9183 DeclarationNameInfo DirName;
9184 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for, DirName,
9185 nullptr, D->getBeginLoc());
9186 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9187 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9191template <
typename Derived>
9192StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
9193 OMPParallelForSimdDirective *D) {
9194 DeclarationNameInfo DirName;
9195 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for_simd, DirName,
9196 nullptr, D->getBeginLoc());
9197 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9198 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9202template <
typename Derived>
9203StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
9204 OMPParallelMasterDirective *D) {
9205 DeclarationNameInfo DirName;
9206 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_master, DirName,
9207 nullptr, D->getBeginLoc());
9208 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9209 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9213template <
typename Derived>
9214StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedDirective(
9215 OMPParallelMaskedDirective *D) {
9216 DeclarationNameInfo DirName;
9217 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_masked, DirName,
9218 nullptr, D->getBeginLoc());
9219 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9220 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9224template <
typename Derived>
9225StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
9226 OMPParallelSectionsDirective *D) {
9227 DeclarationNameInfo DirName;
9228 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_sections, DirName,
9229 nullptr, D->getBeginLoc());
9230 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9231 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9235template <
typename Derived>
9237TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *D) {
9238 DeclarationNameInfo DirName;
9239 getDerived().getSema().StartOpenMPDSABlock(OMPD_task, DirName,
nullptr,
9241 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9242 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9246template <
typename Derived>
9247StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
9248 OMPTaskyieldDirective *D) {
9249 DeclarationNameInfo DirName;
9250 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskyield, DirName,
nullptr,
9252 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9253 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9257template <
typename Derived>
9259TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *D) {
9260 DeclarationNameInfo DirName;
9261 getDerived().getSema().StartOpenMPDSABlock(OMPD_barrier, DirName,
nullptr,
9263 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9264 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9268template <
typename Derived>
9270TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
9271 DeclarationNameInfo DirName;
9272 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskwait, DirName,
nullptr,
9274 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9275 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9279template <
typename Derived>
9281TreeTransform<Derived>::TransformOMPErrorDirective(OMPErrorDirective *D) {
9282 DeclarationNameInfo DirName;
9283 getDerived().getSema().StartOpenMPDSABlock(OMPD_error, DirName,
nullptr,
9285 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9286 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9290template <
typename Derived>
9291StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
9292 OMPTaskgroupDirective *D) {
9293 DeclarationNameInfo DirName;
9294 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskgroup, DirName,
nullptr,
9296 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9297 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9301template <
typename Derived>
9303TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *D) {
9304 DeclarationNameInfo DirName;
9305 getDerived().getSema().StartOpenMPDSABlock(OMPD_flush, DirName,
nullptr,
9307 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9308 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9312template <
typename Derived>
9314TreeTransform<Derived>::TransformOMPDepobjDirective(OMPDepobjDirective *D) {
9315 DeclarationNameInfo DirName;
9316 getDerived().getSema().StartOpenMPDSABlock(OMPD_depobj, DirName,
nullptr,
9318 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9319 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9323template <
typename Derived>
9325TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *D) {
9326 DeclarationNameInfo DirName;
9327 getDerived().getSema().StartOpenMPDSABlock(OMPD_scan, DirName,
nullptr,
9329 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9330 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9334template <
typename Derived>
9336TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *D) {
9337 DeclarationNameInfo DirName;
9338 getDerived().getSema().StartOpenMPDSABlock(OMPD_ordered, DirName,
nullptr,
9340 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9341 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9345template <
typename Derived>
9347TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *D) {
9348 DeclarationNameInfo DirName;
9349 getDerived().getSema().StartOpenMPDSABlock(OMPD_atomic, DirName,
nullptr,
9351 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9352 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9356template <
typename Derived>
9358TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *D) {
9359 DeclarationNameInfo DirName;
9360 getDerived().getSema().StartOpenMPDSABlock(OMPD_target, DirName,
nullptr,
9362 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9363 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9367template <
typename Derived>
9368StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
9369 OMPTargetDataDirective *D) {
9370 DeclarationNameInfo DirName;
9371 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_data, DirName,
nullptr,
9373 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9374 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9378template <
typename Derived>
9379StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
9380 OMPTargetEnterDataDirective *D) {
9381 DeclarationNameInfo DirName;
9382 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_enter_data, DirName,
9383 nullptr, D->getBeginLoc());
9384 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9385 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9389template <
typename Derived>
9390StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
9391 OMPTargetExitDataDirective *D) {
9392 DeclarationNameInfo DirName;
9393 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_exit_data, DirName,
9394 nullptr, D->getBeginLoc());
9395 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9396 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9400template <
typename Derived>
9401StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
9402 OMPTargetParallelDirective *D) {
9403 DeclarationNameInfo DirName;
9404 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel, DirName,
9405 nullptr, D->getBeginLoc());
9406 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9407 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9411template <
typename Derived>
9412StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
9413 OMPTargetParallelForDirective *D) {
9414 DeclarationNameInfo DirName;
9415 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for, DirName,
9416 nullptr, D->getBeginLoc());
9417 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9418 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9422template <
typename Derived>
9423StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
9424 OMPTargetUpdateDirective *D) {
9425 DeclarationNameInfo DirName;
9426 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_update, DirName,
9427 nullptr, D->getBeginLoc());
9428 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9429 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9433template <
typename Derived>
9435TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *D) {
9436 DeclarationNameInfo DirName;
9437 getDerived().getSema().StartOpenMPDSABlock(OMPD_teams, DirName,
nullptr,
9439 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9440 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9444template <
typename Derived>
9445StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
9446 OMPCancellationPointDirective *D) {
9447 DeclarationNameInfo DirName;
9448 getDerived().getSema().StartOpenMPDSABlock(OMPD_cancellation_point, DirName,
9449 nullptr, D->getBeginLoc());
9450 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9451 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9455template <
typename Derived>
9457TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *D) {
9458 DeclarationNameInfo DirName;
9459 getDerived().getSema().StartOpenMPDSABlock(OMPD_cancel, DirName,
nullptr,
9461 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9462 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9466template <
typename Derived>
9468TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
9469 DeclarationNameInfo DirName;
9470 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop, DirName,
nullptr,
9472 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9473 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9477template <
typename Derived>
9478StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
9479 OMPTaskLoopSimdDirective *D) {
9480 DeclarationNameInfo DirName;
9481 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop_simd, DirName,
9482 nullptr, D->getBeginLoc());
9483 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9484 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9488template <
typename Derived>
9489StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
9490 OMPMasterTaskLoopDirective *D) {
9491 DeclarationNameInfo DirName;
9492 getDerived().getSema().StartOpenMPDSABlock(OMPD_master_taskloop, DirName,
9493 nullptr, D->getBeginLoc());
9494 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9495 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9499template <
typename Derived>
9500StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopDirective(
9501 OMPMaskedTaskLoopDirective *D) {
9502 DeclarationNameInfo DirName;
9503 getDerived().getSema().StartOpenMPDSABlock(OMPD_masked_taskloop, DirName,
9504 nullptr, D->getBeginLoc());
9505 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9506 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9510template <
typename Derived>
9511StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
9512 OMPMasterTaskLoopSimdDirective *D) {
9513 DeclarationNameInfo DirName;
9514 getDerived().getSema().StartOpenMPDSABlock(OMPD_master_taskloop_simd, DirName,
9515 nullptr, D->getBeginLoc());
9516 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9517 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9521template <
typename Derived>
9522StmtResult TreeTransform<Derived>::TransformOMPMaskedTaskLoopSimdDirective(
9523 OMPMaskedTaskLoopSimdDirective *D) {
9524 DeclarationNameInfo DirName;
9525 getDerived().getSema().StartOpenMPDSABlock(OMPD_masked_taskloop_simd, DirName,
9526 nullptr, D->getBeginLoc());
9527 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9528 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9532template <
typename Derived>
9533StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
9534 OMPParallelMasterTaskLoopDirective *D) {
9535 DeclarationNameInfo DirName;
9536 getDerived().getSema().StartOpenMPDSABlock(
9537 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
9538 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9539 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9543template <
typename Derived>
9544StmtResult TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopDirective(
9545 OMPParallelMaskedTaskLoopDirective *D) {
9546 DeclarationNameInfo DirName;
9547 getDerived().getSema().StartOpenMPDSABlock(
9548 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
9549 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9550 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9554template <
typename Derived>
9556TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
9557 OMPParallelMasterTaskLoopSimdDirective *D) {
9558 DeclarationNameInfo DirName;
9559 getDerived().getSema().StartOpenMPDSABlock(
9560 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9561 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9562 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9566template <
typename Derived>
9568TreeTransform<Derived>::TransformOMPParallelMaskedTaskLoopSimdDirective(
9569 OMPParallelMaskedTaskLoopSimdDirective *D) {
9570 DeclarationNameInfo DirName;
9571 getDerived().getSema().StartOpenMPDSABlock(
9572 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
9573 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9574 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9578template <
typename Derived>
9579StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
9580 OMPDistributeDirective *D) {
9581 DeclarationNameInfo DirName;
9582 getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute, DirName,
nullptr,
9584 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9585 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9589template <
typename Derived>
9590StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
9591 OMPDistributeParallelForDirective *D) {
9592 DeclarationNameInfo DirName;
9593 getDerived().getSema().StartOpenMPDSABlock(
9594 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
9595 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9596 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9600template <
typename Derived>
9602TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
9603 OMPDistributeParallelForSimdDirective *D) {
9604 DeclarationNameInfo DirName;
9605 getDerived().getSema().StartOpenMPDSABlock(
9606 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9607 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9608 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9612template <
typename Derived>
9613StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
9614 OMPDistributeSimdDirective *D) {
9615 DeclarationNameInfo DirName;
9616 getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute_simd, DirName,
9617 nullptr, D->getBeginLoc());
9618 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9619 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9623template <
typename Derived>
9624StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
9625 OMPTargetParallelForSimdDirective *D) {
9626 DeclarationNameInfo DirName;
9627 getDerived().getSema().StartOpenMPDSABlock(
9628 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9629 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9630 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9634template <
typename Derived>
9635StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
9636 OMPTargetSimdDirective *D) {
9637 DeclarationNameInfo DirName;
9638 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_simd, DirName,
nullptr,
9640 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9641 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9645template <
typename Derived>
9646StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
9647 OMPTeamsDistributeDirective *D) {
9648 DeclarationNameInfo DirName;
9649 getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute, DirName,
9650 nullptr, D->getBeginLoc());
9651 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9652 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9656template <
typename Derived>
9657StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
9658 OMPTeamsDistributeSimdDirective *D) {
9659 DeclarationNameInfo DirName;
9660 getDerived().getSema().StartOpenMPDSABlock(
9661 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
9662 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9663 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9667template <
typename Derived>
9668StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
9669 OMPTeamsDistributeParallelForSimdDirective *D) {
9670 DeclarationNameInfo DirName;
9671 getDerived().getSema().StartOpenMPDSABlock(
9672 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
9674 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9675 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9679template <
typename Derived>
9680StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
9681 OMPTeamsDistributeParallelForDirective *D) {
9682 DeclarationNameInfo DirName;
9683 getDerived().getSema().StartOpenMPDSABlock(
9684 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
9685 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9686 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9690template <
typename Derived>
9691StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
9692 OMPTargetTeamsDirective *D) {
9693 DeclarationNameInfo DirName;
9694 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams, DirName,
9695 nullptr, D->getBeginLoc());
9696 auto Res = getDerived().TransformOMPExecutableDirective(D);
9697 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9701template <
typename Derived>
9702StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
9703 OMPTargetTeamsDistributeDirective *D) {
9704 DeclarationNameInfo DirName;
9705 getDerived().getSema().StartOpenMPDSABlock(
9706 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
9707 auto Res = getDerived().TransformOMPExecutableDirective(D);
9708 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9712template <
typename Derived>
9714TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
9715 OMPTargetTeamsDistributeParallelForDirective *D) {
9716 DeclarationNameInfo DirName;
9717 getDerived().getSema().StartOpenMPDSABlock(
9718 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
9720 auto Res = getDerived().TransformOMPExecutableDirective(D);
9721 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9725template <
typename Derived>
9727 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
9728 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
9729 DeclarationNameInfo DirName;
9730 getDerived().getSema().StartOpenMPDSABlock(
9731 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
9733 auto Res = getDerived().TransformOMPExecutableDirective(D);
9734 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9738template <
typename Derived>
9740TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
9741 OMPTargetTeamsDistributeSimdDirective *D) {
9742 DeclarationNameInfo DirName;
9743 getDerived().getSema().StartOpenMPDSABlock(
9744 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
9745 auto Res = getDerived().TransformOMPExecutableDirective(D);
9746 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9750template <
typename Derived>
9752TreeTransform<Derived>::TransformOMPInteropDirective(OMPInteropDirective *D) {
9753 DeclarationNameInfo DirName;
9754 getDerived().getSema().StartOpenMPDSABlock(OMPD_interop, DirName,
nullptr,
9756 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9757 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9761template <
typename Derived>
9763TreeTransform<Derived>::TransformOMPDispatchDirective(OMPDispatchDirective *D) {
9764 DeclarationNameInfo DirName;
9765 getDerived().getSema().StartOpenMPDSABlock(OMPD_dispatch, DirName,
nullptr,
9767 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9768 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9772template <
typename Derived>
9774TreeTransform<Derived>::TransformOMPMaskedDirective(OMPMaskedDirective *D) {
9775 DeclarationNameInfo DirName;
9776 getDerived().getSema().StartOpenMPDSABlock(OMPD_masked, DirName,
nullptr,
9778 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9779 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9783template <
typename Derived>
9784StmtResult TreeTransform<Derived>::TransformOMPGenericLoopDirective(
9785 OMPGenericLoopDirective *D) {
9786 DeclarationNameInfo DirName;
9787 getDerived().getSema().StartOpenMPDSABlock(OMPD_loop, DirName,
nullptr,
9789 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9790 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9794template <
typename Derived>
9795StmtResult TreeTransform<Derived>::TransformOMPTeamsGenericLoopDirective(
9796 OMPTeamsGenericLoopDirective *D) {
9797 DeclarationNameInfo DirName;
9798 getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_loop, DirName,
nullptr,
9800 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9801 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9805template <
typename Derived>
9806StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsGenericLoopDirective(
9807 OMPTargetTeamsGenericLoopDirective *D) {
9808 DeclarationNameInfo DirName;
9809 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams_loop, DirName,
9810 nullptr, D->getBeginLoc());
9811 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9812 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9816template <
typename Derived>
9817StmtResult TreeTransform<Derived>::TransformOMPParallelGenericLoopDirective(
9818 OMPParallelGenericLoopDirective *D) {
9819 DeclarationNameInfo DirName;
9820 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_loop, DirName,
9821 nullptr, D->getBeginLoc());
9822 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9823 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9827template <
typename Derived>
9829TreeTransform<Derived>::TransformOMPTargetParallelGenericLoopDirective(
9830 OMPTargetParallelGenericLoopDirective *D) {
9831 DeclarationNameInfo DirName;
9832 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_loop, DirName,
9833 nullptr, D->getBeginLoc());
9834 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9835 getDerived().getSema().EndOpenMPDSABlock(Res.get());
9842template <
typename Derived>
9843OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *
C) {
9844 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
9845 if (Cond.isInvalid())
9847 return getDerived().RebuildOMPIfClause(
9848 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
9849 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
9852template <
typename Derived>
9853OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *
C) {
9854 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
9855 if (Cond.isInvalid())
9857 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
9858 C->getLParenLoc(),
C->getEndLoc());
9861template <
typename Derived>
9863TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *
C) {
9864 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
9865 if (NumThreads.isInvalid())
9867 return getDerived().RebuildOMPNumThreadsClause(
9868 NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9871template <
typename Derived>
9873TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *
C) {
9874 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
9877 return getDerived().RebuildOMPSafelenClause(
9878 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9881template <
typename Derived>
9883TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *
C) {
9884 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
9887 return getDerived().RebuildOMPAllocatorClause(
9888 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9891template <
typename Derived>
9893TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *
C) {
9894 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
9897 return getDerived().RebuildOMPSimdlenClause(
9898 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9901template <
typename Derived>
9902OMPClause *TreeTransform<Derived>::TransformOMPSizesClause(OMPSizesClause *
C) {
9904 TransformedSizes.reserve(
C->getNumSizes());
9906 for (Expr *E :
C->getSizesRefs()) {
9908 TransformedSizes.push_back(
nullptr);
9912 ExprResult T = getDerived().TransformExpr(E);
9917 TransformedSizes.push_back(T.get());
9920 if (!Changed && !getDerived().AlwaysRebuild())
9922 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
9923 C->getLParenLoc(),
C->getEndLoc());
9926template <
typename Derived>
9927OMPClause *TreeTransform<Derived>::TransformOMPFullClause(OMPFullClause *
C) {
9928 if (!getDerived().AlwaysRebuild())
9930 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
9933template <
typename Derived>
9935TreeTransform<Derived>::TransformOMPPartialClause(OMPPartialClause *
C) {
9936 ExprResult T = getDerived().TransformExpr(
C->getFactor());
9939 Expr *Factor = T.
get();
9940 bool Changed = Factor !=
C->getFactor();
9942 if (!Changed && !getDerived().AlwaysRebuild())
9944 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
9948template <
typename Derived>
9950TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *
C) {
9951 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
9954 return getDerived().RebuildOMPCollapseClause(
9955 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
9958template <
typename Derived>
9960TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *
C) {
9961 return getDerived().RebuildOMPDefaultClause(
9962 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getBeginLoc(),
9963 C->getLParenLoc(),
C->getEndLoc());
9966template <
typename Derived>
9968TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *
C) {
9969 return getDerived().RebuildOMPProcBindClause(
9970 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
9971 C->getLParenLoc(),
C->getEndLoc());
9974template <
typename Derived>
9976TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *
C) {
9977 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
9980 return getDerived().RebuildOMPScheduleClause(
9981 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
9982 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
9983 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
9984 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
9987template <
typename Derived>
9989TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *
C) {
9991 if (
auto *Num =
C->getNumForLoops()) {
9992 E = getDerived().TransformExpr(Num);
9996 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
9997 C->getLParenLoc(), E.get());
10000template <
typename Derived>
10002TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *
C) {
10004 if (Expr *Evt =
C->getEventHandler()) {
10005 E = getDerived().TransformExpr(Evt);
10009 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10010 C->getLParenLoc(),
C->getEndLoc());
10013template <
typename Derived>
10015TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *
C) {
10020template <
typename Derived>
10022TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *
C) {
10027template <
typename Derived>
10029TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *
C) {
10034template <
typename Derived>
10035OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *
C) {
10040template <
typename Derived>
10041OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *
C) {
10046template <
typename Derived>
10048TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *
C) {
10053template <
typename Derived>
10055TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *
C) {
10060template <
typename Derived>
10062TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *
C) {
10067template <
typename Derived>
10068OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *
C) {
10073template <
typename Derived>
10075TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *
C) {
10080template <
typename Derived>
10082TreeTransform<Derived>::TransformOMPAcqRelClause(OMPAcqRelClause *
C) {
10087template <
typename Derived>
10089TreeTransform<Derived>::TransformOMPAcquireClause(OMPAcquireClause *
C) {
10094template <
typename Derived>
10096TreeTransform<Derived>::TransformOMPReleaseClause(OMPReleaseClause *
C) {
10101template <
typename Derived>
10103TreeTransform<Derived>::TransformOMPRelaxedClause(OMPRelaxedClause *
C) {
10108template <
typename Derived>
10109OMPClause *TreeTransform<Derived>::TransformOMPWeakClause(OMPWeakClause *
C) {
10114template <
typename Derived>
10116TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *
C) {
10121template <
typename Derived>
10122OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *
C) {
10127template <
typename Derived>
10129TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *
C) {
10134template <
typename Derived>
10135OMPClause *TreeTransform<Derived>::TransformOMPInitClause(OMPInitClause *
C) {
10136 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10137 if (IVR.isInvalid())
10140 OMPInteropInfo InteropInfo(
C->getIsTarget(),
C->getIsTargetSync());
10141 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10142 for (Expr *E : llvm::drop_begin(
C->varlists())) {
10143 ExprResult ER = getDerived().TransformExpr(cast<Expr>(E));
10144 if (ER.isInvalid())
10146 InteropInfo.PreferTypes.push_back(ER.get());
10148 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10149 C->getBeginLoc(),
C->getLParenLoc(),
10150 C->getVarLoc(),
C->getEndLoc());
10153template <
typename Derived>
10154OMPClause *TreeTransform<Derived>::TransformOMPUseClause(OMPUseClause *
C) {
10155 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10156 if (ER.isInvalid())
10158 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10159 C->getLParenLoc(),
C->getVarLoc(),
10163template <
typename Derived>
10165TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *
C) {
10167 if (Expr *IV =
C->getInteropVar()) {
10168 ER = getDerived().TransformExpr(IV);
10169 if (ER.isInvalid())
10172 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10173 C->getLParenLoc(),
C->getVarLoc(),
10177template <
typename Derived>
10179TreeTransform<Derived>::TransformOMPNovariantsClause(OMPNovariantsClause *
C) {
10180 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10181 if (Cond.isInvalid())
10183 return getDerived().RebuildOMPNovariantsClause(
10184 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10187template <
typename Derived>
10189TreeTransform<Derived>::TransformOMPNocontextClause(OMPNocontextClause *
C) {
10190 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10191 if (Cond.isInvalid())
10193 return getDerived().RebuildOMPNocontextClause(
10194 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10197template <
typename Derived>
10199TreeTransform<Derived>::TransformOMPFilterClause(OMPFilterClause *
C) {
10200 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10201 if (ThreadID.isInvalid())
10203 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10204 C->getLParenLoc(),
C->getEndLoc());
10207template <
typename Derived>
10208OMPClause *TreeTransform<Derived>::TransformOMPAlignClause(OMPAlignClause *
C) {
10209 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10212 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10213 C->getLParenLoc(),
C->getEndLoc());
10216template <
typename Derived>
10217OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
10218 OMPUnifiedAddressClause *
C) {
10219 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10222template <
typename Derived>
10223OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
10224 OMPUnifiedSharedMemoryClause *
C) {
10226 "unified_shared_memory clause cannot appear in dependent context");
10229template <
typename Derived>
10230OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
10231 OMPReverseOffloadClause *
C) {
10232 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10235template <
typename Derived>
10236OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
10237 OMPDynamicAllocatorsClause *
C) {
10239 "dynamic_allocators clause cannot appear in dependent context");
10242template <
typename Derived>
10243OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
10244 OMPAtomicDefaultMemOrderClause *
C) {
10246 "atomic_default_mem_order clause cannot appear in dependent context");
10249template <
typename Derived>
10250OMPClause *TreeTransform<Derived>::TransformOMPAtClause(OMPAtClause *
C) {
10251 return getDerived().RebuildOMPAtClause(
C->getAtKind(),
C->getAtKindKwLoc(),
10252 C->getBeginLoc(),
C->getLParenLoc(),
10256template <
typename Derived>
10258TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *
C) {
10259 return getDerived().RebuildOMPSeverityClause(
10260 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10261 C->getLParenLoc(),
C->getEndLoc());
10264template <
typename Derived>
10266TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *
C) {
10267 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10270 return getDerived().RebuildOMPMessageClause(
10271 C->getMessageString(),
C->getBeginLoc(),
C->getLParenLoc(),
10275template <
typename Derived>
10277TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *
C) {
10279 Vars.reserve(
C->varlist_size());
10280 for (
auto *VE :
C->varlists()) {
10281 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10282 if (EVar.isInvalid())
10284 Vars.push_back(EVar.get());
10286 return getDerived().RebuildOMPPrivateClause(
10287 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10290template <
typename Derived>
10291OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
10292 OMPFirstprivateClause *
C) {
10294 Vars.reserve(
C->varlist_size());
10295 for (
auto *VE :
C->varlists()) {
10296 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10297 if (EVar.isInvalid())
10299 Vars.push_back(EVar.get());
10301 return getDerived().RebuildOMPFirstprivateClause(
10302 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10305template <
typename Derived>
10307TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *
C) {
10309 Vars.reserve(
C->varlist_size());
10310 for (
auto *VE :
C->varlists()) {
10311 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10312 if (EVar.isInvalid())
10314 Vars.push_back(EVar.get());
10316 return getDerived().RebuildOMPLastprivateClause(
10317 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10318 C->getLParenLoc(),
C->getEndLoc());
10321template <
typename Derived>
10323TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *
C) {
10325 Vars.reserve(
C->varlist_size());
10326 for (
auto *VE :
C->varlists()) {
10327 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10328 if (EVar.isInvalid())
10330 Vars.push_back(EVar.get());
10332 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10333 C->getLParenLoc(),
C->getEndLoc());
10336template <
typename Derived>
10338TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *
C) {
10340 Vars.reserve(
C->varlist_size());
10341 for (
auto *VE :
C->varlists()) {
10342 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10343 if (EVar.isInvalid())
10345 Vars.push_back(EVar.get());
10347 CXXScopeSpec ReductionIdScopeSpec;
10348 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10350 DeclarationNameInfo NameInfo =
C->getNameInfo();
10351 if (NameInfo.getName()) {
10352 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10353 if (!NameInfo.getName())
10359 for (
auto *E :
C->reduction_ops()) {
10362 auto *ULE = cast<UnresolvedLookupExpr>(E);
10363 UnresolvedSet<8> Decls;
10364 for (
auto *D : ULE->decls()) {
10366 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10367 Decls.addDecl(InstD, InstD->getAccess());
10369 UnresolvedReductions.push_back(
10372 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context),
10373 NameInfo,
true, ULE->isOverloaded(),
10374 Decls.begin(), Decls.end()));
10376 UnresolvedReductions.push_back(
nullptr);
10378 return getDerived().RebuildOMPReductionClause(
10379 Vars,
C->getModifier(),
C->getBeginLoc(),
C->getLParenLoc(),
10380 C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10381 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10384template <
typename Derived>
10385OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
10386 OMPTaskReductionClause *
C) {
10388 Vars.reserve(
C->varlist_size());
10389 for (
auto *VE :
C->varlists()) {
10390 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10391 if (EVar.isInvalid())
10393 Vars.push_back(EVar.get());
10395 CXXScopeSpec ReductionIdScopeSpec;
10396 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10398 DeclarationNameInfo NameInfo =
C->getNameInfo();
10399 if (NameInfo.getName()) {
10400 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10401 if (!NameInfo.getName())
10407 for (
auto *E :
C->reduction_ops()) {
10410 auto *ULE = cast<UnresolvedLookupExpr>(E);
10411 UnresolvedSet<8> Decls;
10412 for (
auto *D : ULE->decls()) {
10414 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10415 Decls.addDecl(InstD, InstD->getAccess());
10419 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10420 true, ULE->isOverloaded(), Decls.begin(), Decls.end()));
10422 UnresolvedReductions.push_back(
nullptr);
10424 return getDerived().RebuildOMPTaskReductionClause(
10425 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10426 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10429template <
typename Derived>
10431TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *
C) {
10433 Vars.reserve(
C->varlist_size());
10434 for (
auto *VE :
C->varlists()) {
10435 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10436 if (EVar.isInvalid())
10438 Vars.push_back(EVar.get());
10440 CXXScopeSpec ReductionIdScopeSpec;
10441 ReductionIdScopeSpec.Adopt(
C->getQualifierLoc());
10443 DeclarationNameInfo NameInfo =
C->getNameInfo();
10444 if (NameInfo.getName()) {
10445 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10446 if (!NameInfo.getName())
10452 for (
auto *E :
C->reduction_ops()) {
10455 auto *ULE = cast<UnresolvedLookupExpr>(E);
10456 UnresolvedSet<8> Decls;
10457 for (
auto *D : ULE->decls()) {
10459 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10460 Decls.addDecl(InstD, InstD->getAccess());
10464 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10465 true, ULE->isOverloaded(), Decls.begin(), Decls.end()));
10467 UnresolvedReductions.push_back(
nullptr);
10469 return getDerived().RebuildOMPInReductionClause(
10470 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10471 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10474template <
typename Derived>
10476TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *
C) {
10478 Vars.reserve(
C->varlist_size());
10479 for (
auto *VE :
C->varlists()) {
10480 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10481 if (EVar.isInvalid())
10483 Vars.push_back(EVar.get());
10485 ExprResult Step = getDerived().TransformExpr(
C->getStep());
10486 if (Step.isInvalid())
10488 return getDerived().RebuildOMPLinearClause(
10489 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
10490 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
10494template <
typename Derived>
10496TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *
C) {
10498 Vars.reserve(
C->varlist_size());
10499 for (
auto *VE :
C->varlists()) {
10500 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10501 if (EVar.isInvalid())
10503 Vars.push_back(EVar.get());
10505 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
10506 if (Alignment.isInvalid())
10508 return getDerived().RebuildOMPAlignedClause(
10509 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10510 C->getColonLoc(),
C->getEndLoc());
10513template <
typename Derived>
10515TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *
C) {
10517 Vars.reserve(
C->varlist_size());
10518 for (
auto *VE :
C->varlists()) {
10519 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10520 if (EVar.isInvalid())
10522 Vars.push_back(EVar.get());
10524 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
10525 C->getLParenLoc(),
C->getEndLoc());
10528template <
typename Derived>
10530TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *
C) {
10532 Vars.reserve(
C->varlist_size());
10533 for (
auto *VE :
C->varlists()) {
10534 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10535 if (EVar.isInvalid())
10537 Vars.push_back(EVar.get());
10539 return getDerived().RebuildOMPCopyprivateClause(
10540 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10543template <
typename Derived>
10544OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *
C) {
10546 Vars.reserve(
C->varlist_size());
10547 for (
auto *VE :
C->varlists()) {
10548 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10549 if (EVar.isInvalid())
10551 Vars.push_back(EVar.get());
10553 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
10554 C->getLParenLoc(),
C->getEndLoc());
10557template <
typename Derived>
10559TreeTransform<Derived>::TransformOMPDepobjClause(OMPDepobjClause *
C) {
10560 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
10563 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
10564 C->getLParenLoc(),
C->getEndLoc());
10567template <
typename Derived>
10569TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *
C) {
10571 Expr *DepModifier =
C->getModifier();
10573 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
10574 if (DepModRes.isInvalid())
10576 DepModifier = DepModRes.
get();
10578 Vars.reserve(
C->varlist_size());
10579 for (
auto *VE :
C->varlists()) {
10580 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10581 if (EVar.isInvalid())
10583 Vars.push_back(EVar.get());
10585 return getDerived().RebuildOMPDependClause(
10586 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
10587 C->getOmpAllMemoryLoc()},
10588 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10591template <
typename Derived>
10593TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *
C) {
10594 ExprResult E = getDerived().TransformExpr(
C->getDevice());
10597 return getDerived().RebuildOMPDeviceClause(
10598 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10599 C->getModifierLoc(),
C->getEndLoc());
10602template <
typename Derived,
class T>
10609 Vars.reserve(
C->varlist_size());
10610 for (
auto *VE :
C->varlists()) {
10614 Vars.push_back(EVar.
get());
10618 if (
C->getMapperQualifierLoc()) {
10619 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
10620 C->getMapperQualifierLoc());
10624 MapperIdScopeSpec.
Adopt(QualifierLoc);
10625 MapperIdInfo =
C->getMapperIdInfo();
10626 if (MapperIdInfo.
getName()) {
10627 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
10633 for (
auto *E :
C->mapperlists()) {
10636 auto *ULE = cast<UnresolvedLookupExpr>(E);
10638 for (
auto *D : ULE->decls()) {
10640 cast<NamedDecl>(TT.
getDerived().TransformDecl(E->getExprLoc(), D));
10646 MapperIdInfo,
true, ULE->isOverloaded(), Decls.
begin(),
10649 UnresolvedMappers.push_back(
nullptr);
10655template <
typename Derived>
10656OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
10657 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10659 Expr *IteratorModifier =
C->getIteratorModifier();
10660 if (IteratorModifier) {
10661 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
10662 if (MapModRes.isInvalid())
10664 IteratorModifier = MapModRes.
get();
10666 CXXScopeSpec MapperIdScopeSpec;
10667 DeclarationNameInfo MapperIdInfo;
10669 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
10670 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10672 return getDerived().RebuildOMPMapClause(
10673 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
10674 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
10675 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10678template <
typename Derived>
10680TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *
C) {
10681 Expr *Allocator =
C->getAllocator();
10683 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
10684 if (AllocatorRes.isInvalid())
10686 Allocator = AllocatorRes.get();
10689 Vars.reserve(
C->varlist_size());
10690 for (
auto *VE :
C->varlists()) {
10691 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10692 if (EVar.isInvalid())
10694 Vars.push_back(EVar.get());
10696 return getDerived().RebuildOMPAllocateClause(
10697 Allocator, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
10701template <
typename Derived>
10703TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *
C) {
10704 ExprResult E = getDerived().TransformExpr(
C->getNumTeams());
10707 return getDerived().RebuildOMPNumTeamsClause(
10708 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10711template <
typename Derived>
10713TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *
C) {
10714 ExprResult E = getDerived().TransformExpr(
C->getThreadLimit());
10717 return getDerived().RebuildOMPThreadLimitClause(
10718 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10721template <
typename Derived>
10723TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *
C) {
10724 ExprResult E = getDerived().TransformExpr(
C->getPriority());
10727 return getDerived().RebuildOMPPriorityClause(
10728 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10731template <
typename Derived>
10733TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *
C) {
10734 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
10737 return getDerived().RebuildOMPGrainsizeClause(
10738 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10739 C->getModifierLoc(),
C->getEndLoc());
10742template <
typename Derived>
10744TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *
C) {
10745 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
10748 return getDerived().RebuildOMPNumTasksClause(
10749 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10750 C->getModifierLoc(),
C->getEndLoc());
10753template <
typename Derived>
10754OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *
C) {
10755 ExprResult E = getDerived().TransformExpr(
C->getHint());
10758 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
10759 C->getLParenLoc(),
C->getEndLoc());
10762template <
typename Derived>
10763OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
10764 OMPDistScheduleClause *
C) {
10765 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10768 return getDerived().RebuildOMPDistScheduleClause(
10769 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10770 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10773template <
typename Derived>
10775TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *
C) {
10778 return getDerived().RebuildOMPDefaultmapClause(
C->getDefaultmapModifier(),
10779 C->getDefaultmapKind(),
10782 C->getDefaultmapModifierLoc(),
10783 C->getDefaultmapKindLoc(),
10787template <
typename Derived>
10788OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *
C) {
10789 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10791 CXXScopeSpec MapperIdScopeSpec;
10792 DeclarationNameInfo MapperIdInfo;
10794 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
10795 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10797 return getDerived().RebuildOMPToClause(
10798 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
10799 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10802template <
typename Derived>
10803OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *
C) {
10804 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10806 CXXScopeSpec MapperIdScopeSpec;
10807 DeclarationNameInfo MapperIdInfo;
10809 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
10810 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
10812 return getDerived().RebuildOMPFromClause(
10813 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
10814 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
10817template <
typename Derived>
10818OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
10819 OMPUseDevicePtrClause *
C) {
10821 Vars.reserve(
C->varlist_size());
10822 for (
auto *VE :
C->varlists()) {
10823 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10824 if (EVar.isInvalid())
10826 Vars.push_back(EVar.get());
10828 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10829 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
10832template <
typename Derived>
10833OMPClause *TreeTransform<Derived>::TransformOMPUseDeviceAddrClause(
10834 OMPUseDeviceAddrClause *
C) {
10836 Vars.reserve(
C->varlist_size());
10837 for (
auto *VE :
C->varlists()) {
10838 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10839 if (EVar.isInvalid())
10841 Vars.push_back(EVar.get());
10843 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10844 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
10847template <
typename Derived>
10849TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *
C) {
10851 Vars.reserve(
C->varlist_size());
10852 for (
auto *VE :
C->varlists()) {
10853 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10854 if (EVar.isInvalid())
10856 Vars.push_back(EVar.get());
10858 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10859 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
10862template <
typename Derived>
10863OMPClause *TreeTransform<Derived>::TransformOMPHasDeviceAddrClause(
10864 OMPHasDeviceAddrClause *
C) {
10866 Vars.reserve(
C->varlist_size());
10867 for (
auto *VE :
C->varlists()) {
10868 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10869 if (EVar.isInvalid())
10871 Vars.push_back(EVar.get());
10873 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10874 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
10877template <
typename Derived>
10879TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *
C) {
10881 Vars.reserve(
C->varlist_size());
10882 for (
auto *VE :
C->varlists()) {
10883 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10884 if (EVar.isInvalid())
10886 Vars.push_back(EVar.get());
10888 return getDerived().RebuildOMPNontemporalClause(
10889 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10892template <
typename Derived>
10894TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *
C) {
10896 Vars.reserve(
C->varlist_size());
10897 for (
auto *VE :
C->varlists()) {
10898 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10899 if (EVar.isInvalid())
10901 Vars.push_back(EVar.get());
10903 return getDerived().RebuildOMPInclusiveClause(
10904 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10907template <
typename Derived>
10909TreeTransform<Derived>::TransformOMPExclusiveClause(OMPExclusiveClause *
C) {
10911 Vars.reserve(
C->varlist_size());
10912 for (
auto *VE :
C->varlists()) {
10913 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
10914 if (EVar.isInvalid())
10916 Vars.push_back(EVar.get());
10918 return getDerived().RebuildOMPExclusiveClause(
10919 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10922template <
typename Derived>
10923OMPClause *TreeTransform<Derived>::TransformOMPUsesAllocatorsClause(
10924 OMPUsesAllocatorsClause *
C) {
10926 Data.reserve(
C->getNumberOfAllocators());
10927 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
10928 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
10929 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
10930 if (Allocator.isInvalid())
10933 if (Expr *AT = D.AllocatorTraits) {
10934 AllocatorTraits = getDerived().TransformExpr(AT);
10935 if (AllocatorTraits.isInvalid())
10938 Sema::UsesAllocatorsData &NewD =
Data.emplace_back();
10939 NewD.Allocator = Allocator.get();
10940 NewD.AllocatorTraits = AllocatorTraits.get();
10941 NewD.LParenLoc = D.LParenLoc;
10942 NewD.RParenLoc = D.RParenLoc;
10944 return getDerived().RebuildOMPUsesAllocatorsClause(
10945 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10948template <
typename Derived>
10950TreeTransform<Derived>::TransformOMPAffinityClause(OMPAffinityClause *
C) {
10952 Locators.reserve(
C->varlist_size());
10954 if (Expr *Modifier =
C->getModifier()) {
10955 ModifierRes = getDerived().TransformExpr(Modifier);
10956 if (ModifierRes.isInvalid())
10959 for (Expr *E :
C->varlists()) {
10960 ExprResult Locator = getDerived().TransformExpr(E);
10961 if (Locator.isInvalid())
10963 Locators.push_back(Locator.get());
10965 return getDerived().RebuildOMPAffinityClause(
10966 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
10967 ModifierRes.get(), Locators);
10970template <
typename Derived>
10971OMPClause *TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *
C) {
10972 return getDerived().RebuildOMPOrderClause(
10973 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10974 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
10977template <
typename Derived>
10978OMPClause *TreeTransform<Derived>::TransformOMPBindClause(OMPBindClause *
C) {
10979 return getDerived().RebuildOMPBindClause(
10980 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
10981 C->getLParenLoc(),
C->getEndLoc());
10984template <
typename Derived>
10985OMPClause *TreeTransform<Derived>::TransformOMPXDynCGroupMemClause(
10986 OMPXDynCGroupMemClause *
C) {
10988 if (
Size.isInvalid())
10990 return getDerived().RebuildOMPXDynCGroupMemClause(
10991 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10994template <
typename Derived>
10996TreeTransform<Derived>::TransformOMPDoacrossClause(OMPDoacrossClause *
C) {
10998 Vars.reserve(
C->varlist_size());
10999 for (
auto *VE :
C->varlists()) {
11000 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
11001 if (EVar.isInvalid())
11003 Vars.push_back(EVar.get());
11005 return getDerived().RebuildOMPDoacrossClause(
11006 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11007 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11010template <
typename Derived>
11012TreeTransform<Derived>::TransformOMPXAttributeClause(OMPXAttributeClause *
C) {
11014 for (
auto *A :
C->getAttrs())
11015 NewAttrs.push_back(getDerived().TransformAttr(A));
11016 return getDerived().RebuildOMPXAttributeClause(
11017 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11020template <
typename Derived>
11021OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *
C) {
11022 return getDerived().RebuildOMPXBareClause(
C->getBeginLoc(),
C->getEndLoc());
11028template <
typename Derived>
11029StmtResult TreeTransform<Derived>::TransformOpenACCComputeConstruct(
11030 OpenACCComputeConstruct *
C) {
11034 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
11036 return getDerived().RebuildOpenACCComputeConstruct(
11037 C->getDirectiveKind(),
C->getBeginLoc(),
C->getEndLoc(), StrBlock);
11043template<
typename Derived>
11045TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *E) {
11046 return TransformExpr(E->getSubExpr());
11049template <
typename Derived>
11050ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
11051 SYCLUniqueStableNameExpr *E) {
11052 if (!E->isTypeDependent())
11055 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
11060 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
11063 return getDerived().RebuildSYCLUniqueStableNameExpr(
11064 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
11067template<
typename Derived>
11069TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) {
11070 if (!E->isTypeDependent())
11073 return getDerived().RebuildPredefinedExpr(E->getLocation(),
11074 E->getIdentKind());
11077template<
typename Derived>
11079TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
11080 NestedNameSpecifierLoc QualifierLoc;
11081 if (E->getQualifierLoc()) {
11083 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
11089 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
11094 NamedDecl *Found = ND;
11095 if (E->getFoundDecl() != E->getDecl()) {
11096 Found = cast_or_null<NamedDecl>(
11097 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
11102 DeclarationNameInfo NameInfo = E->getNameInfo();
11103 if (NameInfo.getName()) {
11104 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11105 if (!NameInfo.getName())
11109 if (!getDerived().AlwaysRebuild() &&
11110 QualifierLoc == E->getQualifierLoc() &&
11111 ND == E->getDecl() &&
11112 Found == E->getFoundDecl() &&
11113 NameInfo.getName() == E->getDecl()->getDeclName() &&
11114 !E->hasExplicitTemplateArgs()) {
11123 TemplateArgumentListInfo TransArgs, *TemplateArgs =
nullptr;
11124 if (E->hasExplicitTemplateArgs()) {
11125 TemplateArgs = &TransArgs;
11126 TransArgs.setLAngleLoc(E->getLAngleLoc());
11127 TransArgs.setRAngleLoc(E->getRAngleLoc());
11128 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
11129 E->getNumTemplateArgs(),
11134 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
11135 Found, TemplateArgs);
11138template<
typename Derived>
11140TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) {
11144template <
typename Derived>
11145ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
11146 FixedPointLiteral *E) {
11150template<
typename Derived>
11152TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) {
11156template<
typename Derived>
11158TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) {
11162template<
typename Derived>
11164TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) {
11168template<
typename Derived>
11170TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
11174template<
typename Derived>
11176TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
11177 return getDerived().TransformCallExpr(E);
11180template<
typename Derived>
11182TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *E) {
11184 TypeSourceInfo *ControllingType =
nullptr;
11185 if (E->isExprPredicate())
11186 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
11188 ControllingType = getDerived().TransformType(E->getControllingType());
11190 if (ControllingExpr.isInvalid() && !ControllingType)
11196 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
11198 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
11201 AssocTypes.push_back(AssocType);
11203 AssocTypes.push_back(
nullptr);
11207 getDerived().TransformExpr(Assoc.getAssociationExpr());
11208 if (AssocExpr.isInvalid())
11210 AssocExprs.push_back(AssocExpr.get());
11213 if (!ControllingType)
11214 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
11215 E->getDefaultLoc(),
11217 ControllingExpr.get(),
11220 return getDerived().RebuildGenericSelectionExpr(
11221 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
11222 ControllingType, AssocTypes, AssocExprs);
11225template<
typename Derived>
11227TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) {
11228 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
11229 if (SubExpr.isInvalid())
11232 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
11235 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
11242template<
typename Derived>
11246 return getDerived().TransformDependentScopeDeclRefExpr(DRE,
true,
nullptr);
11248 return getDerived().TransformExpr(E);
11251template<
typename Derived>
11256 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
11262 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
11270template<
typename Derived>
11272TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
11274 TypeSourceInfo *
Type = getDerived().TransformType(E->getTypeSourceInfo());
11284 bool ExprChanged =
false;
11285 typedef Sema::OffsetOfComponent Component;
11287 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
11288 const OffsetOfNode &ON = E->getComponent(I);
11290 Comp.isBrackets =
true;
11291 Comp.LocStart = ON.getSourceRange().getBegin();
11292 Comp.LocEnd = ON.getSourceRange().getEnd();
11293 switch (ON.getKind()) {
11295 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
11296 ExprResult Index = getDerived().TransformExpr(FromIndex);
11297 if (Index.isInvalid())
11300 ExprChanged = ExprChanged || Index.get() != FromIndex;
11301 Comp.isBrackets =
true;
11302 Comp.U.E = Index.get();
11308 Comp.isBrackets =
false;
11309 Comp.U.IdentInfo = ON.getFieldName();
11310 if (!
Comp.U.IdentInfo)
11320 Components.push_back(Comp);
11324 if (!getDerived().AlwaysRebuild() &&
11325 Type == E->getTypeSourceInfo() &&
11330 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(), Type,
11331 Components, E->getRParenLoc());
11334template<
typename Derived>
11336TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *E) {
11337 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
11338 "opaque value expression requires transformation");
11342template<
typename Derived>
11344TreeTransform<Derived>::TransformTypoExpr(TypoExpr *E) {
11348template <
typename Derived>
11349ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *E) {
11352 for (Expr *
C : E->subExpressions()) {
11354 if (NewC.isInvalid())
11356 Children.push_back(NewC.get());
11360 if (!getDerived().AlwaysRebuild() && !Changed)
11362 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
11363 Children, E->getType());
11366template<
typename Derived>
11368TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *E) {
11376 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
11377 if (result.isInvalid())
return ExprError();
11382 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
11388template<
typename Derived>
11390TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
11391 UnaryExprOrTypeTraitExpr *E) {
11392 if (E->isArgumentType()) {
11393 TypeSourceInfo *OldT = E->getArgumentTypeInfo();
11395 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
11399 if (!getDerived().AlwaysRebuild() && OldT == NewT)
11402 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
11404 E->getSourceRange());
11416 TypeSourceInfo *RecoveryTSI =
nullptr;
11418 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
11420 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
11421 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
11422 PE, DRE,
false, &RecoveryTSI);
11424 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
11427 return getDerived().RebuildUnaryExprOrTypeTrait(
11428 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
11429 }
else if (SubExpr.isInvalid())
11432 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
11435 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
11436 E->getOperatorLoc(),
11438 E->getSourceRange());
11441template<
typename Derived>
11443TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
11444 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
11445 if (LHS.isInvalid())
11448 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
11449 if (RHS.isInvalid())
11453 if (!getDerived().AlwaysRebuild() &&
11454 LHS.get() == E->getLHS() &&
11455 RHS.get() == E->getRHS())
11458 return getDerived().RebuildArraySubscriptExpr(
11460 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
11463template <
typename Derived>
11465TreeTransform<Derived>::TransformMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
11467 if (
Base.isInvalid())
11470 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
11471 if (RowIdx.isInvalid())
11474 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
11475 if (ColumnIdx.isInvalid())
11478 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
11479 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
11482 return getDerived().RebuildMatrixSubscriptExpr(
11483 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
11486template <
typename Derived>
11488TreeTransform<Derived>::TransformOMPArraySectionExpr(OMPArraySectionExpr *E) {
11490 if (
Base.isInvalid())
11494 if (E->getLowerBound()) {
11495 LowerBound = getDerived().TransformExpr(E->getLowerBound());
11496 if (LowerBound.isInvalid())
11501 if (E->getLength()) {
11502 Length = getDerived().TransformExpr(E->getLength());
11503 if (Length.isInvalid())
11508 if (Expr *Str = E->getStride()) {
11509 Stride = getDerived().TransformExpr(Str);
11510 if (Stride.isInvalid())
11514 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
11515 LowerBound.get() == E->getLowerBound() && Length.get() == E->getLength())
11518 return getDerived().RebuildOMPArraySectionExpr(
11519 Base.get(), E->getBase()->getEndLoc(), LowerBound.get(),
11520 E->getColonLocFirst(), E->getColonLocSecond(), Length.get(), Stride.get(),
11521 E->getRBracketLoc());
11524template <
typename Derived>
11526TreeTransform<Derived>::TransformOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
11528 if (
Base.isInvalid())
11532 bool ErrorFound =
false;
11533 for (Expr *Dim : E->getDimensions()) {
11534 ExprResult DimRes = getDerived().TransformExpr(Dim);
11535 if (DimRes.isInvalid()) {
11539 Dims.push_back(DimRes.get());
11544 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
11545 E->getRParenLoc(), Dims,
11546 E->getBracketsRanges());
11549template <
typename Derived>
11551TreeTransform<Derived>::TransformOMPIteratorExpr(OMPIteratorExpr *E) {
11552 unsigned NumIterators = E->numOfIterators();
11555 bool ErrorFound =
false;
11556 bool NeedToRebuild = getDerived().AlwaysRebuild();
11557 for (
unsigned I = 0; I < NumIterators; ++I) {
11558 auto *D = cast<VarDecl>(E->getIteratorDecl(I));
11559 Data[I].DeclIdent = D->getIdentifier();
11560 Data[I].DeclIdentLoc = D->getLocation();
11561 if (D->getLocation() == D->getBeginLoc()) {
11563 "Implicit type must be int.");
11565 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
11566 QualType
DeclTy = getDerived().TransformType(D->getType());
11569 OMPIteratorExpr::IteratorRange
Range = E->getIteratorRange(I);
11573 ErrorFound = ErrorFound ||
11574 !(!D->getTypeSourceInfo() || (
Data[I].Type.getAsOpaquePtr() &&
11575 !
Data[I].Type.get().isNull())) ||
11580 Data[I].Range.End = End.get();
11581 Data[I].Range.Step = Step.get();
11582 Data[I].AssignLoc = E->getAssignLoc(I);
11583 Data[I].ColonLoc = E->getColonLoc(I);
11584 Data[I].SecColonLoc = E->getSecondColonLoc(I);
11587 (D->getTypeSourceInfo() &&
Data[I].Type.get().getTypePtrOrNull() !=
11588 D->getType().getTypePtrOrNull()) ||
11594 if (!NeedToRebuild)
11597 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
11598 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
11599 if (!Res.isUsable())
11601 auto *IE = cast<OMPIteratorExpr>(Res.get());
11602 for (
unsigned I = 0; I < NumIterators; ++I)
11603 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
11604 IE->getIteratorDecl(I));
11608template<
typename Derived>
11610TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
11617 bool ArgChanged =
false;
11619 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
11623 if (!getDerived().AlwaysRebuild() &&
11624 Callee.get() == E->getCallee() &&
11629 SourceLocation FakeLParenLoc
11632 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
11633 if (E->hasStoredFPFeatures()) {
11634 FPOptionsOverride NewOverrides = E->getFPFeatures();
11635 getSema().CurFPFeatures =
11636 NewOverrides.applyOverrides(getSema().getLangOpts());
11637 getSema().FpPragmaStack.CurrentValue = NewOverrides;
11640 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
11642 E->getRParenLoc());
11645template<
typename Derived>
11647TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
11649 if (
Base.isInvalid())
11652 NestedNameSpecifierLoc QualifierLoc;
11653 if (E->hasQualifier()) {
11655 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
11660 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
11663 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
11664 E->getMemberDecl()));
11668 NamedDecl *FoundDecl = E->getFoundDecl();
11669 if (FoundDecl == E->getMemberDecl()) {
11672 FoundDecl = cast_or_null<NamedDecl>(
11673 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
11678 if (!getDerived().AlwaysRebuild() &&
11679 Base.get() == E->getBase() &&
11680 QualifierLoc == E->getQualifierLoc() &&
11681 Member == E->getMemberDecl() &&
11682 FoundDecl == E->getFoundDecl() &&
11683 !E->hasExplicitTemplateArgs()) {
11687 if (!(isa<CXXThisExpr>(E->getBase()) &&
11688 getSema().isOpenMPRebuildMemberExpr(cast<ValueDecl>(
Member)))) {
11696 TemplateArgumentListInfo TransArgs;
11697 if (E->hasExplicitTemplateArgs()) {
11698 TransArgs.setLAngleLoc(E->getLAngleLoc());
11699 TransArgs.setRAngleLoc(E->getRAngleLoc());
11700 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
11701 E->getNumTemplateArgs(),
11707 SourceLocation FakeOperatorLoc =
11714 NamedDecl *FirstQualifierInScope =
nullptr;
11715 DeclarationNameInfo MemberNameInfo = E->getMemberNameInfo();
11716 if (MemberNameInfo.getName()) {
11717 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
11718 if (!MemberNameInfo.getName())
11722 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
11729 (E->hasExplicitTemplateArgs()
11730 ? &TransArgs :
nullptr),
11731 FirstQualifierInScope);
11734template<
typename Derived>
11736TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
11737 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
11738 if (LHS.isInvalid())
11742 getDerived().TransformInitializer(E->getRHS(),
false);
11743 if (RHS.isInvalid())
11746 if (!getDerived().AlwaysRebuild() &&
11747 LHS.get() == E->getLHS() &&
11748 RHS.get() == E->getRHS())
11751 if (E->isCompoundAssignmentOp())
11753 return getDerived().RebuildBinaryOperator(
11754 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
11755 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
11756 FPOptionsOverride NewOverrides(E->getFPFeatures());
11757 getSema().CurFPFeatures =
11758 NewOverrides.applyOverrides(getSema().getLangOpts());
11759 getSema().FpPragmaStack.CurrentValue = NewOverrides;
11760 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
11761 LHS.get(), RHS.get());
11764template <
typename Derived>
11765ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
11766 CXXRewrittenBinaryOperator *E) {
11767 CXXRewrittenBinaryOperator::DecomposedForm Decomp = E->getDecomposedForm();
11769 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
11770 if (LHS.isInvalid())
11773 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
11774 if (RHS.isInvalid())
11779 UnresolvedSet<2> UnqualLookups;
11780 bool ChangedAnyLookups =
false;
11781 Expr *PossibleBinOps[] = {E->getSemanticForm(),
11782 const_cast<Expr *
>(Decomp.InnerBinOp)};
11783 for (Expr *PossibleBinOp : PossibleBinOps) {
11784 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
11787 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
11788 if (!Callee || isa<CXXMethodDecl>(
Callee->getDecl()))
11793 NamedDecl *Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
11794 E->getOperatorLoc(),
Callee->getFoundDecl()));
11797 if (Found !=
Callee->getFoundDecl())
11798 ChangedAnyLookups =
true;
11799 UnqualLookups.addDecl(Found);
11802 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
11803 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
11809 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
11814 return getDerived().RebuildCXXRewrittenBinaryOperator(
11815 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
11818template<
typename Derived>
11820TreeTransform<Derived>::TransformCompoundAssignOperator(
11821 CompoundAssignOperator *E) {
11822 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
11823 FPOptionsOverride NewOverrides(E->getFPFeatures());
11824 getSema().CurFPFeatures =
11825 NewOverrides.applyOverrides(getSema().getLangOpts());
11826 getSema().FpPragmaStack.CurrentValue = NewOverrides;
11827 return getDerived().TransformBinaryOperator(E);
11830template<
typename Derived>
11832TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
11836 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
11837 if (commonExpr.isInvalid())
11840 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
11841 if (rhs.isInvalid())
11844 if (!getDerived().AlwaysRebuild() &&
11845 commonExpr.get() == e->getCommon() &&
11846 rhs.get() == e->getFalseExpr())
11849 return getDerived().RebuildConditionalOperator(commonExpr.get(),
11850 e->getQuestionLoc(),
11856template<
typename Derived>
11858TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) {
11859 ExprResult Cond = getDerived().TransformExpr(E->getCond());
11860 if (Cond.isInvalid())
11863 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
11864 if (LHS.isInvalid())
11867 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
11868 if (RHS.isInvalid())
11871 if (!getDerived().AlwaysRebuild() &&
11872 Cond.get() == E->getCond() &&
11873 LHS.get() == E->getLHS() &&
11874 RHS.get() == E->getRHS())
11877 return getDerived().RebuildConditionalOperator(Cond.get(),
11878 E->getQuestionLoc(),
11884template<
typename Derived>
11886TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) {
11889 return getDerived().TransformExpr(E->getSubExprAsWritten());
11892template<
typename Derived>
11894TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
11895 TypeSourceInfo *
Type = getDerived().TransformType(E->getTypeInfoAsWritten());
11900 = getDerived().TransformExpr(E->getSubExprAsWritten());
11901 if (SubExpr.isInvalid())
11904 if (!getDerived().AlwaysRebuild() &&
11905 Type == E->getTypeInfoAsWritten() &&
11906 SubExpr.get() == E->getSubExpr())
11909 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
11915template<
typename Derived>
11917TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
11918 TypeSourceInfo *OldT = E->getTypeSourceInfo();
11919 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
11923 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
11924 if (
Init.isInvalid())
11927 if (!getDerived().AlwaysRebuild() &&
11929 Init.get() == E->getInitializer())
11936 return getDerived().RebuildCompoundLiteralExpr(
11937 E->getLParenLoc(), NewT,
11938 E->getInitializer()->getEndLoc(),
Init.get());
11941template<
typename Derived>
11943TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) {
11945 if (
Base.isInvalid())
11948 if (!getDerived().AlwaysRebuild() &&
11949 Base.get() == E->getBase())
11953 SourceLocation FakeOperatorLoc =
11955 return getDerived().RebuildExtVectorElementExpr(
11956 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
11960template<
typename Derived>
11962TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) {
11963 if (InitListExpr *Syntactic = E->getSyntacticForm())
11966 bool InitChanged =
false;
11968 EnterExpressionEvaluationContext Context(
11972 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
11973 Inits, &InitChanged))
11976 if (!getDerived().AlwaysRebuild() && !InitChanged) {
11983 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
11984 E->getRBraceLoc());
11987template<
typename Derived>
11989TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
11994 if (
Init.isInvalid())
11999 bool ExprChanged =
false;
12000 for (
const DesignatedInitExpr::Designator &D : E->designators()) {
12001 if (D.isFieldDesignator()) {
12002 if (D.getFieldDecl()) {
12003 FieldDecl *
Field = cast_or_null<FieldDecl>(
12004 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
12005 if (Field != D.getFieldDecl())
12008 ExprChanged =
true;
12009 if (
Field->isAnonymousStructOrUnion())
12015 ExprChanged =
true;
12018 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
12022 if (D.isArrayDesignator()) {
12023 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
12024 if (Index.isInvalid())
12027 Desig.AddDesignator(
12030 ExprChanged = ExprChanged ||
Init.get() != E->getArrayIndex(D);
12031 ArrayExprs.push_back(Index.get());
12035 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
12037 = getDerived().TransformExpr(E->getArrayRangeStart(D));
12038 if (Start.isInvalid())
12041 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
12042 if (End.isInvalid())
12046 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
12048 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
12049 End.get() != E->getArrayRangeEnd(D);
12051 ArrayExprs.push_back(Start.get());
12052 ArrayExprs.push_back(End.get());
12055 if (!getDerived().AlwaysRebuild() &&
12056 Init.get() == E->getInit() &&
12060 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
12061 E->getEqualOrColonLoc(),
12062 E->usesGNUSyntax(),
Init.get());
12067template<
typename Derived>
12069TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
12070 DesignatedInitUpdateExpr *E) {
12071 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
12076template<
typename Derived>
12078TreeTransform<Derived>::TransformNoInitExpr(
12080 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
12084template<
typename Derived>
12086TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *E) {
12087 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
12091template<
typename Derived>
12093TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *E) {
12094 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
12098template<
typename Derived>
12100TreeTransform<Derived>::TransformImplicitValueInitExpr(
12101 ImplicitValueInitExpr *E) {
12102 TemporaryBase Rebase(*
this, E->getBeginLoc(), DeclarationName());
12106 QualType T = getDerived().TransformType(E->getType());
12110 if (!getDerived().AlwaysRebuild() &&
12114 return getDerived().RebuildImplicitValueInitExpr(T);
12117template<
typename Derived>
12119TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) {
12120 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
12124 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
12125 if (SubExpr.isInvalid())
12128 if (!getDerived().AlwaysRebuild() &&
12129 TInfo == E->getWrittenTypeInfo() &&
12130 SubExpr.get() == E->getSubExpr())
12133 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
12134 TInfo, E->getRParenLoc());
12137template<
typename Derived>
12139TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) {
12140 bool ArgumentChanged =
false;
12142 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
12146 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
12148 E->getRParenLoc());
12156template<
typename Derived>
12158TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) {
12159 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
12164 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
12165 cast<LabelDecl>(LD));
12168template<
typename Derived>
12170TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
12173 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
12174 if (SubStmt.isInvalid()) {
12179 unsigned OldDepth = E->getTemplateDepth();
12180 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
12182 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
12183 SubStmt.get() == E->getSubStmt()) {
12189 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
12190 E->getRParenLoc(), NewDepth);
12193template<
typename Derived>
12195TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
12196 ExprResult Cond = getDerived().TransformExpr(E->getCond());
12197 if (Cond.isInvalid())
12200 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
12201 if (LHS.isInvalid())
12204 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
12205 if (RHS.isInvalid())
12208 if (!getDerived().AlwaysRebuild() &&
12209 Cond.get() == E->getCond() &&
12210 LHS.get() == E->getLHS() &&
12211 RHS.get() == E->getRHS())
12214 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
12215 Cond.get(), LHS.get(), RHS.get(),
12216 E->getRParenLoc());
12219template<
typename Derived>
12221TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) {
12225template<
typename Derived>
12227TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
12228 switch (E->getOperator()) {
12232 case OO_Array_Delete:
12233 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
12238 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
12247 static_cast<Expr *
>(
Object.get())->getEndLoc());
12251 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
12255 if (E->getOperator() == OO_Subscript)
12256 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
12257 Args, E->getEndLoc());
12259 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
12263#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
12267#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
12268#include "clang/Basic/OperatorKinds.def"
12270 case OO_Conditional:
12271 llvm_unreachable(
"conditional operator is not actually overloadable");
12275 llvm_unreachable(
"not an overloaded operator?");
12279 if (E->getOperator() == OO_Amp)
12280 First = getDerived().TransformAddressOfOperand(E->getArg(0));
12282 First = getDerived().TransformExpr(E->getArg(0));
12283 if (
First.isInvalid())
12287 if (E->getNumArgs() == 2) {
12289 getDerived().TransformInitializer(E->getArg(1),
false);
12290 if (Second.isInvalid())
12294 Sema::FPFeaturesStateRAII FPFeaturesState(getSema());
12295 FPOptionsOverride NewOverrides(E->getFPFeatures());
12296 getSema().CurFPFeatures =
12297 NewOverrides.applyOverrides(getSema().getLangOpts());
12298 getSema().FpPragmaStack.CurrentValue = NewOverrides;
12300 Expr *
Callee = E->getCallee();
12301 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
12302 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
12304 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
12307 return getDerived().RebuildCXXOperatorCallExpr(
12308 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
12309 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
12312 UnresolvedSet<1> Functions;
12313 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Callee))
12314 Callee = ICE->getSubExprAsWritten();
12315 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
12316 ValueDecl *VD = cast_or_null<ValueDecl>(
12317 getDerived().TransformDecl(DR->getLocation(), DR));
12321 if (!isa<CXXMethodDecl>(VD))
12322 Functions.addDecl(VD);
12324 return getDerived().RebuildCXXOperatorCallExpr(
12325 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
12326 false, Functions,
First.get(), Second.get());
12329template<
typename Derived>
12331TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) {
12332 return getDerived().TransformCallExpr(E);
12335template <
typename Derived>
12336ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *E) {
12338 getSema().CurContext != E->getParentContext();
12340 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
12343 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
12344 E->getBeginLoc(), E->getEndLoc(),
12345 getSema().CurContext);
12348template<
typename Derived>
12350TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
12357 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
12358 if (EC.isInvalid())
12362 bool ArgChanged =
false;
12364 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
12368 if (!getDerived().AlwaysRebuild() &&
12369 Callee.get() == E->getCallee() &&
12374 SourceLocation FakeLParenLoc
12376 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
12378 E->getRParenLoc(), EC.get());
12381template<
typename Derived>
12393 if (!getDerived().AlwaysRebuild() &&
12397 return getDerived().RebuildCXXNamedCastExpr(
12404template<
typename Derived>
12413 if (Sub.isInvalid())
12416 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
12420template<
typename Derived>
12422TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
12423 return getDerived().TransformCXXNamedCastExpr(E);
12426template<
typename Derived>
12428TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
12429 return getDerived().TransformCXXNamedCastExpr(E);
12432template<
typename Derived>
12434TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
12435 CXXReinterpretCastExpr *E) {
12436 return getDerived().TransformCXXNamedCastExpr(E);
12439template<
typename Derived>
12441TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) {
12442 return getDerived().TransformCXXNamedCastExpr(E);
12445template<
typename Derived>
12447TreeTransform<Derived>::TransformCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
12448 return getDerived().TransformCXXNamedCastExpr(E);
12451template<
typename Derived>
12453TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
12454 CXXFunctionalCastExpr *E) {
12455 TypeSourceInfo *
Type =
12456 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
12461 = getDerived().TransformExpr(E->getSubExprAsWritten());
12462 if (SubExpr.isInvalid())
12465 if (!getDerived().AlwaysRebuild() &&
12466 Type == E->getTypeInfoAsWritten() &&
12467 SubExpr.get() == E->getSubExpr())
12470 return getDerived().RebuildCXXFunctionalCastExpr(Type,
12474 E->isListInitialization());
12477template<
typename Derived>
12479TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
12480 if (E->isTypeOperand()) {
12481 TypeSourceInfo *TInfo
12482 = getDerived().TransformType(E->getTypeOperandSourceInfo());
12486 if (!getDerived().AlwaysRebuild() &&
12487 TInfo == E->getTypeOperandSourceInfo())
12490 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
12491 TInfo, E->getEndLoc());
12497 Expr *Op = E->getExprOperand();
12499 if (E->isGLValue())
12500 if (
auto *RecordT = Op->getType()->getAs<RecordType>())
12501 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
12504 EnterExpressionEvaluationContext
Unevaluated(SemaRef, EvalCtx,
12507 ExprResult SubExpr = getDerived().TransformExpr(Op);
12508 if (SubExpr.isInvalid())
12511 if (!getDerived().AlwaysRebuild() &&
12512 SubExpr.get() == E->getExprOperand())
12515 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
12516 SubExpr.get(), E->getEndLoc());
12519template<
typename Derived>
12521TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *E) {
12522 if (E->isTypeOperand()) {
12523 TypeSourceInfo *TInfo
12524 = getDerived().TransformType(E->getTypeOperandSourceInfo());
12528 if (!getDerived().AlwaysRebuild() &&
12529 TInfo == E->getTypeOperandSourceInfo())
12532 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
12533 TInfo, E->getEndLoc());
12539 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
12540 if (SubExpr.isInvalid())
12543 if (!getDerived().AlwaysRebuild() &&
12544 SubExpr.get() == E->getExprOperand())
12547 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
12548 SubExpr.get(), E->getEndLoc());
12551template<
typename Derived>
12553TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
12557template<
typename Derived>
12559TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
12560 CXXNullPtrLiteralExpr *E) {
12564template<
typename Derived>
12566TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
12574 QualType T = getSema().getCurLambda() ?
12575 getDerived().TransformType(E->getType())
12576 : getSema().getCurrentThisType();
12578 if (!getDerived().AlwaysRebuild() && T == E->getType()) {
12581 getSema().MarkThisReferenced(E);
12585 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
12588template<
typename Derived>
12590TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
12591 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
12592 if (SubExpr.isInvalid())
12595 if (!getDerived().AlwaysRebuild() &&
12596 SubExpr.get() == E->getSubExpr())
12599 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
12600 E->isThrownVariableInScope());
12603template<
typename Derived>
12605TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
12606 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
12607 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
12612 if (E->hasRewrittenInit()) {
12613 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
12614 if (InitRes.isInvalid())
12618 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
12619 E->getUsedContext() == SemaRef.
CurContext &&
12620 InitRes.get() == E->getRewrittenExpr())
12623 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
12627template<
typename Derived>
12629TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
12630 FieldDecl *
Field = cast_or_null<FieldDecl>(
12631 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
12635 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
12639 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
12642template<
typename Derived>
12644TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
12645 CXXScalarValueInitExpr *E) {
12646 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
12650 if (!getDerived().AlwaysRebuild() &&
12651 T == E->getTypeSourceInfo())
12654 return getDerived().RebuildCXXScalarValueInitExpr(T,
12655 T->getTypeLoc().getEndLoc(),
12656 E->getRParenLoc());
12659template<
typename Derived>
12661TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
12663 TypeSourceInfo *AllocTypeInfo =
12664 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
12665 if (!AllocTypeInfo)
12669 std::optional<Expr *> ArraySize;
12670 if (E->isArray()) {
12672 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
12673 NewArraySize = getDerived().TransformExpr(*OldArraySize);
12674 if (NewArraySize.isInvalid())
12677 ArraySize = NewArraySize.get();
12681 bool ArgumentChanged =
false;
12683 if (getDerived().TransformExprs(E->getPlacementArgs(),
12684 E->getNumPlacementArgs(),
true,
12685 PlacementArgs, &ArgumentChanged))
12689 Expr *OldInit = E->getInitializer();
12692 NewInit = getDerived().TransformInitializer(OldInit,
true);
12693 if (NewInit.isInvalid())
12697 FunctionDecl *OperatorNew =
nullptr;
12698 if (E->getOperatorNew()) {
12699 OperatorNew = cast_or_null<FunctionDecl>(
12700 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
12705 FunctionDecl *OperatorDelete =
nullptr;
12706 if (E->getOperatorDelete()) {
12707 OperatorDelete = cast_or_null<FunctionDecl>(
12708 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
12709 if (!OperatorDelete)
12713 if (!getDerived().AlwaysRebuild() &&
12714 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
12715 ArraySize == E->getArraySize() &&
12716 NewInit.get() == OldInit &&
12717 OperatorNew == E->getOperatorNew() &&
12718 OperatorDelete == E->getOperatorDelete() &&
12719 !ArgumentChanged) {
12724 if (OperatorDelete)
12727 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
12728 QualType ElementType
12730 if (
const RecordType *RecordT = ElementType->getAs<RecordType>()) {
12731 CXXRecordDecl *
Record = cast<CXXRecordDecl>(RecordT->getDecl());
12741 QualType AllocType = AllocTypeInfo->getType();
12751 }
else if (
const ConstantArrayType *ConsArrayT
12752 = dyn_cast<ConstantArrayType>(ArrayT)) {
12756 AllocType = ConsArrayT->getElementType();
12757 }
else if (
const DependentSizedArrayType *DepArrayT
12758 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
12759 if (DepArrayT->getSizeExpr()) {
12760 ArraySize = DepArrayT->getSizeExpr();
12761 AllocType = DepArrayT->getElementType();
12766 return getDerived().RebuildCXXNewExpr(
12767 E->getBeginLoc(), E->isGlobalNew(),
12768 E->getBeginLoc(), PlacementArgs,
12769 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
12770 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
12773template<
typename Derived>
12775TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
12781 FunctionDecl *OperatorDelete =
nullptr;
12782 if (E->getOperatorDelete()) {
12783 OperatorDelete = cast_or_null<FunctionDecl>(
12784 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
12785 if (!OperatorDelete)
12789 if (!getDerived().AlwaysRebuild() &&
12790 Operand.get() == E->getArgument() &&
12791 OperatorDelete == E->getOperatorDelete()) {
12794 if (OperatorDelete)
12797 if (!E->getArgument()->isTypeDependent()) {
12799 E->getDestroyedType());
12800 if (
const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
12801 CXXRecordDecl *
Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
12810 return getDerived().RebuildCXXDeleteExpr(
12811 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
12814template<
typename Derived>
12816TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
12817 CXXPseudoDestructorExpr *E) {
12819 if (
Base.isInvalid())
12823 bool MayBePseudoDestructor =
false;
12825 E->getOperatorLoc(),
12826 E->isArrow()? tok::arrow : tok::period,
12828 MayBePseudoDestructor);
12829 if (
Base.isInvalid())
12832 QualType ObjectType = ObjectTypePtr.get();
12833 NestedNameSpecifierLoc QualifierLoc = E->getQualifierLoc();
12834 if (QualifierLoc) {
12836 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
12841 SS.Adopt(QualifierLoc);
12843 PseudoDestructorTypeStorage Destroyed;
12844 if (E->getDestroyedTypeInfo()) {
12845 TypeSourceInfo *DestroyedTypeInfo
12846 = getDerived().TransformTypeInObjectScope(E->getDestroyedTypeInfo(),
12847 ObjectType,
nullptr, SS);
12848 if (!DestroyedTypeInfo)
12850 Destroyed = DestroyedTypeInfo;
12851 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
12854 Destroyed = PseudoDestructorTypeStorage(E->getDestroyedTypeIdentifier(),
12855 E->getDestroyedTypeLoc());
12859 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
12860 nullptr, SS, ObjectTypePtr,
false);
12866 E->getDestroyedTypeLoc());
12869 TypeSourceInfo *ScopeTypeInfo =
nullptr;
12870 if (E->getScopeTypeInfo()) {
12871 CXXScopeSpec EmptySS;
12872 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
12873 E->getScopeTypeInfo(), ObjectType,
nullptr, EmptySS);
12874 if (!ScopeTypeInfo)
12878 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
12879 E->getOperatorLoc(),
12883 E->getColonColonLoc(),
12888template <
typename Derived>
12893 bool AllEmptyPacks =
true;
12894 for (
auto *OldD : Old->
decls()) {
12895 Decl *InstD = getDerived().TransformDecl(Old->
getNameLoc(), OldD);
12899 if (isa<UsingShadowDecl>(OldD))
12908 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
12910 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
12911 Decls = UPD->expansions();
12914 for (
auto *D : Decls) {
12915 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
12916 for (
auto *SD : UD->shadows())
12923 AllEmptyPacks &= Decls.empty();
12932 if (AllEmptyPacks && !RequiresADL) {
12933 getSema().Diag(Old->
getNameLoc(), diag::err_using_pack_expansion_empty)
12934 << isa<UnresolvedMemberExpr>(Old) << Old->
getName();
12944template<
typename Derived>
12952 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
12959 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
12963 SS.
Adopt(QualifierLoc);
12967 CXXRecordDecl *NamingClass
12968 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
12971 if (!NamingClass) {
12976 R.setNamingClass(NamingClass);
12984 NamedDecl *D = R.getAsSingle<NamedDecl>();
12988 if (D && D->isCXXInstanceMember()) {
12994 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
13008 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
13012template<
typename Derived>
13014TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *E) {
13015 bool ArgChanged =
false;
13017 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
13018 TypeSourceInfo *From = E->getArg(I);
13019 TypeLoc FromTL = From->getTypeLoc();
13020 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
13021 TypeLocBuilder TLB;
13022 TLB.reserve(FromTL.getFullDataSize());
13023 QualType To = getDerived().TransformType(TLB, FromTL);
13027 if (To == From->getType())
13028 Args.push_back(From);
13030 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13039 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
13040 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
13046 bool Expand =
true;
13047 bool RetainExpansion =
false;
13048 std::optional<unsigned> OrigNumExpansions =
13049 ExpansionTL.getTypePtr()->getNumExpansions();
13050 std::optional<unsigned> NumExpansions = OrigNumExpansions;
13051 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
13052 PatternTL.getSourceRange(),
13054 Expand, RetainExpansion,
13062 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
13064 TypeLocBuilder TLB;
13065 TLB.reserve(From->getTypeLoc().getFullDataSize());
13067 QualType To = getDerived().TransformType(TLB, PatternTL);
13071 To = getDerived().RebuildPackExpansionType(To,
13072 PatternTL.getSourceRange(),
13073 ExpansionTL.getEllipsisLoc(),
13078 PackExpansionTypeLoc ToExpansionTL
13079 = TLB.push<PackExpansionTypeLoc>(To);
13080 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13081 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13087 for (
unsigned I = 0; I != *NumExpansions; ++I) {
13088 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
13089 TypeLocBuilder TLB;
13090 TLB.reserve(PatternTL.getFullDataSize());
13091 QualType To = getDerived().TransformType(TLB, PatternTL);
13095 if (To->containsUnexpandedParameterPack()) {
13096 To = getDerived().RebuildPackExpansionType(To,
13097 PatternTL.getSourceRange(),
13098 ExpansionTL.getEllipsisLoc(),
13103 PackExpansionTypeLoc ToExpansionTL
13104 = TLB.push<PackExpansionTypeLoc>(To);
13105 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13108 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13111 if (!RetainExpansion)
13116 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
13118 TypeLocBuilder TLB;
13119 TLB.reserve(From->getTypeLoc().getFullDataSize());
13121 QualType To = getDerived().TransformType(TLB, PatternTL);
13125 To = getDerived().RebuildPackExpansionType(To,
13126 PatternTL.getSourceRange(),
13127 ExpansionTL.getEllipsisLoc(),
13132 PackExpansionTypeLoc ToExpansionTL
13133 = TLB.push<PackExpansionTypeLoc>(To);
13134 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
13135 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
13138 if (!getDerived().AlwaysRebuild() && !ArgChanged)
13141 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
13145template<
typename Derived>
13147TreeTransform<Derived>::TransformConceptSpecializationExpr(
13148 ConceptSpecializationExpr *E) {
13149 const ASTTemplateArgumentListInfo *Old = E->getTemplateArgsAsWritten();
13150 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
13151 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
13152 Old->NumTemplateArgs, TransArgs))
13155 return getDerived().RebuildConceptSpecializationExpr(
13156 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
13157 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
13161template<
typename Derived>
13163TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *E) {
13166 Sema::ExtParameterInfoBuilder ExtParamInfos;
13170 EnterExpressionEvaluationContext Ctx(
13175 getSema().Context, getSema().CurContext,
13176 E->getBody()->getBeginLoc());
13178 Sema::ContextRAII SavedContext(getSema(), Body,
false);
13180 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
13181 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
13182 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
13184 for (ParmVarDecl *Param : TransParams)
13186 Param->setDeclContext(Body);
13192 if (!TypeParamResult.isUnset())
13193 return TypeParamResult;
13196 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
13200 for (concepts::Requirement *Req : TransReqs) {
13201 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
13202 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
13203 ER->getReturnTypeRequirement()
13204 .getTypeConstraintTemplateParameterList()->getParam(0)
13205 ->setDeclContext(Body);
13210 return getDerived().RebuildRequiresExpr(
13211 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
13212 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
13215template<
typename Derived>
13221 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
13222 TransReq = getDerived().TransformTypeRequirement(TypeReq);
13223 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
13224 TransReq = getDerived().TransformExprRequirement(ExprReq);
13226 TransReq = getDerived().TransformNestedRequirement(
13227 cast<concepts::NestedRequirement>(Req));
13230 Transformed.push_back(TransReq);
13235template<
typename Derived>
13240 if (getDerived().AlwaysRebuild())
13241 return getDerived().RebuildTypeRequirement(
13248 return getDerived().RebuildTypeRequirement(TransType);
13251template<
typename Derived>
13254 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
13263 TransExpr = TransExprRes.
get();
13266 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
13268 if (RetReq.isEmpty())
13269 TransRetReq.emplace();
13270 else if (RetReq.isSubstitutionFailure())
13271 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
13272 else if (RetReq.isTypeConstraint()) {
13274 RetReq.getTypeConstraintTemplateParameterList();
13276 getDerived().TransformTemplateParameterList(OrigTPL);
13279 TransRetReq.emplace(TPL);
13281 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
13282 if (
Expr *E = TransExpr.dyn_cast<
Expr *>())
13283 return getDerived().RebuildExprRequirement(E, Req->
isSimple(),
13285 std::move(*TransRetReq));
13286 return getDerived().RebuildExprRequirement(
13291template<
typename Derived>
13296 if (getDerived().AlwaysRebuild())
13297 return getDerived().RebuildNestedRequirement(
13305 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
13308template<
typename Derived>
13315 if (!getDerived().AlwaysRebuild() &&
13335template<
typename Derived>
13337TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *E) {
13342 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
13343 if (SubExpr.isInvalid())
13346 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
13350 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
13351 SubExpr.get(), E->getEndLoc());
13354template <
typename Derived>
13358 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
13359 DRE, AddrTaken, RecoveryTSI);
13366 if (!getDerived().AlwaysRebuild() && NewDRE.
get() == DRE)
13368 return getDerived().RebuildParenExpr(NewDRE.
get(), PE->
getLParen(),
13372template <
typename Derived>
13375 return TransformDependentScopeDeclRefExpr(E,
false,
13379template <
typename Derived>
13395 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
13400 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
13406 return getDerived().RebuildDependentScopeDeclRefExpr(
13407 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
13408 IsAddressOfOperand, RecoveryTSI);
13412 if (getDerived().TransformTemplateArguments(
13416 return getDerived().RebuildDependentScopeDeclRefExpr(
13417 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
13421template<
typename Derived>
13423TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
13427 if (getDerived().AllowSkippingCXXConstructExpr() &&
13428 ((E->getNumArgs() == 1 ||
13429 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
13430 (!getDerived().DropCallArgument(E->getArg(0))) &&
13431 !E->isListInitialization()))
13432 return getDerived().TransformInitializer(E->getArg(0),
13435 TemporaryBase Rebase(*
this, E->getBeginLoc(), DeclarationName());
13437 QualType T = getDerived().TransformType(E->getType());
13441 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
13442 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
13446 bool ArgumentChanged =
false;
13449 EnterExpressionEvaluationContext Context(
13451 E->isListInitialization());
13452 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13457 if (!getDerived().AlwaysRebuild() &&
13458 T == E->getType() &&
13459 Constructor == E->getConstructor() &&
13460 !ArgumentChanged) {
13467 return getDerived().RebuildCXXConstructExpr(
13468 T, E->getBeginLoc(), Constructor, E->isElidable(), Args,
13469 E->hadMultipleCandidates(), E->isListInitialization(),
13470 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
13471 E->getConstructionKind(), E->getParenOrBraceRange());
13474template<
typename Derived>
13475ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
13476 CXXInheritedCtorInitExpr *E) {
13477 QualType T = getDerived().TransformType(E->getType());
13481 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
13482 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
13486 if (!getDerived().AlwaysRebuild() &&
13487 T == E->getType() &&
13488 Constructor == E->getConstructor()) {
13495 return getDerived().RebuildCXXInheritedCtorInitExpr(
13496 T, E->getLocation(), Constructor,
13497 E->constructsVBase(), E->inheritedFromVBase());
13504template<
typename Derived>
13506TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
13507 if (
auto *Dtor = E->getTemporary()->getDestructor())
13509 const_cast<CXXDestructorDecl *
>(Dtor));
13510 return getDerived().TransformExpr(E->getSubExpr());
13518template<
typename Derived>
13520TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *E) {
13521 return getDerived().TransformExpr(E->getSubExpr());
13524template<
typename Derived>
13526TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
13527 CXXTemporaryObjectExpr *E) {
13528 TypeSourceInfo *T =
13529 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
13533 CXXConstructorDecl *
Constructor = cast_or_null<CXXConstructorDecl>(
13534 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
13538 bool ArgumentChanged =
false;
13540 Args.reserve(E->getNumArgs());
13542 EnterExpressionEvaluationContext Context(
13544 E->isListInitialization());
13545 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13550 if (!getDerived().AlwaysRebuild() &&
13551 T == E->getTypeSourceInfo() &&
13552 Constructor == E->getConstructor() &&
13553 !ArgumentChanged) {
13561 SourceLocation LParenLoc = T->getTypeLoc().getEndLoc();
13562 return getDerived().RebuildCXXTemporaryObjectExpr(
13563 T, LParenLoc, Args, E->getEndLoc(),
13564 LParenLoc.isInvalid());
13567template<
typename Derived>
13569TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
13572 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
13573 struct TransformedInitCapture {
13575 SourceLocation EllipsisLoc;
13580 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
13582 CEnd = E->capture_end();
13584 if (!E->isInitCapture(
C))
13587 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
13588 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
13590 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
13591 std::optional<unsigned> NumExpansions) {
13592 ExprResult NewExprInitResult = getDerived().TransformInitializer(
13595 if (NewExprInitResult.isInvalid()) {
13596 Result.Expansions.push_back(InitCaptureInfoTy(
ExprError(), QualType()));
13599 Expr *NewExprInit = NewExprInitResult.get();
13601 QualType NewInitCaptureType =
13602 getSema().buildLambdaInitCaptureInitialization(
13603 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
13604 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
13605 cast<VarDecl>(
C->getCapturedVar())->getInitStyle() !=
13608 Result.Expansions.push_back(
13609 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
13613 if (OldVD->isParameterPack()) {
13614 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
13616 .castAs<PackExpansionTypeLoc>();
13622 bool Expand =
true;
13623 bool RetainExpansion =
false;
13624 std::optional<unsigned> OrigNumExpansions =
13625 ExpansionTL.getTypePtr()->getNumExpansions();
13626 std::optional<unsigned> NumExpansions = OrigNumExpansions;
13627 if (getDerived().TryExpandParameterPacks(
13628 ExpansionTL.getEllipsisLoc(),
13629 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
13630 RetainExpansion, NumExpansions))
13633 for (
unsigned I = 0; I != *NumExpansions; ++I) {
13634 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
13635 SubstInitCapture(SourceLocation(), std::nullopt);
13638 if (!Expand || RetainExpansion) {
13639 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
13640 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
13641 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
13644 SubstInitCapture(SourceLocation(), std::nullopt);
13648 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
13649 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
13660 DeclContext *DC = getSema().CurContext;
13678 while (DC->getDeclKind() == Decl::Kind::RequiresExprBody)
13679 DC = DC->getParent();
13680 if ((getSema().isUnevaluatedContext() ||
13681 getSema().isConstantEvaluatedContext()) &&
13682 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
13685 CXXRecordDecl *OldClass = E->getLambdaClass();
13686 CXXRecordDecl *
Class = getSema().createLambdaClosureType(
13687 E->getIntroducerRange(),
nullptr, DependencyKind,
13688 E->getCaptureDefault());
13689 getDerived().transformedLocalDecl(OldClass, {
Class});
13691 CXXMethodDecl *NewCallOperator =
13692 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
13693 NewCallOperator->setLexicalDeclContext(getSema().CurContext);
13696 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
13697 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
13698 E->hasExplicitParameters(), E->isMutable());
13701 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
13708 CEnd = E->capture_end();
13712 if (
C->isImplicit())
13716 if (
C->capturesThis()) {
13717 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
13724 if (
C->capturesVLAType())
13728 if (E->isInitCapture(
C)) {
13729 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
13731 auto *OldVD = cast<VarDecl>(
C->getCapturedVar());
13734 for (InitCaptureInfoTy &Info : NewC.Expansions) {
13736 QualType InitQualType = Info.second;
13737 if (
Init.isInvalid() || InitQualType.isNull()) {
13741 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
13742 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
13743 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
13744 getSema().CurContext);
13749 NewVDs.push_back(NewVD);
13750 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
13756 getDerived().transformedLocalDecl(OldVD, NewVDs);
13760 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
13768 SourceLocation EllipsisLoc;
13769 if (
C->isPackExpansion()) {
13771 bool ShouldExpand =
false;
13772 bool RetainExpansion =
false;
13773 std::optional<unsigned> NumExpansions;
13774 if (getDerived().TryExpandParameterPacks(
C->getEllipsisLoc(),
13777 ShouldExpand, RetainExpansion,
13783 if (ShouldExpand) {
13787 auto *Pack = cast<VarDecl>(
C->getCapturedVar());
13788 for (
unsigned I = 0; I != *NumExpansions; ++I) {
13789 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
13790 VarDecl *CapturedVar
13791 = cast_or_null<VarDecl>(getDerived().TransformDecl(
C->getLocation(),
13793 if (!CapturedVar) {
13799 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
13807 EllipsisLoc =
C->getEllipsisLoc();
13811 auto *CapturedVar = cast_or_null<ValueDecl>(
13812 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
13813 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
13819 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
13822 getSema().finishLambdaExplicitCaptures(LSI);
13826 auto TPL = getDerived().TransformTemplateParameterList(
13827 E->getTemplateParameterList());
13828 LSI->GLTemplateParameterList = TPL;
13830 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
13837 TypeSourceInfo *NewCallOpTSI =
nullptr;
13839 auto OldCallOpTypeLoc =
13840 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
13842 auto TransformFunctionProtoTypeLoc =
13843 [
this](TypeLocBuilder &TLB, FunctionProtoTypeLoc FPTL) -> QualType {
13845 return this->TransformFunctionProtoType(
13846 TLB, FPTL,
nullptr, Qualifiers(),
13847 [&](FunctionProtoType::ExceptionSpecInfo &ESI,
bool &Changed) {
13848 return TransformExceptionSpec(FPTL.getBeginLoc(), ESI,
13849 ExceptionStorage, Changed);
13853 QualType NewCallOpType;
13854 TypeLocBuilder NewCallOpTLBuilder;
13856 if (
auto ATL = OldCallOpTypeLoc.getAs<AttributedTypeLoc>()) {
13857 NewCallOpType = this->TransformAttributedType(
13858 NewCallOpTLBuilder, ATL,
13859 [&](TypeLocBuilder &TLB, TypeLoc TL) -> QualType {
13860 return TransformFunctionProtoTypeLoc(
13861 TLB, TL.castAs<FunctionProtoTypeLoc>());
13864 auto FPTL = OldCallOpTypeLoc.castAs<FunctionProtoTypeLoc>();
13865 NewCallOpType = TransformFunctionProtoTypeLoc(NewCallOpTLBuilder, FPTL);
13868 if (NewCallOpType.isNull())
13871 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
13875 if (
auto ATL = NewCallOpTSI->getTypeLoc().getAs<AttributedTypeLoc>()) {
13876 Params = ATL.getModifiedLoc().castAs<FunctionProtoTypeLoc>().getParams();
13878 auto FPTL = NewCallOpTSI->getTypeLoc().castAs<FunctionProtoTypeLoc>();
13879 Params = FPTL.getParams();
13882 getSema().CompleteLambdaCallOperator(
13883 NewCallOperator, E->getCallOperator()->getLocation(),
13884 E->getCallOperator()->getInnerLocStart(),
13885 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
13886 E->getCallOperator()->getConstexprKind(),
13887 E->getCallOperator()->getStorageClass(), Params,
13888 E->hasExplicitResultType());
13890 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
13891 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
13895 Sema::ContextRAII ManglingContext(getSema(),
Class->getDeclContext());
13897 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
13898 if (getDerived().ReplacingOriginal()) {
13899 Numbering = OldClass->getLambdaNumbering();
13902 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
13907 getSema().PushExpressionEvaluationContext(
13910 Sema::CodeSynthesisContext
C;
13912 C.PointOfInstantiation = E->getBody()->getBeginLoc();
13913 getSema().pushCodeSynthesisContext(
C);
13917 Invalid ?
StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
13919 getSema().popCodeSynthesisContext();
13922 FuncScopeCleanup.disable();
13924 if (Body.isInvalid()) {
13925 SavedContext.pop();
13926 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
13934 auto LSICopy = *LSI;
13935 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
13937 SavedContext.pop();
13939 return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getEndLoc(),
13943template<
typename Derived>
13946 return TransformStmt(S);
13949template<
typename Derived>
13958 if (!
C->isImplicit())
13962 if (
C->capturesThis()) {
13963 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
13970 if (
C->capturesVLAType())
13973 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
13977 VarDecl *CapturedVar = cast_or_null<VarDecl>(
13978 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
13983 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
13989template<
typename Derived>
13998 bool ArgumentChanged =
false;
14010 if (!getDerived().AlwaysRebuild() &&
14016 return getDerived().RebuildCXXUnresolvedConstructExpr(
14020template<
typename Derived>
14022TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
14023 CXXDependentScopeMemberExpr *E) {
14028 QualType ObjectType;
14029 if (!E->isImplicitAccess()) {
14030 OldBase = E->getBase();
14031 Base = getDerived().TransformExpr(OldBase);
14032 if (
Base.isInvalid())
14037 bool MayBePseudoDestructor =
false;
14039 E->getOperatorLoc(),
14040 E->isArrow()? tok::arrow : tok::period,
14042 MayBePseudoDestructor);
14043 if (
Base.isInvalid())
14046 ObjectType = ObjectTy.get();
14047 BaseType = ((Expr*)
Base.get())->getType();
14050 BaseType = getDerived().TransformType(E->getBaseType());
14051 ObjectType = BaseType->castAs<PointerType>()->getPointeeType();
14056 NamedDecl *FirstQualifierInScope
14057 = getDerived().TransformFirstQualifierInScope(
14058 E->getFirstQualifierFoundInScope(),
14059 E->getQualifierLoc().getBeginLoc());
14061 NestedNameSpecifierLoc QualifierLoc;
14062 if (E->getQualifier()) {
14064 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
14066 FirstQualifierInScope);
14071 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
14077 DeclarationNameInfo NameInfo
14078 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
14079 if (!NameInfo.getName())
14082 if (!E->hasExplicitTemplateArgs()) {
14085 if (!getDerived().AlwaysRebuild() &&
14086 Base.get() == OldBase &&
14087 BaseType == E->getBaseType() &&
14088 QualifierLoc == E->getQualifierLoc() &&
14089 NameInfo.getName() == E->getMember() &&
14090 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
14093 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
14096 E->getOperatorLoc(),
14099 FirstQualifierInScope,
14104 TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
14105 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14106 E->getNumTemplateArgs(),
14110 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
14113 E->getOperatorLoc(),
14116 FirstQualifierInScope,
14121template <
typename Derived>
14122ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(
14123 UnresolvedMemberExpr *Old) {
14127 if (!Old->isImplicitAccess()) {
14128 Base = getDerived().TransformExpr(Old->getBase());
14129 if (
Base.isInvalid())
14132 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
14133 if (
Base.isInvalid())
14135 BaseType =
Base.get()->getType();
14137 BaseType = getDerived().TransformType(Old->getBaseType());
14140 NestedNameSpecifierLoc QualifierLoc;
14141 if (Old->getQualifierLoc()) {
14143 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
14148 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
14153 if (TransformOverloadExprDecls(Old,
false, R))
14157 if (Old->getNamingClass()) {
14158 CXXRecordDecl *NamingClass = cast_or_null<CXXRecordDecl>(
14159 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
14163 R.setNamingClass(NamingClass);
14166 TemplateArgumentListInfo TransArgs;
14167 if (Old->hasExplicitTemplateArgs()) {
14168 TransArgs.setLAngleLoc(Old->getLAngleLoc());
14169 TransArgs.setRAngleLoc(Old->getRAngleLoc());
14170 if (getDerived().TransformTemplateArguments(
14171 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
14179 NamedDecl *FirstQualifierInScope =
nullptr;
14181 return getDerived().RebuildUnresolvedMemberExpr(
14182 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
14183 TemplateKWLoc, FirstQualifierInScope, R,
14184 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
14187template<
typename Derived>
14189TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) {
14192 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
14193 if (SubExpr.isInvalid())
14196 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
14199 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
14202template<
typename Derived>
14204TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *E) {
14205 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
14206 if (Pattern.isInvalid())
14209 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
14212 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
14213 E->getNumExpansions());
14216template<
typename Derived>
14218TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
14221 if (!E->isValueDependent())
14228 TemplateArgument ArgStorage;
14231 if (E->isPartiallySubstituted()) {
14232 PackArgs = E->getPartialArguments();
14233 }
else if (E->isValueDependent()) {
14235 bool ShouldExpand =
false;
14236 bool RetainExpansion =
false;
14237 std::optional<unsigned> NumExpansions;
14238 if (getDerived().TryExpandParameterPacks(E->getOperatorLoc(), E->getPackLoc(),
14240 ShouldExpand, RetainExpansion,
14246 if (ShouldExpand) {
14247 auto *Pack = E->getPack();
14248 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
14249 ArgStorage = getSema().Context.getPackExpansionType(
14251 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
14252 ArgStorage = TemplateArgument(TemplateName(TTPD), std::nullopt);
14254 auto *VD = cast<ValueDecl>(Pack);
14255 ExprResult DRE = getSema().BuildDeclRefExpr(
14256 VD, VD->getType().getNonLValueExprType(getSema().Context),
14259 if (DRE.isInvalid())
14261 ArgStorage =
new (getSema().Context)
14262 PackExpansionExpr(getSema().Context.DependentTy, DRE.get(),
14263 E->getPackLoc(), std::nullopt);
14265 PackArgs = ArgStorage;
14270 if (!PackArgs.size()) {
14271 auto *Pack = cast_or_null<NamedDecl>(
14272 getDerived().TransformDecl(E->getPackLoc(), E->getPack()));
14275 return getDerived().RebuildSizeOfPackExpr(
14276 E->getOperatorLoc(), Pack, E->getPackLoc(), E->getRParenLoc(),
14277 std::nullopt, std::nullopt);
14281 std::optional<unsigned>
Result = 0;
14282 for (
const TemplateArgument &Arg : PackArgs) {
14283 if (!Arg.isPackExpansion()) {
14288 TemplateArgumentLoc ArgLoc;
14289 InventTemplateArgumentLoc(Arg, ArgLoc);
14292 SourceLocation Ellipsis;
14293 std::optional<unsigned> OrigNumExpansions;
14294 TemplateArgumentLoc Pattern =
14295 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
14296 OrigNumExpansions);
14299 TemplateArgumentLoc OutPattern;
14300 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14301 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
14306 std::optional<unsigned> NumExpansions =
14307 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
14308 if (!NumExpansions) {
14321 return getDerived().RebuildSizeOfPackExpr(
14322 E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(),
14325 TemplateArgumentListInfo TransformedPackArgs(E->getPackLoc(),
14328 TemporaryBase Rebase(*
this, E->getPackLoc(), getBaseEntity());
14329 typedef TemplateArgumentLocInventIterator<
14330 Derived,
const TemplateArgument*> PackLocIterator;
14331 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
14332 PackLocIterator(*
this, PackArgs.end()),
14333 TransformedPackArgs,
true))
14340 bool PartialSubstitution =
false;
14341 for (
auto &Loc : TransformedPackArgs.arguments()) {
14342 Args.push_back(Loc.getArgument());
14343 if (Loc.getArgument().isPackExpansion())
14344 PartialSubstitution =
true;
14347 if (PartialSubstitution)
14348 return getDerived().RebuildSizeOfPackExpr(
14349 E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(),
14350 std::nullopt, Args);
14352 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
14353 E->getPackLoc(), E->getRParenLoc(),
14354 Args.size(), std::nullopt);
14357template <
typename Derived>
14359TreeTransform<Derived>::TransformPackIndexingExpr(PackIndexingExpr *E) {
14360 if (!E->isValueDependent())
14364 ExprResult IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
14365 if (IndexExpr.isInvalid())
14369 if (E->getExpressions().empty()) {
14370 Expr *Pattern = E->getPackIdExpression();
14372 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
14374 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
14378 bool ShouldExpand =
true;
14379 bool RetainExpansion =
false;
14380 std::optional<unsigned> OrigNumExpansions;
14381 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14382 if (getDerived().TryExpandParameterPacks(
14383 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
14384 ShouldExpand, RetainExpansion, NumExpansions))
14386 if (!ShouldExpand) {
14387 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14388 ExprResult Pack = getDerived().TransformExpr(Pattern);
14389 if (Pack.isInvalid())
14391 return getDerived().RebuildPackIndexingExpr(
14392 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
14395 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14396 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14397 ExprResult Out = getDerived().TransformExpr(Pattern);
14398 if (Out.isInvalid())
14400 if (Out.get()->containsUnexpandedParameterPack()) {
14401 Out = getDerived().RebuildPackExpansion(Out.get(), E->getEllipsisLoc(),
14402 OrigNumExpansions);
14403 if (Out.isInvalid())
14406 ExpandedExprs.push_back(Out.get());
14410 if (RetainExpansion) {
14411 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14413 ExprResult Out = getDerived().TransformExpr(Pattern);
14414 if (Out.isInvalid())
14417 Out = getDerived().RebuildPackExpansion(Out.get(), E->getEllipsisLoc(),
14418 OrigNumExpansions);
14419 if (Out.isInvalid())
14421 ExpandedExprs.push_back(Out.get());
14426 if (getDerived().TransformExprs(E->getExpressions().data(),
14427 E->getExpressions().size(),
false,
14432 return getDerived().RebuildPackIndexingExpr(
14433 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
14434 IndexExpr.get(), ExpandedExprs,
14435 ExpandedExprs.size() == 0);
14438template<
typename Derived>
14440TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
14441 SubstNonTypeTemplateParmPackExpr *E) {
14446template<
typename Derived>
14448TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
14449 SubstNonTypeTemplateParmExpr *E) {
14454template<
typename Derived>
14456TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) {
14461template<
typename Derived>
14463TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
14464 MaterializeTemporaryExpr *E) {
14465 return getDerived().TransformExpr(E->getSubExpr());
14468template<
typename Derived>
14470TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
14471 UnresolvedLookupExpr *
Callee =
nullptr;
14472 if (Expr *OldCallee = E->getCallee()) {
14473 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
14474 if (CalleeResult.isInvalid())
14476 Callee = cast<UnresolvedLookupExpr>(CalleeResult.get());
14479 Expr *Pattern = E->getPattern();
14482 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
14483 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
14487 bool Expand =
true;
14488 bool RetainExpansion =
false;
14489 std::optional<unsigned> OrigNumExpansions = E->getNumExpansions(),
14490 NumExpansions = OrigNumExpansions;
14491 if (getDerived().TryExpandParameterPacks(E->getEllipsisLoc(),
14492 Pattern->getSourceRange(),
14494 Expand, RetainExpansion,
14501 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14504 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
14505 if (LHS.isInvalid())
14509 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
14510 if (RHS.isInvalid())
14513 if (!getDerived().AlwaysRebuild() &&
14514 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
14517 return getDerived().RebuildCXXFoldExpr(
14518 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
14519 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
14525 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < NumExpansions) {
14526 SemaRef.
Diag(E->getEllipsisLoc(),
14527 clang::diag::err_fold_expression_limit_exceeded)
14528 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
14529 << E->getSourceRange();
14530 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
14539 bool LeftFold = E->isLeftFold();
14543 if (!LeftFold && RetainExpansion) {
14544 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14546 ExprResult Out = getDerived().TransformExpr(Pattern);
14547 if (Out.isInvalid())
14550 Result = getDerived().RebuildCXXFoldExpr(
14551 Callee, E->getBeginLoc(), Out.get(), E->getOperator(),
14552 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
14557 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14558 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
14559 getSema(), LeftFold ? I : *NumExpansions - I - 1);
14560 ExprResult Out = getDerived().TransformExpr(Pattern);
14561 if (Out.isInvalid())
14564 if (Out.get()->containsUnexpandedParameterPack()) {
14566 Result = getDerived().RebuildCXXFoldExpr(
14567 Callee, E->getBeginLoc(), LeftFold ?
Result.get() : Out.get(),
14568 E->getOperator(), E->getEllipsisLoc(),
14569 LeftFold ? Out.get() :
Result.get(), E->getEndLoc(),
14570 OrigNumExpansions);
14571 }
else if (
Result.isUsable()) {
14573 Expr *LHS = LeftFold ?
Result.get() : Out.get();
14574 Expr *RHS = LeftFold ? Out.get() :
Result.get();
14576 UnresolvedSet<16> Functions;
14577 Functions.append(
Callee->decls_begin(),
Callee->decls_end());
14578 Result = getDerived().RebuildCXXOperatorCallExpr(
14580 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
14581 Functions, LHS, RHS);
14583 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
14584 E->getOperator(), LHS, RHS);
14595 if (LeftFold && RetainExpansion) {
14596 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14598 ExprResult Out = getDerived().TransformExpr(Pattern);
14599 if (Out.isInvalid())
14602 Result = getDerived().RebuildCXXFoldExpr(
14603 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
14604 E->getEllipsisLoc(), Out.get(), E->getEndLoc(), OrigNumExpansions);
14612 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
14618template <
typename Derived>
14620TreeTransform<Derived>::TransformCXXParenListInitExpr(CXXParenListInitExpr *E) {
14623 if (TransformExprs(InitExprs.data(), InitExprs.size(),
true,
14627 return getDerived().RebuildParenListExpr(E->getBeginLoc(), TransformedInits,
14631template<
typename Derived>
14633TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
14634 CXXStdInitializerListExpr *E) {
14635 return getDerived().TransformExpr(E->getSubExpr());
14638template<
typename Derived>
14640TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) {
14644template<
typename Derived>
14646TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
14650template<
typename Derived>
14652TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *E) {
14653 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14654 if (SubExpr.isInvalid())
14657 if (!getDerived().AlwaysRebuild() &&
14658 SubExpr.get() == E->getSubExpr())
14661 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
14664template<
typename Derived>
14666TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *E) {
14669 bool ArgChanged =
false;
14670 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
14671 false, Elements, &ArgChanged))
14674 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14677 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
14682template<
typename Derived>
14684TreeTransform<Derived>::TransformObjCDictionaryLiteral(
14685 ObjCDictionaryLiteral *E) {
14688 bool ArgChanged =
false;
14689 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
14690 ObjCDictionaryElement OrigElement = E->getKeyValueElement(I);
14692 if (OrigElement.isPackExpansion()) {
14695 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
14696 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
14697 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
14701 bool Expand =
true;
14702 bool RetainExpansion =
false;
14703 std::optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
14704 std::optional<unsigned> NumExpansions = OrigNumExpansions;
14705 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
14706 OrigElement.Value->getEndLoc());
14707 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
14708 PatternRange, Unexpanded, Expand,
14709 RetainExpansion, NumExpansions))
14716 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14717 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
14718 if (Key.isInvalid())
14721 if (Key.get() != OrigElement.Key)
14725 if (
Value.isInvalid())
14728 if (
Value.get() != OrigElement.Value)
14731 ObjCDictionaryElement Expansion = {
14732 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
14734 Elements.push_back(Expansion);
14744 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14745 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
14746 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
14747 if (Key.isInvalid())
14751 if (
Value.isInvalid())
14754 ObjCDictionaryElement Element = {
14755 Key.get(),
Value.get(), SourceLocation(), NumExpansions
14761 if (Key.get()->containsUnexpandedParameterPack() ||
14762 Value.get()->containsUnexpandedParameterPack())
14763 Element.EllipsisLoc = OrigElement.EllipsisLoc;
14765 Elements.push_back(Element);
14775 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
14776 if (Key.isInvalid())
14779 if (Key.get() != OrigElement.Key)
14784 = getDerived().TransformExpr(OrigElement.Value);
14785 if (
Value.isInvalid())
14788 if (
Value.get() != OrigElement.Value)
14791 ObjCDictionaryElement Element = {Key.get(),
Value.get(), SourceLocation(),
14793 Elements.push_back(Element);
14796 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14799 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
14803template<
typename Derived>
14805TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) {
14806 TypeSourceInfo *EncodedTypeInfo
14807 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
14808 if (!EncodedTypeInfo)
14811 if (!getDerived().AlwaysRebuild() &&
14812 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
14815 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
14817 E->getRParenLoc());
14820template<
typename Derived>
14822TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
14827 return getDerived().TransformExpr(E->getSubExpr());
14830template<
typename Derived>
14832TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
14833 TypeSourceInfo *TSInfo
14834 = getDerived().TransformType(E->getTypeInfoAsWritten());
14842 if (!getDerived().AlwaysRebuild() &&
14843 TSInfo == E->getTypeInfoAsWritten() &&
14844 Result.get() == E->getSubExpr())
14848 E->getBridgeKeywordLoc(), TSInfo,
14852template <
typename Derived>
14853ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
14854 ObjCAvailabilityCheckExpr *E) {
14858template<
typename Derived>
14860TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
14862 bool ArgChanged =
false;
14864 Args.reserve(E->getNumArgs());
14865 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
14871 TypeSourceInfo *ReceiverTypeInfo
14872 = getDerived().TransformType(E->getClassReceiverTypeInfo());
14873 if (!ReceiverTypeInfo)
14877 if (!getDerived().AlwaysRebuild() &&
14878 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
14883 E->getSelectorLocs(SelLocs);
14884 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
14887 E->getMethodDecl(),
14894 if (!E->getMethodDecl())
14899 E->getSelectorLocs(SelLocs);
14900 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
14903 E->getReceiverType(),
14904 E->getMethodDecl(),
14912 "Only class and instance messages may be instantiated");
14914 = getDerived().TransformExpr(E->getInstanceReceiver());
14915 if (Receiver.isInvalid())
14919 if (!getDerived().AlwaysRebuild() &&
14920 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
14925 E->getSelectorLocs(SelLocs);
14926 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
14929 E->getMethodDecl(),
14935template<
typename Derived>
14937TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) {
14941template<
typename Derived>
14943TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) {
14947template<
typename Derived>
14949TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
14952 if (
Base.isInvalid())
14958 if (!getDerived().AlwaysRebuild() &&
14959 Base.get() == E->getBase())
14962 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
14964 E->isArrow(), E->isFreeIvar());
14967template<
typename Derived>
14969TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
14972 if (!E->isObjectReceiver())
14977 if (
Base.isInvalid())
14983 if (!getDerived().AlwaysRebuild() &&
14984 Base.get() == E->getBase())
14987 if (E->isExplicitProperty())
14988 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
14989 E->getExplicitProperty(),
14992 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
14994 E->getImplicitPropertyGetter(),
14995 E->getImplicitPropertySetter(),
14999template<
typename Derived>
15001TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
15004 if (
Base.isInvalid())
15008 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
15009 if (Key.isInvalid())
15013 if (!getDerived().AlwaysRebuild() &&
15014 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
15017 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
15018 Base.get(), Key.get(),
15019 E->getAtIndexMethodDecl(),
15020 E->setAtIndexMethodDecl());
15023template<
typename Derived>
15025TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) {
15028 if (
Base.isInvalid())
15032 if (!getDerived().AlwaysRebuild() &&
15033 Base.get() == E->getBase())
15036 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
15041template<
typename Derived>
15043TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) {
15044 bool ArgumentChanged =
false;
15046 SubExprs.reserve(E->getNumSubExprs());
15047 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
15048 SubExprs, &ArgumentChanged))
15051 if (!getDerived().AlwaysRebuild() &&
15055 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
15057 E->getRParenLoc());
15060template<
typename Derived>
15062TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *E) {
15063 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
15064 if (SrcExpr.isInvalid())
15067 TypeSourceInfo *
Type = getDerived().TransformType(E->getTypeSourceInfo());
15071 if (!getDerived().AlwaysRebuild() &&
15072 Type == E->getTypeSourceInfo() &&
15073 SrcExpr.get() == E->getSrcExpr())
15076 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
15077 SrcExpr.get(), Type,
15078 E->getRParenLoc());
15081template<
typename Derived>
15083TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
15084 BlockDecl *oldBlock = E->getBlockDecl();
15087 BlockScopeInfo *blockScope = SemaRef.
getCurBlock();
15090 blockScope->TheDecl->setBlockMissingReturnType(
15091 oldBlock->blockMissingReturnType());
15096 const FunctionProtoType *exprFunctionType = E->getFunctionType();
15099 Sema::ExtParameterInfoBuilder extParamInfos;
15100 if (getDerived().TransformFunctionTypeParams(
15101 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
15102 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
15104 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
15108 QualType exprResultType =
15109 getDerived().TransformType(exprFunctionType->getReturnType());
15111 auto epi = exprFunctionType->getExtProtoInfo();
15112 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
15115 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
15119 if (!params.empty())
15120 blockScope->TheDecl->setParams(params);
15122 if (!oldBlock->blockMissingReturnType()) {
15123 blockScope->HasImplicitReturnType =
false;
15124 blockScope->ReturnType = exprResultType;
15128 StmtResult body = getDerived().TransformStmt(E->getBody());
15129 if (body.isInvalid()) {
15130 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
15138 for (
const auto &I : oldBlock->captures()) {
15139 VarDecl *oldCapture = I.getVariable();
15142 if (oldCapture->isParameterPack())
15145 VarDecl *newCapture =
15146 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
15148 assert(blockScope->CaptureMap.count(newCapture));
15154 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
15155 "this pointer isn't captured in the old block");
15163template<
typename Derived>
15165TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *E) {
15166 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
15167 if (SrcExpr.isInvalid())
15170 QualType
Type = getDerived().TransformType(E->getType());
15172 return SemaRef.
BuildAsTypeExpr(SrcExpr.get(), Type, E->getBuiltinLoc(),
15173 E->getRParenLoc());
15176template<
typename Derived>
15178TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *E) {
15179 bool ArgumentChanged =
false;
15181 SubExprs.reserve(E->getNumSubExprs());
15182 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
15183 SubExprs, &ArgumentChanged))
15186 if (!getDerived().AlwaysRebuild() &&
15190 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
15191 E->getOp(), E->getRParenLoc());
15198template<
typename Derived>
15202 getDerived().getBaseEntity());
15205template<
typename Derived>
15209 getDerived().getBaseEntity());
15212template<
typename Derived>
15215 bool WrittenAsLValue,
15218 Sigil, getDerived().getBaseEntity());
15221template<
typename Derived>
15227 getDerived().getBaseEntity());
15230template<
typename Derived>
15238 ProtocolLAngleLoc, Protocols,
15239 ProtocolLocs, ProtocolRAngleLoc,
15243template<
typename Derived>
15255 TypeArgsRAngleLoc, ProtocolLAngleLoc,
15256 Protocols, ProtocolLocs, ProtocolRAngleLoc,
15261template<
typename Derived>
15268template <
typename Derived>
15271 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15272 if (SizeExpr || !Size)
15274 IndexTypeQuals, BracketsRange,
15275 getDerived().getBaseEntity());
15283 for (
const auto &T : Types)
15295 IndexTypeQuals, BracketsRange,
15296 getDerived().getBaseEntity());
15299template <
typename Derived>
15302 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15303 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
15304 IndexTypeQuals, BracketsRange);
15307template <
typename Derived>
15311 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
15312 IndexTypeQuals, BracketsRange);
15315template <
typename Derived>
15318 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15319 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
15321 IndexTypeQuals, BracketsRange);
15324template <
typename Derived>
15327 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
15328 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
15330 IndexTypeQuals, BracketsRange);
15333template <
typename Derived>
15340template <
typename Derived>
15342 unsigned NumElements,
15348template <
typename Derived>
15355template<
typename Derived>
15357 unsigned NumElements,
15360 NumElements,
true);
15367template<
typename Derived>
15375template <
typename Derived>
15377 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
15382template <
typename Derived>
15390template<
typename Derived>
15396 getDerived().getBaseLocation(),
15397 getDerived().getBaseEntity(),
15401template<
typename Derived>
15406template<
typename Derived>
15409 assert(D &&
"no decl found");
15413 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
15417 if (UPD->expansions().empty()) {
15418 getSema().Diag(Loc, diag::err_using_pack_expansion_empty)
15419 << UPD->isCXXClassMember() << UPD;
15428 for (
auto *E : UPD->expansions()) {
15429 QualType ThisT = RebuildUnresolvedUsingType(Loc, E);
15437 assert(getSema().Context.
hasSameType(ThisT, T) &&
15438 "mismatched resolved types in using pack expansion");
15440 return T.
isNull() ? FallbackT : T;
15441 }
else if (
auto *Using = dyn_cast<UsingDecl>(D)) {
15442 assert(Using->hasTypename() &&
15443 "UnresolvedUsingTypenameDecl transformed to non-typename using");
15446 assert(++Using->shadow_begin() == Using->shadow_end());
15455 assert(isa<UnresolvedUsingTypenameDecl>(D) &&
15456 "UnresolvedUsingTypenameDecl transformed to non-using decl");
15458 cast<UnresolvedUsingTypenameDecl>(D));
15462template <
typename Derived>
15468template<
typename Derived>
15474template <
typename Derived>
15479template <
typename Derived>
15485 FullySubstituted, Expansions);
15488template<
typename Derived>
15495template<
typename Derived>
15503template<
typename Derived>
15509template<
typename Derived>
15517template <
typename Derived>
15528template <
typename Derived>
15534template<
typename Derived>
15543template<
typename Derived>
15551 bool AllowInjectedClassName) {
15555 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
15558 AllowInjectedClassName);
15559 return Template.
get();
15562template<
typename Derived>
15569 bool AllowInjectedClassName) {
15572 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
15573 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
15575 getSema().ActOnTemplateName(
15577 false, Template, AllowInjectedClassName);
15578 return Template.
get();
15581template <
typename Derived>
15586 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
15607 if (Op == OO_Subscript) {
15608 if (!
First->getType()->isOverloadableType() &&
15610 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
15612 }
else if (Op == OO_Arrow) {
15615 if (
First->getType()->isDependentType())
15619 }
else if (Second ==
nullptr || isPostIncDec) {
15620 if (!
First->getType()->isOverloadableType() ||
15621 (Op == OO_Amp && getSema().isQualifiedMemberAccess(
First))) {
15628 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
15631 if (!
First->getType()->isOverloadableType() &&
15647 unsigned NumArgs = 1 + (Second !=
nullptr);
15650 if (NumArgs == 1 || isPostIncDec) {
15660 OpLoc, Opc, Functions, Args[0], Args[1], RequiresADL);
15667template<
typename Derived>
15682 ->template getAs<RecordType>())){
15685 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
15686 CCLoc, TildeLoc, Destroyed);
15698 if (!ScopeType->getType()->getAs<
TagType>()) {
15699 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
15700 diag::err_expected_class_or_namespace)
15701 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
15709 return getSema().BuildMemberReferenceExpr(
Base, BaseType,
15710 OperatorLoc, isArrow,
15718template<
typename Derived>
15726 for (
unsigned I = 0; I < NumParams; ++I) {
15727 if (I != ContextParamPos) {
15733 Params.push_back(std::make_pair(StringRef(), QualType()));
15736 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
15737 S->getCapturedRegionKind(), Params);
15740 Sema::CompoundScopeRAII CompoundScope(getSema());
15741 Body = getDerived().TransformStmt(S->getCapturedStmt());
15744 if (Body.isInvalid()) {
15745 getSema().ActOnCapturedRegionError();
15749 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.
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 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
Type source information for an btf_tag attributed type.
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
void setIsVariadic(bool value)
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
Represents binding an expression to a temporary.
CXXCatchStmt - This represents a C++ catch block.
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
Represents a call to an inherited base class constructor from an inheriting constructor.
Abstract class common to all of the C++ "named"/"keyword" casts.
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.
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
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.
const IdentifierInfo * getIdentifier() const
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,...
QualType getNamedType() const
Retrieve the type named by the qualified-id.
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.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
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.
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 ...
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...
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, 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.
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
IdentifierInfo * getIdentifier() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of 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.
UnqualTypeLoc getUnqualifiedLoc() const
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
bool isSpelledAsLValue() 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.
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.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' 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.
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.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
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.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
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)
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
@ 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)
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
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()
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
void ActOnStmtExprError()
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
VarDecl * buildCoroutinePromise(SourceLocation Loc)
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 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 BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
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 ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
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)
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
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.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
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.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult ActOnEndOpenACCStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation EndLoc, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
ASTContext & getASTContext() const
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
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 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.
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 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)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
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...
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
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 *.
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.
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
const LangOptions & getLangOpts() const
ExprResult BuildSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
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.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind PrevMappedDirective=llvm::omp::OMPD_unknown)
void ActOnOpenACCConstruct(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the construct has been parsed, but clauses haven't been parsed.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
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 ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
DeclContext * getCurLexicalContext() const
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
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)
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.
bool buildCoroutineParameterMoves(SourceLocation Loc)
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
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.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
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.
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
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.
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.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool EmptyPack=false)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
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)
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
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...
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
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)
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
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={})
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.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
ParsedType getDestructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
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 ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
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.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
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.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
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.
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' 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.
@ 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),...
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.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
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,...
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.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
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 BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
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)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
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)
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
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)
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
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)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
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.
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
StmtResult ActOnOpenACCAssociatedStmt(OpenACCDirectiveKind K, StmtResult AssocStmt)
Called when we encounter an associated statement for our construct, this should check legality of the...
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, UnresolvedLookupExpr *AsULE=nullptr)
Builds an expression which might be an implicit member expression.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
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...
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
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.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
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.
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)
TemplateArgumentLocInventIterator()
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...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
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).
TypeLocClass getTypeLocClass() const
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
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...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
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
@ 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'.
@ Device
'device' clause, allowed on the 'update' construct.
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.
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.
@ BuildingDeductionGuides
We are building deduction guides for a class.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.