13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
157 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
161 return static_cast<const Derived&
>(*this);
229 if (Location.isValid())
230 Self.getDerived().setBase(Location, Entity);
234 Self.getDerived().setBase(OldLocation, OldEntity);
307 bool FailOnPackProducingTemplates,
308 bool &ShouldExpand,
bool &RetainExpansion,
310 ShouldExpand =
false;
338 struct ForgetSubstitutionRAII {
344 Old =
Self.ForgetSubstitution();
347 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
447 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
448#include "clang/Basic/AttrList.inc"
458 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
459 const X##Attr *A) { \
460 return getDerived().Transform##X##Attr(A); \
462#include "clang/Basic/AttrList.inc"
508 bool *ArgChanged =
nullptr);
517 llvm::DenseMap<Decl *, Decl *>::iterator Known
520 return Known->second;
548 assert(
New.size() == 1 &&
549 "must override transformedLocalDecl if performing pack expansion");
587 NamedDecl *FirstQualifierInScope =
nullptr);
632 NamedDecl *FirstQualifierInScope =
nullptr,
633 bool AllowInjectedClassName =
false);
645 bool Uneval =
false);
672 bool Uneval =
false) {
691 template<
typename InputIterator>
695 bool Uneval =
false);
716 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
720#define ABSTRACT_TYPELOC(CLASS, PARENT)
721#define TYPELOC(CLASS, PARENT) \
722 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
723#include "clang/AST/TypeLocNodes.def"
727 bool SuppressObjCLifetime);
731 bool SuppressObjCLifetime);
733 template<
typename Fn>
751 bool AllowInjectedClassName);
779 return getDerived().TransformFunctionTypeParams(
780 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
798 KWLoc, Params,
nullptr,
799 nullptr, PTypes, &TransParams, PInfos))
813 bool ExpectParameterPack);
840 bool IsAddressOfOperand,
848 bool IsAddressOfOperand);
856#define STMT(Node, Parent) \
857 LLVM_ATTRIBUTE_NOINLINE \
858 StmtResult Transform##Node(Node *S);
859#define VALUESTMT(Node, Parent) \
860 LLVM_ATTRIBUTE_NOINLINE \
861 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
862#define EXPR(Node, Parent) \
863 LLVM_ATTRIBUTE_NOINLINE \
864 ExprResult Transform##Node(Node *E);
865#define ABSTRACT_STMT(Stmt)
866#include "clang/AST/StmtNodes.inc"
868#define GEN_CLANG_CLAUSE_CLASS
869#define CLAUSE_CLASS(Enum, Str, Class) \
870 LLVM_ATTRIBUTE_NOINLINE \
871 OMPClause *Transform##Class(Class *S);
872#include "llvm/Frontend/OpenMP/OMP.inc"
950 const llvm::APInt *Size,
Expr *SizeExpr,
951 unsigned IndexTypeQuals,
SourceRange BracketsRange);
960 const llvm::APInt &Size,
Expr *SizeExpr,
961 unsigned IndexTypeQuals,
971 unsigned IndexTypeQuals,
981 unsigned IndexTypeQuals,
992 unsigned IndexTypeQuals,
1030 unsigned NumColumns);
1047 Expr *AddrSpaceExpr,
1071 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1084 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1094 return SemaRef.Context.getCanonicalTagType(Tag);
1111 UnaryTransformType::UTTKind UKind,
1123 bool FullySubstituted,
1137 TypeConstraintConcept,
1138 TypeConstraintArgs);
1145 return SemaRef.Context.getDeducedTemplateSpecializationType(
1164 return SemaRef.BuildParenType(InnerType);
1177 bool DeducedTSTContext) {
1179 SS.
Adopt(QualifierLoc);
1183 if (!
SemaRef.computeDeclContext(SS))
1191 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1192 *Id, IdLoc, DeducedTSTContext);
1205 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1210 switch (
Result.getResultKind()) {
1221 llvm_unreachable(
"Tag lookup cannot find non-tags");
1233 switch (
Result.getResultKind()) {
1239 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1240 << SomeDecl << NTK << Kind;
1245 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1251 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1253 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1254 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1310 bool AllowInjectedClassName);
1323 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1339 Decl *AssociatedDecl,
unsigned Index,
1342 ArgPack, AssociatedDecl, Index, Final);
1396 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1406 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1408 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1420 Then, ElseLoc, Else);
1474 Inc, RParenLoc, Body);
1519 bool IsVolatile,
unsigned NumOutputs,
1526 NumInputs, Names, Constraints, Exprs,
1527 AsmString, Clobbers, NumLabels, RParenLoc);
1536 StringRef AsmString,
1537 unsigned NumOutputs,
unsigned NumInputs,
1543 NumOutputs, NumInputs,
1544 Constraints, Clobbers, Exprs, EndLoc);
1573 CoawaitLoc, Operand, OpCoawaitLookup);
1577 Suspend.
get(),
true);
1678 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1690 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1704 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1730 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1791 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1827 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1840 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1853 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1904 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1932 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1933 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1934 UnresolvedReductions);
1948 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1949 ReductionId, UnresolvedReductions);
1964 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1965 ReductionId, UnresolvedReductions);
1978 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1979 StepModifierLoc, EndLoc);
1992 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2052 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2065 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2080 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2081 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2082 ColonLoc, VarList, Locs,
2083 false, UnresolvedMappers);
2100 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2101 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2149 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2162 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2197 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2212 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2213 ColonLoc, VarList, Locs, UnresolvedMappers);
2228 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2229 ColonLoc, VarList, Locs, UnresolvedMappers);
2280 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2327 StartLoc, LParenLoc, EndLoc,
Data);
2340 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2352 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2365 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2376 LParenLoc, VarLoc, EndLoc);
2388 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2527 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2575 ForLoc, Element, Collection, RParenLoc);
2593 StartLoc, IdLoc, Id);
2630 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2631 if (RangeStmt->isSingleDecl()) {
2632 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2633 if (RangeVar->isInvalidDecl())
2636 Expr *RangeExpr = RangeVar->getInit();
2643 diag::err_objc_for_range_init_stmt)
2644 <<
Init->getSourceRange();
2647 ForLoc, LoopVar, RangeExpr, RParenLoc);
2654 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2668 QualifierLoc, NameInfo, Nested);
2730 SS.
Adopt(QualifierLoc);
2842 if (IsOMPArraySection)
2844 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2845 Stride, RBracketLoc);
2847 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2848 "Stride/second colon not allowed for OpenACC");
2851 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2863 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2875 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2885 Expr *ExecConfig =
nullptr) {
2887 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2894 nullptr, Callee, LParenLoc, Args, RParenLoc);
2912 if (!
Member->getDeclName()) {
2916 assert(
Member->getType()->isRecordType() &&
2917 "unnamed member not of record type?");
2930 if (!isArrow &&
Base->isPRValue()) {
2945 SS.
Adopt(QualifierLoc);
2948 if (
Base->containsErrors())
2953 if (isArrow && !BaseType->isPointerType())
2962 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2967 ->getAsCXXRecordDecl()) {
2971 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2979 FirstQualifierInScope,
2980 R, ExplicitTemplateArgs,
2990 bool ForFoldExpression =
false) {
3068 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3081 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3121 unsigned NumUserSpecifiedExprs,
3126 InitLoc, LParenLoc, RParenLoc);
3156 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3168 Expr *ControllingExpr,
3173 ControllingExpr, Types, Exprs);
3188 ControllingType, Types, Exprs);
3221 case Stmt::CXXStaticCastExprClass:
3222 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3223 RAngleLoc, LParenLoc,
3224 SubExpr, RParenLoc);
3226 case Stmt::CXXDynamicCastExprClass:
3227 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3228 RAngleLoc, LParenLoc,
3229 SubExpr, RParenLoc);
3231 case Stmt::CXXReinterpretCastExprClass:
3232 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3233 RAngleLoc, LParenLoc,
3237 case Stmt::CXXConstCastExprClass:
3238 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3239 RAngleLoc, LParenLoc,
3240 SubExpr, RParenLoc);
3242 case Stmt::CXXAddrspaceCastExprClass:
3243 return getDerived().RebuildCXXAddrspaceCastExpr(
3244 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3247 llvm_unreachable(
"Invalid C++ named cast");
3325 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3337 bool ListInitialization) {
3341 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3343 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3344 RParenLoc, ListInitialization);
3346 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3348 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3352 ListInitialization);
3416 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3426 bool IsThrownVariableInScope) {
3436 Expr *RewrittenExpr) {
3438 RewrittenExpr,
getSema().CurContext);
3472 std::optional<Expr *> ArraySize,
3491 bool IsGlobalDelete,
3542 bool IsAddressOfOperand,
3545 SS.
Adopt(QualifierLoc);
3547 if (TemplateArgs || TemplateKWLoc.
isValid())
3549 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3552 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3574 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3575 bool ListInitialization,
bool StdInitListInitialization,
3582 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3585 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3592 HadMultipleCandidates,
3594 StdInitListInitialization,
3595 RequiresZeroInit, ConstructKind,
3603 bool ConstructsVBase,
3604 bool InheritedFromVBase) {
3606 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3617 bool ListInitialization) {
3619 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3630 bool ListInitialization) {
3632 RParenLoc, ListInitialization);
3649 SS.
Adopt(QualifierLoc);
3651 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3652 OperatorLoc, IsArrow,
3654 FirstQualifierInScope,
3656 TemplateArgs,
nullptr);
3672 SS.
Adopt(QualifierLoc);
3674 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3675 OperatorLoc, IsArrow,
3677 FirstQualifierInScope,
3678 R, TemplateArgs,
nullptr);
3686 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3699 RParenLoc, Length, PartialArgs);
3704 Expr *PackIdExpression,
Expr *IndexExpr,
3706 bool FullySubstituted =
false) {
3708 IndexExpr, RSquareLoc, ExpandedExprs,
3738 NamedConcept, TALI);
3756 LocalParameters, RParenLoc, Requirements,
3763 return SemaRef.BuildTypeRequirement(SubstDiag);
3767 return SemaRef.BuildTypeRequirement(
T);
3775 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3782 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3789 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3794 return SemaRef.BuildNestedRequirement(Constraint);
3810 Expr **Elements,
unsigned NumElements) {
3820 RB,
Base, Key, getterMethod, setterMethod);
3839 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3851 return SemaRef.ObjC().BuildClassMessage(
3852 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3865 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3868 SelectorLocs, RBracLoc, Args);
3880 return Method->isInstanceMethod()
3881 ?
SemaRef.ObjC().BuildInstanceMessage(
3882 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3883 SelectorLocs, RBracLoc, Args)
3884 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3886 SelectorLocs, RBracLoc, Args);
3895 bool IsArrow,
bool IsFreeIvar) {
3904 if (IsFreeIvar &&
Result.isUsable())
3941 PropertyLoc,
Base));
3970 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
3973 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3981 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
3982 CK_BuiltinFnToFnPtr).get();
3998 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4013 EllipsisLoc, NumExpansions);
4037 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4073 EllipsisLoc, RHS, RParenLoc,
4082 Init->containsUnexpandedParameterPack();
4083 else if (PVD->hasUninstantiatedDefaultArg())
4085 PVD->getUninstantiatedDefaultArg()
4086 ->containsUnexpandedParameterPack();
4240 Exprs.push_back(DevNumExpr);
4241 llvm::append_range(Exprs, QueueIdExprs);
4285 ObjectType, FirstQualifierInScope);
4291 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4292 DependentNameTypeLoc TL,
4293 bool DeducibleTSTContext,
4294 QualType ObjectType = QualType(),
4295 NamedDecl *UnqualLookup =
nullptr);
4298 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4303 OpenACCDirectiveKind DirKind,
4304 const OpenACCClause *OldClause);
4307template <
typename Derived>
4317#define STMT(Node, Parent) \
4318 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4319#define VALUESTMT(Node, Parent) \
4320 case Stmt::Node##Class: \
4321 return getDerived().Transform##Node(cast<Node>(S), SDK);
4322#define ABSTRACT_STMT(Node)
4323#define EXPR(Node, Parent)
4324#include "clang/AST/StmtNodes.inc"
4327#define STMT(Node, Parent)
4328#define ABSTRACT_STMT(Stmt)
4329#define EXPR(Node, Parent) case Stmt::Node##Class:
4330#include "clang/AST/StmtNodes.inc"
4335 E =
getSema().ActOnStmtExprResult(E);
4343template<
typename Derived>
4351#define GEN_CLANG_CLAUSE_CLASS
4352#define CLAUSE_CLASS(Enum, Str, Class) \
4354 return getDerived().Transform##Class(cast<Class>(S));
4355#include "llvm/Frontend/OpenMP/OMP.inc"
4362template<
typename Derived>
4369#define STMT(Node, Parent) case Stmt::Node##Class: break;
4370#define ABSTRACT_STMT(Stmt)
4371#define EXPR(Node, Parent) \
4372 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4373#include "clang/AST/StmtNodes.inc"
4379template<
typename Derived>
4387 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4388 Init = FE->getSubExpr();
4390 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4396 Init = MTE->getSubExpr();
4399 Init = Binder->getSubExpr();
4402 Init = ICE->getSubExprAsWritten();
4405 dyn_cast<CXXStdInitializerListExpr>(
Init))
4442 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4443 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4444 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4445 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4447 bool ArgChanged =
false;
4449 true, NewArgs, &ArgChanged))
4459 if (
Parens.isInvalid()) {
4462 assert(NewArgs.empty() &&
4463 "no parens or braces but have direct init with arguments?");
4470template<
typename Derived>
4476 for (
unsigned I = 0; I != NumInputs; ++I) {
4486 Expr *Pattern = Expansion->getPattern();
4489 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4490 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4495 bool RetainExpansion =
false;
4496 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4500 Unexpanded,
true, Expand,
4501 RetainExpansion, NumExpansions))
4514 Expansion->getEllipsisLoc(),
4516 if (Out.isInvalid())
4521 Outputs.push_back(Out.get());
4527 if (ArgChanged) *ArgChanged =
true;
4531 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4534 if (Out.isInvalid())
4537 if (Out.get()->containsUnexpandedParameterPack()) {
4539 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4540 if (Out.isInvalid())
4544 Outputs.push_back(Out.get());
4549 if (RetainExpansion) {
4550 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4553 if (Out.isInvalid())
4557 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4558 if (Out.isInvalid())
4561 Outputs.push_back(Out.get());
4568 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4573 if (
Result.get() != Inputs[I] && ArgChanged)
4576 Outputs.push_back(
Result.get());
4582template <
typename Derived>
4593 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4599 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4608 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4615template <
typename Derived>
4623 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4635 llvm_unreachable(
"unexpected null nested name specifier");
4666 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4667 QualifierLoc, ObjectType, FirstQualifierInScope);
4671 FirstQualifierInScope =
nullptr;
4673 SS.
Adopt(QualifierLoc);
4677 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4679 FirstQualifierInScope,
false))
4687 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4688 FirstQualifierInScope);
4694 if (
T->isDependentType() ||
T->isRecordType() ||
4695 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4696 if (
T->isEnumeralType())
4698 diag::warn_cxx98_compat_enum_nested_name_spec);
4705 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4729template<
typename Derived>
4749 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4756 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4766 NewTInfo =
getDerived().TransformType(OldTInfo);
4769 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4777 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4790 llvm_unreachable(
"Unknown name kind.");
4793template <
typename Derived>
4797 QualType ObjectType,
bool AllowInjectedClassName) {
4799 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4800 ObjectType, AllowInjectedClassName);
4802 NameLoc, ObjectType,
4803 AllowInjectedClassName);
4806template <
typename Derived>
4810 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4812 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4815 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4816 QualifierLoc, ObjectType, FirstQualifierInScope);
4823 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4824 FirstQualifierInScope, AllowInjectedClassName);
4825 if (NewUnderlyingName.
isNull())
4827 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4831 NewUnderlyingName == UnderlyingName)
4834 SS.
Adopt(QualifierLoc);
4835 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4841 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4842 QualifierLoc, ObjectType, FirstQualifierInScope);
4856 SS.
Adopt(QualifierLoc);
4857 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4858 NameLoc, ObjectType,
4859 AllowInjectedClassName);
4864 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4871 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4875 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4876 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4879 Decl *AssociatedDecl =
4880 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4882 AssociatedDecl == S->getAssociatedDecl())
4884 return SemaRef.Context.getSubstTemplateTemplateParm(
4885 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4890 "DeducedTemplateName should not escape partial ordering");
4894 assert(!QualifierLoc &&
"Unexpected qualifier");
4901 assert(!QualifierLoc &&
4902 "Unexpected qualified SubstTemplateTemplateParmPack");
4904 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4905 SubstPack->getIndex(), SubstPack->getFinal());
4909 llvm_unreachable(
"overloaded function decl survived to here");
4912template <
typename Derived>
4917 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4923template<
typename Derived>
4927 Output =
getSema().getTrivialTemplateArgumentLoc(
4931template <
typename Derived>
4939 llvm_unreachable(
"Unexpected TemplateArgument");
4962 if (NewT ==
T && D == NewD)
4979 llvm_unreachable(
"unexpected template argument kind");
5011 llvm_unreachable(
"Caller should expand pack expansions");
5027 E =
SemaRef.ActOnConstantExpression(E);
5042template<
typename Derived,
typename InputIterator>
5050 typedef typename std::iterator_traits<InputIterator>::difference_type
5065 : Self(Self), Iter(Iter) { }
5080 Self.InventTemplateArgumentLoc(*Iter,
Result);
5088 return X.Iter == Y.Iter;
5093 return X.Iter != Y.Iter;
5097template<
typename Derived>
5098template<
typename InputIterator>
5114 PackLocIterator(*
this, In.getArgument().pack_begin()),
5115 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5122 if (In.getArgument().isPackExpansion()) {
5134 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5144 if (Out.getArgument().containsUnexpandedParameterPack()) {
5147 if (Out.getArgument().isNull())
5157 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5165 if (Out.getArgument().isNull())
5186template <
typename Derived>
5197 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5200 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5201 if (IsLateExpansionAttempt) {
5206 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5208 if (!SawPackTypes) {
5213 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5221 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5227 if (ComputeInfo(In,
false, Info, Pattern))
5239 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5240 std::in_place,
getSema(), std::nullopt);
5246 if (Out.getArgument().isNull())
5283 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5284 if (ComputeInfo(Out,
true, Info, OutPattern))
5297template<
typename Derived>
5315template<
typename Derived>
5335template<
typename Derived>
5338 switch (
T.getTypeLocClass()) {
5339#define ABSTRACT_TYPELOC(CLASS, PARENT)
5340#define TYPELOC(CLASS, PARENT) \
5341 case TypeLoc::CLASS: \
5342 return getDerived().Transform##CLASS##Type(TLB, \
5343 T.castAs<CLASS##TypeLoc>());
5344#include "clang/AST/TypeLocNodes.def"
5347 llvm_unreachable(
"unhandled type loc!");
5350template<
typename Derived>
5363template<
typename Derived>
5401template<
typename Derived>
5406 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5407 auto SuppressObjCLifetime =
5408 T.getType().getLocalQualifiers().hasObjCLifetime();
5410 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5411 SuppressObjCLifetime);
5412 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5413 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5414 TLB, STTP, SuppressObjCLifetime);
5416 Result = getDerived().TransformType(TLB, UnqualTL);
5435template <
typename Derived>
5445 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5452 if (
T.getPointerAuth().isPresent()) {
5453 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5456 if (!
T->isDependentType()) {
5457 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5458 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5466 if (
T->isFunctionType()) {
5467 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5477 if (
T->isReferenceType()) {
5487 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5489 else if (
T.getObjCLifetime()) {
5493 const AutoType *AutoTy;
5494 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5496 QualType Deduced = AutoTy->getDeducedType();
5501 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5504 AutoTy->getTypeConstraintConcept(),
5505 AutoTy->getTypeConstraintArguments());
5510 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5516 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5519template <
typename Derived>
5520QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5523 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5526 case TypeLoc::TemplateSpecialization:
5527 return getDerived().TransformTemplateSpecializationType(
5529 FirstQualifierInScope,
true);
5530 case TypeLoc::DependentName:
5531 return getDerived().TransformDependentNameType(
5533 ObjectType, FirstQualifierInScope);
5537 return getDerived().TransformType(TLB, TL);
5541template <
class TyLoc>
static inline
5543 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5544 NewT.setNameLoc(
T.getNameLoc());
5548template<
typename Derived>
5549QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5551 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5552 NewT.setBuiltinLoc(T.getBuiltinLoc());
5553 if (T.needsExtraLocalData())
5554 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5558template<
typename Derived>
5565template <
typename Derived>
5569 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5572template<
typename Derived>
5575 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5576 if (OriginalType.isNull())
5580 if (getDerived().AlwaysRebuild() ||
5581 OriginalType != TL.getOriginalLoc().getType())
5588template <
typename Derived>
5592 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5593 if (OriginalType.isNull())
5597 if (getDerived().AlwaysRebuild() ||
5598 OriginalType != TL.getElementLoc().getType())
5605template<
typename Derived>
5609 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5610 if (PointeeType.isNull())
5614 if (PointeeType->getAs<ObjCObjectType>()) {
5626 if (getDerived().AlwaysRebuild() ||
5627 PointeeType != TL.getPointeeLoc().getType()) {
5628 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5635 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5642template<
typename Derived>
5647 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5648 if (PointeeType.isNull())
5652 if (getDerived().AlwaysRebuild() ||
5653 PointeeType != TL.getPointeeLoc().getType()) {
5654 Result = getDerived().RebuildBlockPointerType(PointeeType,
5669template<
typename Derived>
5677 if (PointeeType.
isNull())
5682 PointeeType !=
T->getPointeeTypeAsWritten()) {
5684 T->isSpelledAsLValue(),
5706template<
typename Derived>
5710 return TransformReferenceType(TLB, TL);
5713template<
typename Derived>
5715TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5716 RValueReferenceTypeLoc TL) {
5717 return TransformReferenceType(TLB, TL);
5720template<
typename Derived>
5724 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5725 if (PointeeType.isNull())
5732 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5733 if (!NewQualifierLoc)
5736 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5738 NewCls = cast_or_null<CXXRecordDecl>(
5739 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5745 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5746 NewQualifierLoc.getNestedNameSpecifier() !=
5747 OldQualifierLoc.getNestedNameSpecifier() ||
5750 SS.
Adopt(NewQualifierLoc);
5751 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5760 if (MPT && PointeeType != MPT->getPointeeType()) {
5767 NewTL.setQualifierLoc(NewQualifierLoc);
5772template<
typename Derived>
5777 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5778 if (ElementType.isNull())
5782 Expr *OldSize = TL.getSizeExpr();
5784 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5785 Expr *NewSize =
nullptr;
5789 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5794 if (getDerived().AlwaysRebuild() ||
5795 ElementType !=
T->getElementType() ||
5796 (
T->getSizeExpr() && NewSize != OldSize)) {
5797 Result = getDerived().RebuildConstantArrayType(ElementType,
5798 T->getSizeModifier(),
5799 T->getSize(), NewSize,
5800 T->getIndexTypeCVRQualifiers(),
5801 TL.getBracketsRange());
5812 NewTL.setRBracketLoc(TL.getRBracketLoc());
5813 NewTL.setSizeExpr(NewSize);
5818template<
typename Derived>
5823 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5824 if (ElementType.isNull())
5828 if (getDerived().AlwaysRebuild() ||
5829 ElementType !=
T->getElementType()) {
5830 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5831 T->getSizeModifier(),
5832 T->getIndexTypeCVRQualifiers(),
5833 TL.getBracketsRange());
5840 NewTL.setRBracketLoc(TL.getRBracketLoc());
5841 NewTL.setSizeExpr(
nullptr);
5846template<
typename Derived>
5851 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5852 if (ElementType.isNull())
5859 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5861 if (SizeResult.isInvalid())
5865 if (SizeResult.isInvalid())
5871 if (getDerived().AlwaysRebuild() ||
5872 ElementType !=
T->getElementType() ||
5873 Size !=
T->getSizeExpr()) {
5874 Result = getDerived().RebuildVariableArrayType(ElementType,
5875 T->getSizeModifier(),
5877 T->getIndexTypeCVRQualifiers(),
5878 TL.getBracketsRange());
5887 NewTL.setRBracketLoc(TL.getRBracketLoc());
5888 NewTL.setSizeExpr(Size);
5893template<
typename Derived>
5898 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5899 if (ElementType.isNull())
5907 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5910 Expr *origSize = TL.getSizeExpr();
5911 if (!origSize) origSize =
T->getSizeExpr();
5914 = getDerived().TransformExpr(origSize);
5916 if (sizeResult.isInvalid())
5919 Expr *size = sizeResult.get();
5922 if (getDerived().AlwaysRebuild() ||
5923 ElementType !=
T->getElementType() ||
5925 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5926 T->getSizeModifier(),
5928 T->getIndexTypeCVRQualifiers(),
5929 TL.getBracketsRange());
5938 NewTL.setRBracketLoc(TL.getRBracketLoc());
5939 NewTL.setSizeExpr(size);
5944template <
typename Derived>
5948 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5949 if (ElementType.isNull())
5957 if (
Size.isInvalid())
5961 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5962 Size.get() !=
T->getSizeExpr()) {
5963 Result = getDerived().RebuildDependentVectorType(
5964 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5982template<
typename Derived>
5989 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5990 if (ElementType.isNull())
5999 if (
Size.isInvalid())
6003 if (getDerived().AlwaysRebuild() ||
6004 ElementType !=
T->getElementType() ||
6005 Size.get() !=
T->getSizeExpr()) {
6006 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6008 T->getAttributeLoc());
6026template <
typename Derived>
6031 QualType ElementType = getDerived().TransformType(
T->getElementType());
6032 if (ElementType.isNull())
6036 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6037 Result = getDerived().RebuildConstantMatrixType(
6038 ElementType,
T->getNumRows(),
T->getNumColumns());
6045 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6046 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6047 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6052template <
typename Derived>
6057 QualType ElementType = getDerived().TransformType(
T->getElementType());
6058 if (ElementType.isNull()) {
6066 Expr *origRows = TL.getAttrRowOperand();
6068 origRows =
T->getRowExpr();
6069 Expr *origColumns = TL.getAttrColumnOperand();
6071 origColumns =
T->getColumnExpr();
6073 ExprResult rowResult = getDerived().TransformExpr(origRows);
6075 if (rowResult.isInvalid())
6078 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6080 if (columnResult.isInvalid())
6083 Expr *rows = rowResult.get();
6084 Expr *columns = columnResult.get();
6087 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6088 rows != origRows || columns != origColumns) {
6089 Result = getDerived().RebuildDependentSizedMatrixType(
6090 ElementType, rows, columns,
T->getAttributeLoc());
6100 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6101 NewTL.setAttrRowOperand(rows);
6102 NewTL.setAttrColumnOperand(columns);
6106template <
typename Derived>
6112 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6114 if (pointeeType.isNull())
6121 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6123 if (AddrSpace.isInvalid())
6127 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6128 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6129 Result = getDerived().RebuildDependentAddressSpaceType(
6130 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6141 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6142 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6145 TLB.TypeWasModifiedSafely(
Result);
6151template <
typename Derived>
6155 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6156 if (ElementType.isNull())
6160 if (getDerived().AlwaysRebuild() ||
6161 ElementType !=
T->getElementType()) {
6162 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6163 T->getVectorKind());
6174template<
typename Derived>
6178 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6179 if (ElementType.isNull())
6183 if (getDerived().AlwaysRebuild() ||
6184 ElementType !=
T->getElementType()) {
6185 Result = getDerived().RebuildExtVectorType(ElementType,
6186 T->getNumElements(),
6198template <
typename Derived>
6201 bool ExpectParameterPack) {
6236 if (NewDI == OldDI && indexAdjustment == 0)
6254template <
typename Derived>
6262 unsigned *LastParamTransformed) {
6263 int indexAdjustment = 0;
6265 unsigned NumParams = Params.size();
6266 for (
unsigned i = 0; i != NumParams; ++i) {
6267 if (LastParamTransformed)
6268 *LastParamTransformed = i;
6270 assert(OldParm->getFunctionScopeIndex() == i);
6274 if (OldParm->isParameterPack()) {
6279 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6282 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6285 bool ShouldExpand =
false;
6286 bool RetainExpansion =
false;
6288 if (Unexpanded.size() > 0) {
6289 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6290 NumExpansions = OrigNumExpansions;
6294 ShouldExpand, RetainExpansion, NumExpansions)) {
6299 const AutoType *AT =
6300 Pattern.getType().getTypePtr()->getContainedAutoType();
6301 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6302 "Could not find parameter packs or undeduced auto type!");
6309 getDerived().ExpandingFunctionParameterPack(OldParm);
6310 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6313 =
getDerived().TransformFunctionTypeParam(OldParm,
6321 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6322 OutParamTypes.push_back(NewParm->
getType());
6324 PVars->push_back(NewParm);
6329 if (RetainExpansion) {
6330 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6332 =
getDerived().TransformFunctionTypeParam(OldParm,
6340 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6341 OutParamTypes.push_back(NewParm->
getType());
6343 PVars->push_back(NewParm);
6359 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6364 "Parameter pack no longer a parameter pack after "
6367 NewParm =
getDerived().TransformFunctionTypeParam(
6368 OldParm, indexAdjustment, std::nullopt,
6376 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6377 OutParamTypes.push_back(NewParm->
getType());
6379 PVars->push_back(NewParm);
6387 bool IsPackExpansion =
false;
6390 if (
const PackExpansionType *Expansion
6391 = dyn_cast<PackExpansionType>(OldType)) {
6393 QualType Pattern = Expansion->getPattern();
6395 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6398 bool ShouldExpand =
false;
6399 bool RetainExpansion =
false;
6403 RetainExpansion, NumExpansions)) {
6410 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6417 NewType =
getSema().getASTContext().getPackExpansionType(
6418 NewType, std::nullopt);
6425 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6426 OutParamTypes.push_back(NewType);
6428 PVars->push_back(
nullptr);
6437 if (RetainExpansion) {
6438 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6444 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6445 OutParamTypes.push_back(NewType);
6447 PVars->push_back(
nullptr);
6452 OldType = Expansion->getPattern();
6453 IsPackExpansion =
true;
6455 NewType =
getDerived().TransformType(OldType);
6457 NewType =
getDerived().TransformType(OldType);
6463 if (IsPackExpansion)
6464 NewType =
getSema().Context.getPackExpansionType(NewType,
6468 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6469 OutParamTypes.push_back(NewType);
6471 PVars->push_back(
nullptr);
6476 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6478 assert(parm->getFunctionScopeIndex() == i);
6485template<
typename Derived>
6490 return getDerived().TransformFunctionProtoType(
6494 ExceptionStorage, Changed);
6498template<
typename Derived>
template<
typename Fn>
6517 if (
T->hasTrailingReturn()) {
6521 T->getExtParameterInfosOrNull(),
6522 ParamTypes, &ParamDecls, ExtParamInfos))
6532 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6534 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6549 T->getExtParameterInfosOrNull(),
6550 ParamTypes, &ParamDecls, ExtParamInfos))
6556 bool EPIChanged =
false;
6561 if (
auto NewExtParamInfos =
6577 std::optional<FunctionEffectSet> NewFX;
6589 std::optional<FunctionEffectMode> Mode =
6609 "FunctionEffectMode::None shouldn't be possible here");
6612 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6615 NewFX->insert(NewEC, Errs);
6616 assert(Errs.empty());
6626 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6637 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6643template<
typename Derived>
6666 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6681 if (
const PackExpansionType *PackExpansion =
6682 T->getAs<PackExpansionType>()) {
6687 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6689 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6694 bool Expand =
false;
6695 bool RetainExpansion =
false;
6696 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6701 true, Expand, RetainExpansion,
6714 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6715 Exceptions.push_back(
U);
6721 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6725 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6728 Exceptions.push_back(
U);
6732 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6737 Exceptions.push_back(
U);
6747template<
typename Derived>
6757 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6758 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6769template <
typename Derived>
6770QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6771 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6773 const UnresolvedUsingType *T = TL.getTypePtr();
6774 bool Changed =
false;
6776 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6777 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6778 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6781 Changed |= QualifierLoc != OldQualifierLoc;
6784 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6790 if (getDerived().AlwaysRebuild() || Changed) {
6791 Result = getDerived().RebuildUnresolvedUsingType(
6792 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6800 QualifierLoc, TL.getNameLoc());
6803 QualifierLoc, TL.getNameLoc());
6807template <
typename Derived>
6815 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6818 Changed |= QualifierLoc != OldQualifierLoc;
6821 auto *D = cast_or_null<UsingShadowDecl>(
6822 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6827 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6828 if (UnderlyingType.isNull())
6830 Changed |= UnderlyingType !=
T->desugar();
6833 if (getDerived().AlwaysRebuild() || Changed) {
6834 Result = getDerived().RebuildUsingType(
6835 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6845template<
typename Derived>
6853 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6856 Changed |= QualifierLoc != OldQualifierLoc;
6859 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6860 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6868 if (getDerived().AlwaysRebuild() || Changed) {
6869 Result = getDerived().RebuildTypedefType(
6870 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6876 QualifierLoc, TL.getNameLoc());
6880template<
typename Derived>
6888 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6898 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6900 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6907 NewTL.setLParenLoc(TL.getLParenLoc());
6908 NewTL.setRParenLoc(TL.getRParenLoc());
6913template<
typename Derived>
6917 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6923 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6924 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6931 NewTL.setLParenLoc(TL.getLParenLoc());
6932 NewTL.setRParenLoc(TL.getRParenLoc());
6933 NewTL.setUnmodifiedTInfo(New_Under_TI);
6938template<
typename Derived>
6941 const DecltypeType *
T = TL.getTypePtr();
6948 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6952 E = getSema().ActOnDecltypeExpression(E.get());
6957 if (getDerived().AlwaysRebuild() ||
6958 E.get() !=
T->getUnderlyingExpr()) {
6959 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
6967 NewTL.setRParenLoc(TL.getRParenLoc());
6971template <
typename Derived>
6981 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6982 if (IndexExpr.isInvalid())
6985 QualType Pattern = TL.getPattern();
6987 const PackIndexingType *PIT = TL.
getTypePtr();
6991 bool NotYetExpanded = Types.empty();
6992 bool FullySubstituted =
true;
6994 if (Types.empty() && !PIT->expandsToEmptyPack())
6998 if (!
T->containsUnexpandedParameterPack()) {
6999 QualType Transformed = getDerived().TransformType(
T);
7000 if (Transformed.isNull())
7002 SubtitutedTypes.push_back(Transformed);
7007 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7008 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7011 bool ShouldExpand =
true;
7012 bool RetainExpansion =
false;
7014 if (getDerived().TryExpandParameterPacks(
7017 RetainExpansion, NumExpansions))
7019 if (!ShouldExpand) {
7025 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7028 if (NotYetExpanded) {
7029 FullySubstituted =
false;
7030 QualType Out = getDerived().RebuildPackIndexingType(
7040 SubtitutedTypes.push_back(Pack);
7043 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7048 SubtitutedTypes.push_back(Out);
7049 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7053 if (RetainExpansion) {
7054 FullySubstituted =
false;
7055 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7059 SubtitutedTypes.push_back(Out);
7067 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7069 QualType Out = getDerived().RebuildPackIndexingType(
7071 FullySubstituted, SubtitutedTypes);
7080template<
typename Derived>
7085 if (
Result->isDependentType()) {
7086 const UnaryTransformType *
T = TL.getTypePtr();
7089 getDerived().TransformType(TL.getUnderlyingTInfo());
7092 QualType NewBase = NewBaseTSI->getType();
7094 Result = getDerived().RebuildUnaryTransformType(NewBase,
7103 NewTL.setParensRange(TL.getParensRange());
7104 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
7108template<
typename Derived>
7111 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7116 TL.getTemplateNameLoc());
7120 QualType OldDeduced =
T->getDeducedType();
7122 if (!OldDeduced.isNull()) {
7123 NewDeduced = getDerived().TransformType(OldDeduced);
7124 if (NewDeduced.isNull())
7128 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7135 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7136 NewTL.setQualifierLoc(QualifierLoc);
7140template <
typename Derived>
7147 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7152 auto *TD = cast_or_null<TagDecl>(
7159 TD !=
T->getOriginalDecl()) {
7160 if (
T->isCanonicalUnqualified())
7177template <
typename Derived>
7183template <
typename Derived>
7184QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7186 return getDerived().TransformTagType(TLB, TL);
7189template<
typename Derived>
7196template<
typename Derived>
7200 return getDerived().TransformTemplateTypeParmType(
7205template <
typename Derived>
7211template<
typename Derived>
7212QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7213 TypeLocBuilder &TLB,
7214 SubstTemplateTypeParmTypeLoc TL) {
7215 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7218 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7223 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7224 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7225 if (Replacement.isNull())
7229 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7233 SubstTemplateTypeParmTypeLoc NewTL
7234 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7235 NewTL.setNameLoc(TL.getNameLoc());
7239template <
typename Derived>
7245template<
typename Derived>
7249 return getDerived().TransformSubstTemplateTypeParmPackType(
7253template <
typename Derived>
7259template<
typename Derived>
7260QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7262 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7263 if (ValueType.isNull())
7266 QualType Result = TL.getType();
7267 if (getDerived().AlwaysRebuild() ||
7268 ValueType != TL.getValueLoc().getType()) {
7269 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7270 if (Result.isNull())
7276 NewTL.setLParenLoc(TL.getLParenLoc());
7277 NewTL.setRParenLoc(TL.getRParenLoc());
7282template <
typename Derived>
7285 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7286 if (ValueType.isNull())
7290 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7293 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7304template <
typename Derived>
7310 if (getDerived().AlwaysRebuild()) {
7311 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7312 EIT->getNumBits(), TL.getNameLoc());
7322template <
typename Derived>
7329 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7332 if (BitsExpr.isInvalid())
7337 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7338 Result = getDerived().RebuildDependentBitIntType(
7339 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7355template <
typename Derived>
7358 llvm_unreachable(
"This type does not need to be transformed.");
7366 template<
typename ArgLocContainer>
7368 ArgLocContainer *Container;
7393 : Container(&Container), Index(Index) { }
7407 return Container->getArgLoc(Index);
7411 return pointer(Container->getArgLoc(Index));
7416 return X.Container == Y.Container &&
X.Index == Y.Index;
7425template<
typename Derived>
7426QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7428 const AutoType *T = TL.getTypePtr();
7429 QualType OldDeduced = T->getDeducedType();
7430 QualType NewDeduced;
7431 if (!OldDeduced.isNull()) {
7432 NewDeduced = getDerived().TransformType(OldDeduced);
7433 if (NewDeduced.isNull())
7440 if (
T->isConstrained()) {
7441 assert(TL.getConceptReference());
7442 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7443 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7445 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7446 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7448 if (getDerived().TransformTemplateArguments(
7449 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7453 if (TL.getNestedNameSpecifierLoc()) {
7455 = getDerived().TransformNestedNameSpecifierLoc(
7456 TL.getNestedNameSpecifierLoc());
7457 if (!NewNestedNameSpec)
7463 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7464 T->isDependentType() ||
T->isConstrained()) {
7467 NewArgList.reserve(NewTemplateArgs.size());
7468 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7469 NewArgList.push_back(ArgLoc.getArgument());
7470 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7478 NewTL.setRParenLoc(TL.getRParenLoc());
7479 NewTL.setConceptReference(
nullptr);
7481 if (
T->isConstrained()) {
7483 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7484 TL.getConceptNameLoc(),
7485 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7487 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7488 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7490 NewTL.setConceptReference(CR);
7496template <
typename Derived>
7499 return getDerived().TransformTemplateSpecializationType(
7504template <
typename Derived>
7507 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7508 const TemplateSpecializationType *
T = TL.
getTypePtr();
7514 AllowInjectedClassName);
7523 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7532 QualType Result = getDerived().RebuildTemplateSpecializationType(
7545template <
typename Derived>
7549 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7550 if (modifiedType.isNull())
7554 const Attr *oldAttr = TL.getAttr();
7555 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7556 if (oldAttr && !newAttr)
7562 if (getDerived().AlwaysRebuild() ||
7563 modifiedType != oldType->getModifiedType()) {
7576 QualType equivalentType = modifiedType;
7577 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7579 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7581 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7582 if (equivalentType.isNull())
7588 if (
auto nullability = oldType->getImmediateNullability()) {
7589 if (!modifiedType->canHaveNullability()) {
7590 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7591 : TL.getModifiedLoc().getBeginLoc()),
7592 diag::err_nullability_nonpointer)
7609template <
typename Derived>
7613 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7614 if (InnerTy.isNull())
7617 Expr *OldCount = TL.getCountExpr();
7618 Expr *NewCount =
nullptr;
7620 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7621 if (CountResult.isInvalid())
7623 NewCount = CountResult.get();
7627 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7628 OldCount != NewCount) {
7631 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7638template <
typename Derived>
7642 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7645template <
typename Derived>
7649 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7651 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7652 if (WrappedTy.isNull())
7656 QualType OldContainedTy = oldType->getContainedType();
7657 if (!OldContainedTy.isNull()) {
7658 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7659 if (!oldContainedTSI)
7660 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7662 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7665 ContainedTy = ContainedTSI->getType();
7669 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7670 ContainedTy != oldType->getContainedType()) {
7672 WrappedTy, ContainedTy, oldType->getAttrs());
7679template <
typename Derived>
7683 return TL.getType();
7686template<
typename Derived>
7690 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7695 if (getDerived().AlwaysRebuild() ||
7696 Inner != TL.getInnerLoc().getType()) {
7697 Result = getDerived().RebuildParenType(Inner);
7704 NewTL.setRParenLoc(TL.getRParenLoc());
7708template <
typename Derived>
7712 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7717 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7719 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7729template<
typename Derived>
7730QualType TreeTransform<Derived>::TransformDependentNameType(
7732 return TransformDependentNameType(TLB, TL,
false);
7735template <
typename Derived>
7736QualType TreeTransform<Derived>::TransformDependentNameType(
7739 const DependentNameType *
T = TL.getTypePtr();
7743 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7744 QualifierLoc, ObjectType, UnqualLookup);
7748 assert((ObjectType.isNull() && !UnqualLookup) &&
7749 "must be transformed by TransformNestedNameSpecifierLoc");
7753 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7754 TL.getElaboratedKeywordLoc(),
7765 NewTL.setQualifierLoc(QualifierLoc);
7766 NewTL.setNameLoc(TL.getNameLoc());
7770 NewTL.setTemplateNameLoc(TL.getNameLoc());
7771 NewTL.setQualifierLoc(QualifierLoc);
7774 QualifierLoc, TL.getNameLoc());
7777 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7781 NewTL.setQualifierLoc(QualifierLoc);
7782 NewTL.setNameLoc(TL.getNameLoc());
7787template<
typename Derived>
7791 = getDerived().TransformType(TLB, TL.getPatternLoc());
7792 if (Pattern.isNull())
7796 if (getDerived().AlwaysRebuild() ||
7797 Pattern != TL.getPatternLoc().getType()) {
7798 Result = getDerived().RebuildPackExpansionType(Pattern,
7799 TL.getPatternLoc().getSourceRange(),
7800 TL.getEllipsisLoc(),
7801 TL.getTypePtr()->getNumExpansions());
7811template<
typename Derived>
7816 TLB.pushFullCopy(TL);
7817 return TL.getType();
7820template<
typename Derived>
7824 const ObjCTypeParamType *
T = TL.getTypePtr();
7826 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7831 if (getDerived().AlwaysRebuild() ||
7832 OTP !=
T->getDecl()) {
7833 Result = getDerived().RebuildObjCTypeParamType(
7834 OTP, TL.getProtocolLAngleLoc(),
7835 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7836 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7842 if (TL.getNumProtocols()) {
7843 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7844 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7845 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7846 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7851template<
typename Derived>
7856 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7857 if (BaseType.isNull())
7860 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7864 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7866 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7867 QualType TypeArg = TypeArgInfo->getType();
7872 const auto *PackExpansion = PackExpansionLoc.getType()
7873 ->castAs<PackExpansionType>();
7877 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7881 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7882 bool Expand =
false;
7883 bool RetainExpansion =
false;
7884 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7885 if (getDerived().TryExpandParameterPacks(
7886 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7887 Unexpanded,
true, Expand,
7888 RetainExpansion, NumExpansions))
7898 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7899 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7901 if (NewPatternType.isNull())
7905 NewPatternType, NumExpansions);
7907 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7908 NewTypeArgInfos.push_back(
7909 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7915 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7919 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7921 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7923 if (NewTypeArg.isNull())
7926 NewTypeArgInfos.push_back(
7927 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7934 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
7936 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7937 if (NewTypeArg.isNull())
7941 if (NewTypeArg == TypeArg) {
7942 NewTypeArgInfos.push_back(TypeArgInfo);
7946 NewTypeArgInfos.push_back(
7947 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7952 if (getDerived().AlwaysRebuild() || AnyChanged) {
7954 Result = getDerived().RebuildObjCObjectType(
7955 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7956 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7957 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7958 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7966 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7967 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7968 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7969 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7970 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7971 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7972 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7973 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7977template<
typename Derived>
7981 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7982 if (PointeeType.isNull())
7986 if (getDerived().AlwaysRebuild() ||
7987 PointeeType != TL.getPointeeLoc().getType()) {
7988 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8002template<
typename Derived>
8008template<
typename Derived>
8011 return getDerived().TransformCompoundStmt(S,
false);
8014template<
typename Derived>
8021 getSema().resetFPOptions(
8025 bool SubStmtInvalid =
false;
8026 bool SubStmtChanged =
false;
8028 for (
auto *B : S->
body()) {
8030 B, IsStmtExpr && B ==
ExprResult ? StmtDiscardKind::StmtExprResult
8031 : StmtDiscardKind::Discarded);
8033 if (
Result.isInvalid()) {
8040 SubStmtInvalid =
true;
8044 SubStmtChanged = SubStmtChanged || Result.get() != B;
8045 Statements.push_back(Result.getAs<Stmt>());
8051 if (!getDerived().AlwaysRebuild() &&
8055 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8061template<
typename Derived>
8070 LHS = getDerived().TransformExpr(S->getLHS());
8072 if (LHS.isInvalid())
8076 RHS = getDerived().TransformExpr(S->getRHS());
8078 if (RHS.isInvalid())
8085 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8087 S->getEllipsisLoc(),
8090 if (Case.isInvalid())
8095 getDerived().TransformStmt(S->getSubStmt());
8096 if (SubStmt.isInvalid())
8100 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8103template <
typename Derived>
8107 getDerived().TransformStmt(S->getSubStmt());
8108 if (SubStmt.isInvalid())
8112 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8116template<
typename Derived>
8119 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8120 if (SubStmt.isInvalid())
8123 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8131 if (LD == S->getDecl())
8132 S->getDecl()->setStmt(
nullptr);
8135 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8140template <
typename Derived>
8149 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8150#include "clang/Basic/AttrList.inc"
8155template <
typename Derived>
8166 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8167#include "clang/Basic/AttrList.inc"
8172template <
typename Derived>
8175 StmtDiscardKind SDK) {
8180 bool AttrsChanged =
false;
8184 for (
const auto *I : S->
getAttrs()) {
8186 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8187 AttrsChanged |= (I != R);
8200 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8204template<
typename Derived>
8209 if (
Init.isInvalid())
8213 if (!S->isConsteval()) {
8215 Cond = getDerived().TransformCondition(
8216 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8219 if (
Cond.isInvalid())
8224 std::optional<bool> ConstexprConditionValue;
8225 if (S->isConstexpr())
8226 ConstexprConditionValue =
Cond.getKnownValue();
8230 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8234 S->isNonNegatedConsteval());
8236 Then = getDerived().TransformStmt(S->getThen());
8237 if (Then.isInvalid())
8243 Then =
new (getSema().Context)
8244 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8249 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8253 S->isNegatedConsteval());
8255 Else = getDerived().TransformStmt(S->getElse());
8256 if (Else.isInvalid())
8258 }
else if (S->getElse() && ConstexprConditionValue &&
8259 *ConstexprConditionValue) {
8263 Else =
new (getSema().Context)
8264 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8267 if (!getDerived().AlwaysRebuild() &&
8268 Init.get() == S->getInit() &&
8269 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8270 Then.get() == S->getThen() &&
8271 Else.get() == S->getElse())
8274 return getDerived().RebuildIfStmt(
8275 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8276 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8279template<
typename Derived>
8284 if (
Init.isInvalid())
8289 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8291 if (
Cond.isInvalid())
8296 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8297 Init.get(),
Cond, S->getRParenLoc());
8302 StmtResult Body = getDerived().TransformStmt(S->getBody());
8303 if (Body.isInvalid())
8307 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8311template<
typename Derived>
8316 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8318 if (
Cond.isInvalid())
8327 StmtResult Body = getDerived().TransformStmt(S->getBody());
8328 if (Body.isInvalid())
8331 if (!getDerived().AlwaysRebuild() &&
8332 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8333 Body.get() == S->getBody())
8336 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8337 Cond, S->getRParenLoc(), Body.get());
8340template<
typename Derived>
8349 StmtResult Body = getDerived().TransformStmt(S->getBody());
8350 if (Body.isInvalid())
8355 if (
Cond.isInvalid())
8358 if (!getDerived().AlwaysRebuild() &&
8359 Cond.get() == S->getCond() &&
8360 Body.get() == S->getBody())
8363 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8364 S->getWhileLoc(),
Cond.get(),
8368template<
typename Derived>
8371 if (getSema().getLangOpts().OpenMP)
8372 getSema().OpenMP().startOpenMPLoop();
8376 if (
Init.isInvalid())
8381 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8382 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8387 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8389 if (
Cond.isInvalid())
8394 if (
Inc.isInvalid())
8398 if (S->getInc() && !FullInc.get())
8405 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8406 Cond.get().second, S->getInc(),
Inc.get());
8409 StmtResult Body = getDerived().TransformStmt(S->getBody());
8410 if (Body.isInvalid())
8415 if (!getDerived().AlwaysRebuild() &&
8416 Init.get() == S->getInit() &&
8417 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8418 Inc.get() == S->getInc() &&
8419 Body.get() == S->getBody())
8422 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8424 S->getRParenLoc(), Body.get());
8427template<
typename Derived>
8430 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8436 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8440template<
typename Derived>
8448 if (!getDerived().AlwaysRebuild() &&
8449 Target.get() == S->getTarget())
8452 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8456template<
typename Derived>
8459 if (!S->hasLabelTarget())
8462 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8471template<
typename Derived>
8474 if (!S->hasLabelTarget())
8477 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8486template<
typename Derived>
8496 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8499template<
typename Derived>
8502 bool DeclChanged =
false;
8505 for (
auto *D : S->decls()) {
8506 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8510 if (Transformed != D)
8514 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8515 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8516 LSI->ContainsUnexpandedParameterPack |=
8517 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8519 LSI->ContainsUnexpandedParameterPack |=
8522 .getTypeDeclType(TD)
8523 ->containsUnexpandedParameterPack();
8526 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8527 LSI->ContainsUnexpandedParameterPack |=
8528 VD->getType()->containsUnexpandedParameterPack();
8531 Decls.push_back(Transformed);
8534 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8537 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8540template<
typename Derived>
8550 bool ExprsChanged =
false;
8552 auto RebuildString = [&](
Expr *E) {
8557 ExprsChanged =
true;
8564 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8565 Names.push_back(S->getOutputIdentifier(I));
8571 Constraints.push_back(
Result.get());
8574 Expr *OutputExpr = S->getOutputExpr(I);
8575 Result = getDerived().TransformExpr(OutputExpr);
8579 ExprsChanged |=
Result.get() != OutputExpr;
8581 Exprs.push_back(
Result.get());
8585 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8586 Names.push_back(S->getInputIdentifier(I));
8592 Constraints.push_back(
Result.get());
8595 Expr *InputExpr = S->getInputExpr(I);
8596 Result = getDerived().TransformExpr(InputExpr);
8600 ExprsChanged |=
Result.get() != InputExpr;
8602 Exprs.push_back(
Result.get());
8606 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8607 Names.push_back(S->getLabelIdentifier(I));
8612 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8613 Exprs.push_back(
Result.get());
8617 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8621 Clobbers.push_back(
Result.get());
8624 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8625 if (AsmString.isInvalid())
8628 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8631 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8632 S->isVolatile(), S->getNumOutputs(),
8633 S->getNumInputs(), Names.data(),
8634 Constraints, Exprs, AsmString.get(),
8635 Clobbers, S->getNumLabels(),
8639template<
typename Derived>
8644 bool HadError =
false, HadChange =
false;
8648 TransformedExprs.reserve(SrcExprs.size());
8649 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8651 if (!
Result.isUsable()) {
8654 HadChange |= (
Result.get() != SrcExprs[i]);
8655 TransformedExprs.push_back(
Result.get());
8660 if (!HadChange && !getDerived().AlwaysRebuild())
8663 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8664 AsmToks, S->getAsmString(),
8665 S->getNumOutputs(), S->getNumInputs(),
8666 S->getAllConstraints(), S->getClobbers(),
8667 TransformedExprs, S->getEndLoc());
8671template<
typename Derived>
8676 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8677 ScopeInfo->NeedsCoroutineSuspends &&
8678 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8679 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8680 "expected clean scope info");
8684 ScopeInfo->setNeedsCoroutineSuspends(
false);
8697 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8698 ScopeInfo->CoroutinePromise = Promise;
8703 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8704 if (InitSuspend.isInvalid())
8707 getDerived().TransformStmt(S->getFinalSuspendStmt());
8708 if (FinalSuspend.isInvalid() ||
8711 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8714 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8715 if (BodyRes.isInvalid())
8719 if (Builder.isInvalid())
8722 Expr *ReturnObject = S->getReturnValueInit();
8723 assert(ReturnObject &&
"the return object is expected to be valid");
8724 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8726 if (Res.isInvalid())
8728 Builder.ReturnValue = Res.get();
8733 if (S->hasDependentPromiseType()) {
8736 if (!Promise->getType()->isDependentType()) {
8737 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8738 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8739 "these nodes should not have been built yet");
8740 if (!Builder.buildDependentStatements())
8744 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8745 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8746 if (Res.isInvalid())
8748 Builder.OnFallthrough = Res.get();
8751 if (
auto *OnException = S->getExceptionHandler()) {
8752 StmtResult Res = getDerived().TransformStmt(OnException);
8753 if (Res.isInvalid())
8755 Builder.OnException = Res.get();
8758 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8759 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8760 if (Res.isInvalid())
8762 Builder.ReturnStmtOnAllocFailure = Res.get();
8766 assert(S->getAllocate() && S->getDeallocate() &&
8767 "allocation and deallocation calls must already be built");
8768 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8769 if (AllocRes.isInvalid())
8771 Builder.Allocate = AllocRes.get();
8773 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8774 if (DeallocRes.isInvalid())
8776 Builder.Deallocate = DeallocRes.get();
8778 if (
auto *ResultDecl = S->getResultDecl()) {
8779 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8780 if (Res.isInvalid())
8782 Builder.ResultDecl = Res.get();
8787 if (Res.isInvalid())
8789 Builder.ReturnStmt = Res.get();
8793 return getDerived().RebuildCoroutineBodyStmt(Builder);
8796template<
typename Derived>
8806 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8810template <
typename Derived>
8823 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8824 getSema().getCurScope(), E->getKeywordLoc());
8828 return getDerived().RebuildCoawaitExpr(
8829 E->getKeywordLoc(),
Operand.get(),
8833template <
typename Derived>
8836 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8838 if (OperandResult.isInvalid())
8842 E->getOperatorCoawaitLookup());
8849 return getDerived().RebuildDependentCoawaitExpr(
8850 E->getKeywordLoc(), OperandResult.get(),
8854template<
typename Derived>
8864 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8869template<
typename Derived>
8873 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8874 if (TryBody.isInvalid())
8878 bool AnyCatchChanged =
false;
8880 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8881 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8882 if (Catch.isInvalid())
8884 if (Catch.get() != S->getCatchStmt(I))
8885 AnyCatchChanged =
true;
8886 CatchStmts.push_back(Catch.get());
8891 if (S->getFinallyStmt()) {
8892 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8893 if (Finally.isInvalid())
8898 if (!getDerived().AlwaysRebuild() &&
8899 TryBody.get() == S->getTryBody() &&
8901 Finally.get() == S->getFinallyStmt())
8905 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8906 CatchStmts, Finally.get());
8909template<
typename Derived>
8914 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
8916 if (FromVar->getTypeSourceInfo()) {
8917 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8924 T = TSInfo->getType();
8926 T = getDerived().TransformType(FromVar->getType());
8931 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8936 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8937 if (Body.isInvalid())
8940 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8945template<
typename Derived>
8949 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8950 if (Body.isInvalid())
8954 if (!getDerived().AlwaysRebuild() &&
8955 Body.get() == S->getFinallyBody())
8959 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8963template<
typename Derived>
8967 if (S->getThrowExpr()) {
8968 Operand = getDerived().TransformExpr(S->getThrowExpr());
8973 if (!getDerived().AlwaysRebuild() &&
8974 Operand.get() == S->getThrowExpr())
8977 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8980template<
typename Derived>
8989 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8995 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8996 if (Body.isInvalid())
9000 if (!getDerived().AlwaysRebuild() &&
9001 Object.get() == S->getSynchExpr() &&
9002 Body.get() == S->getSynchBody())
9006 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9007 Object.get(), Body.get());
9010template<
typename Derived>
9015 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9016 if (Body.isInvalid())
9020 if (!getDerived().AlwaysRebuild() &&
9021 Body.get() == S->getSubStmt())
9025 return getDerived().RebuildObjCAutoreleasePoolStmt(
9026 S->getAtLoc(), Body.get());
9029template<
typename Derived>
9034 StmtResult Element = getDerived().TransformStmt(
9035 S->getElement(), StmtDiscardKind::NotDiscarded);
9036 if (Element.isInvalid())
9040 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9041 if (Collection.isInvalid())
9045 StmtResult Body = getDerived().TransformStmt(S->getBody());
9046 if (Body.isInvalid())
9050 if (!getDerived().AlwaysRebuild() &&
9051 Element.get() == S->getElement() &&
9052 Collection.get() == S->getCollection() &&
9053 Body.get() == S->getBody())
9057 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9064template <
typename Derived>
9068 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9070 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9074 Var = getDerived().RebuildExceptionDecl(
9075 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9076 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9077 if (!Var || Var->isInvalidDecl())
9082 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9083 if (Handler.isInvalid())
9086 if (!getDerived().AlwaysRebuild() && !Var &&
9087 Handler.get() == S->getHandlerBlock())
9090 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9093template <
typename Derived>
9096 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9097 if (TryBlock.isInvalid())
9101 bool HandlerChanged =
false;
9103 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9104 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9105 if (Handler.isInvalid())
9108 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9109 Handlers.push_back(Handler.getAs<
Stmt>());
9112 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9114 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9118 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9122template<
typename Derived>
9133 auto &LastRecord = getSema().currentEvaluationContext();
9134 LastRecord.InLifetimeExtendingContext =
true;
9135 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9138 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9139 if (
Init.isInvalid())
9143 if (
Range.isInvalid())
9148 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9149 auto ForRangeLifetimeExtendTemps =
9150 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9152 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9153 if (Begin.isInvalid())
9155 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9156 if (End.isInvalid())
9160 if (
Cond.isInvalid())
9164 if (
Cond.isInvalid())
9170 if (
Inc.isInvalid())
9175 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9176 if (LoopVar.isInvalid())
9180 if (getDerived().AlwaysRebuild() ||
9181 Init.get() != S->getInit() ||
9182 Range.get() != S->getRangeStmt() ||
9183 Begin.get() != S->getBeginStmt() ||
9184 End.get() != S->getEndStmt() ||
9185 Cond.get() != S->getCond() ||
9186 Inc.get() != S->getInc() ||
9187 LoopVar.get() != S->getLoopVarStmt()) {
9188 NewStmt = getDerived().RebuildCXXForRangeStmt(
9189 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9190 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9191 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9192 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9194 getSema().ActOnInitializerError(
9205 StmtResult Body = getDerived().TransformStmt(S->getBody());
9206 if (Body.isInvalid())
9213 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9214 NewStmt = getDerived().RebuildCXXForRangeStmt(
9215 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9216 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9217 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9218 if (NewStmt.isInvalid())
9222 if (NewStmt.get() == S)
9225 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9228template<
typename Derived>
9234 if (S->getQualifierLoc()) {
9236 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9243 if (NameInfo.getName()) {
9244 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9245 if (!NameInfo.getName())
9250 if (!getDerived().AlwaysRebuild() &&
9251 QualifierLoc == S->getQualifierLoc() &&
9252 NameInfo.getName() == S->getNameInfo().getName())
9257 SS.
Adopt(QualifierLoc);
9259 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9261 if (S->isIfExists())
9264 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9267 if (S->isIfNotExists())
9270 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9281 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9282 if (SubStmt.isInvalid())
9290 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9297template<
typename Derived>
9301 if (E->getQualifierLoc()) {
9303 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9309 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9314 if (
Base.isInvalid())
9320 QualifierLoc, E->getMemberLoc());
9323template <
typename Derived>
9327 if (BaseRes.isInvalid())
9329 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9330 if (IdxRes.isInvalid())
9333 if (!getDerived().AlwaysRebuild() &&
9334 BaseRes.get() == E->getBase() &&
9335 IdxRes.get() == E->getIdx())
9338 return getDerived().RebuildArraySubscriptExpr(
9339 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9342template <
typename Derived>
9344 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9345 if (TryBlock.isInvalid())
9348 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9349 if (Handler.isInvalid())
9352 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9353 Handler.get() == S->getHandler())
9356 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9357 TryBlock.get(), Handler.get());
9360template <
typename Derived>
9363 if (
Block.isInvalid())
9366 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9369template <
typename Derived>
9371 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9372 if (FilterExpr.isInvalid())
9376 if (
Block.isInvalid())
9379 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9383template <
typename Derived>
9391template<
typename Derived>
9401template <
typename Derived>
9403TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9407 return getDerived().TransformStmt(L->getLoopStmt());
9410template <
typename Derived>
9417 TClauses.reserve(Clauses.size());
9421 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9423 getDerived().getSema().OpenMP().EndOpenMPClause();
9425 TClauses.push_back(Clause);
9427 TClauses.push_back(
nullptr);
9431 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9432 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9433 D->getDirectiveKind(),
9439 if (D->getDirectiveKind() == OMPD_atomic ||
9440 D->getDirectiveKind() == OMPD_critical ||
9441 D->getDirectiveKind() == OMPD_section ||
9442 D->getDirectiveKind() == OMPD_master)
9443 CS = D->getAssociatedStmt();
9445 CS = D->getRawStmt();
9448 getSema().getLangOpts().OpenMPIRBuilder)
9452 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9457 if (TClauses.size() != Clauses.size()) {
9463 if (D->getDirectiveKind() == OMPD_critical) {
9465 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9468 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9470 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9474 return getDerived().RebuildOMPExecutableDirective(
9475 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9476 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9484template <
typename Derived>
9491 TClauses.reserve(Clauses.size());
9494 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9496 getDerived().getSema().OpenMP().EndOpenMPClause();
9498 TClauses.push_back(Clause);
9500 TClauses.push_back(
nullptr);
9504 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9505 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9506 D->getDirectiveKind(),
9511 assert(D->getDirectiveKind() == OMPD_assume &&
9512 "Unexpected informational directive");
9513 Stmt *CS = D->getAssociatedStmt();
9517 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9521 if (TClauses.size() != Clauses.size())
9526 return getDerived().RebuildOMPInformationalDirective(
9527 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9528 D->getBeginLoc(), D->getEndLoc());
9531template <
typename Derived>
9536 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9537 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9541template <
typename Derived>
9543TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9544 DeclarationNameInfo DirName;
9545 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9546 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9547 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9548 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9552template <
typename Derived>
9556 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9557 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9558 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9559 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9563template <
typename Derived>
9567 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9568 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9569 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9570 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9574template <
typename Derived>
9578 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9579 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9580 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9581 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9585template <
typename Derived>
9589 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9590 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9591 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9592 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9596template <
typename Derived>
9600 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9601 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9602 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9603 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9607template <
typename Derived>
9609 OMPInterchangeDirective *D) {
9611 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9612 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9613 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9614 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9618template <
typename Derived>
9622 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9623 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9624 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9625 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9629template <
typename Derived>
9633 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9634 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9635 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9636 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9640template <
typename Derived>
9644 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9645 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9646 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9647 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9651template <
typename Derived>
9655 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9656 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9657 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9658 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9662template <
typename Derived>
9666 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9667 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9668 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9669 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9673template <
typename Derived>
9677 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9678 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9679 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9680 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9684template <
typename Derived>
9688 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9689 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9690 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9691 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9695template <
typename Derived>
9699 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9700 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9701 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9702 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9706template <
typename Derived>
9710 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9711 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9712 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9716template <
typename Derived>
9718 OMPParallelForDirective *D) {
9720 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9721 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9722 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9723 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9727template <
typename Derived>
9729 OMPParallelForSimdDirective *D) {
9731 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9732 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9733 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9734 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9738template <
typename Derived>
9740 OMPParallelMasterDirective *D) {
9742 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9743 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9744 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9745 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9749template <
typename Derived>
9751 OMPParallelMaskedDirective *D) {
9753 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9754 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9755 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9756 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9760template <
typename Derived>
9762 OMPParallelSectionsDirective *D) {
9764 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9765 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9766 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9767 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9771template <
typename Derived>
9775 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9776 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9777 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9778 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9782template <
typename Derived>
9784 OMPTaskyieldDirective *D) {
9786 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9787 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9788 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9789 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9793template <
typename Derived>
9797 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9798 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9799 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9800 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9804template <
typename Derived>
9808 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9809 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9810 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9811 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9815template <
typename Derived>
9819 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9820 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9821 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9822 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9826template <
typename Derived>
9830 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9831 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9832 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9833 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9837template <
typename Derived>
9839 OMPTaskgroupDirective *D) {
9841 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9842 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9843 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9844 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9848template <
typename Derived>
9852 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9853 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9854 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9855 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9859template <
typename Derived>
9863 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9864 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9865 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9866 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9870template <
typename Derived>
9874 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9875 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9876 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9877 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9881template <
typename Derived>
9885 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9886 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9887 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9888 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9892template <
typename Derived>
9896 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9897 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9898 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9899 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9903template <
typename Derived>
9907 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9908 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9909 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9910 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9914template <
typename Derived>
9916 OMPTargetDataDirective *D) {
9918 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9919 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9920 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9921 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9925template <
typename Derived>
9927 OMPTargetEnterDataDirective *D) {
9929 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9930 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
9931 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9932 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9936template <
typename Derived>
9938 OMPTargetExitDataDirective *D) {
9940 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9941 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
9942 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9943 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9947template <
typename Derived>
9949 OMPTargetParallelDirective *D) {
9951 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9952 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
9953 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9954 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9958template <
typename Derived>
9960 OMPTargetParallelForDirective *D) {
9962 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9963 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
9964 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9965 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9969template <
typename Derived>
9971 OMPTargetUpdateDirective *D) {
9973 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9974 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
9975 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9976 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9980template <
typename Derived>
9984 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9985 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
9986 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9987 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9991template <
typename Derived>
9993 OMPCancellationPointDirective *D) {
9995 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9996 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
9997 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9998 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10002template <
typename Derived>
10006 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10007 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10008 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10009 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10013template <
typename Derived>
10017 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10018 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10019 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10020 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10024template <
typename Derived>
10026 OMPTaskLoopSimdDirective *D) {
10028 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10029 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10030 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10031 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10035template <
typename Derived>
10037 OMPMasterTaskLoopDirective *D) {
10039 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10040 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10041 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10042 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10046template <
typename Derived>
10048 OMPMaskedTaskLoopDirective *D) {
10050 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10051 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10052 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10053 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10057template <
typename Derived>
10059 OMPMasterTaskLoopSimdDirective *D) {
10061 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10062 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10063 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10064 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10068template <
typename Derived>
10070 OMPMaskedTaskLoopSimdDirective *D) {
10072 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10073 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10074 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10075 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10079template <
typename Derived>
10081 OMPParallelMasterTaskLoopDirective *D) {
10083 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10084 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10085 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10086 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10090template <
typename Derived>
10092 OMPParallelMaskedTaskLoopDirective *D) {
10094 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10095 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10096 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10097 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10101template <
typename Derived>
10104 OMPParallelMasterTaskLoopSimdDirective *D) {
10106 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10107 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10108 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10109 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10113template <
typename Derived>
10116 OMPParallelMaskedTaskLoopSimdDirective *D) {
10118 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10119 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10120 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10121 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10125template <
typename Derived>
10127 OMPDistributeDirective *D) {
10129 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10130 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10131 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10132 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10136template <
typename Derived>
10138 OMPDistributeParallelForDirective *D) {
10140 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10141 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10142 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10143 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10147template <
typename Derived>
10150 OMPDistributeParallelForSimdDirective *D) {
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10161 OMPDistributeSimdDirective *D) {
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10172 OMPTargetParallelForSimdDirective *D) {
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10176 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10177 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10181template <
typename Derived>
10183 OMPTargetSimdDirective *D) {
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10194 OMPTeamsDistributeDirective *D) {
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10205 OMPTeamsDistributeSimdDirective *D) {
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10216 OMPTeamsDistributeParallelForSimdDirective *D) {
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10221 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10222 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10226template <
typename Derived>
10228 OMPTeamsDistributeParallelForDirective *D) {
10230 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10231 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10232 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10233 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10237template <
typename Derived>
10239 OMPTargetTeamsDirective *D) {
10241 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10242 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10243 auto Res = getDerived().TransformOMPExecutableDirective(D);
10244 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10248template <
typename Derived>
10250 OMPTargetTeamsDistributeDirective *D) {
10252 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10253 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10254 auto Res = getDerived().TransformOMPExecutableDirective(D);
10255 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10259template <
typename Derived>
10262 OMPTargetTeamsDistributeParallelForDirective *D) {
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10265 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10267 auto Res = getDerived().TransformOMPExecutableDirective(D);
10268 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10272template <
typename Derived>
10275 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10277 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10278 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10280 auto Res = getDerived().TransformOMPExecutableDirective(D);
10281 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10285template <
typename Derived>
10288 OMPTargetTeamsDistributeSimdDirective *D) {
10290 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10291 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10292 auto Res = getDerived().TransformOMPExecutableDirective(D);
10293 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10297template <
typename Derived>
10301 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10302 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10303 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10304 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10308template <
typename Derived>
10312 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10313 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10314 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10315 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10319template <
typename Derived>
10323 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10324 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10325 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10326 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10330template <
typename Derived>
10332 OMPGenericLoopDirective *D) {
10334 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10335 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10336 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10337 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10341template <
typename Derived>
10343 OMPTeamsGenericLoopDirective *D) {
10345 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10346 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10347 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10348 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10352template <
typename Derived>
10354 OMPTargetTeamsGenericLoopDirective *D) {
10356 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10357 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10358 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10359 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10363template <
typename Derived>
10365 OMPParallelGenericLoopDirective *D) {
10367 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10368 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10369 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10370 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10374template <
typename Derived>
10377 OMPTargetParallelGenericLoopDirective *D) {
10379 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10380 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10381 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10382 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10389template <
typename Derived>
10392 if (
Cond.isInvalid())
10394 return getDerived().RebuildOMPIfClause(
10395 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10396 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10399template <
typename Derived>
10402 if (
Cond.isInvalid())
10404 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10405 C->getLParenLoc(),
C->getEndLoc());
10408template <
typename Derived>
10411 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10412 if (NumThreads.isInvalid())
10414 return getDerived().RebuildOMPNumThreadsClause(
10415 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10416 C->getModifierLoc(),
C->getEndLoc());
10419template <
typename Derived>
10422 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10425 return getDerived().RebuildOMPSafelenClause(
10426 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10429template <
typename Derived>
10432 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10435 return getDerived().RebuildOMPAllocatorClause(
10436 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10439template <
typename Derived>
10442 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10445 return getDerived().RebuildOMPSimdlenClause(
10446 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10449template <
typename Derived>
10452 TransformedSizes.reserve(
C->getNumSizes());
10454 for (
Expr *E :
C->getSizesRefs()) {
10456 TransformedSizes.push_back(
nullptr);
10465 TransformedSizes.push_back(
T.get());
10468 if (!Changed && !getDerived().AlwaysRebuild())
10470 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10471 C->getLParenLoc(),
C->getEndLoc());
10474template <
typename Derived>
10478 TransformedArgs.reserve(
C->getNumLoops());
10480 for (
Expr *E :
C->getArgsRefs()) {
10482 TransformedArgs.push_back(
nullptr);
10491 TransformedArgs.push_back(
T.get());
10494 if (!Changed && !getDerived().AlwaysRebuild())
10496 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10497 C->getLParenLoc(),
C->getEndLoc());
10500template <
typename Derived>
10502 if (!getDerived().AlwaysRebuild())
10504 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10507template <
typename Derived>
10510 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10513 Expr *Factor =
T.get();
10514 bool Changed = Factor !=
C->getFactor();
10516 if (!Changed && !getDerived().AlwaysRebuild())
10518 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10522template <
typename Derived>
10525 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10529 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10530 if (Cn.isInvalid())
10534 Expr *Count = Cn.get();
10536 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10539 if (!Changed && !getDerived().AlwaysRebuild())
10542 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10543 C->getLParenLoc(),
C->getFirstLoc(),
10544 C->getCountLoc(),
C->getEndLoc());
10547template <
typename Derived>
10550 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10553 return getDerived().RebuildOMPCollapseClause(
10554 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10557template <
typename Derived>
10561 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10562 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10566template <
typename Derived>
10570 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10571 C->getLParenLoc(),
C->getEndLoc());
10574template <
typename Derived>
10577 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10580 return getDerived().RebuildOMPScheduleClause(
10581 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10582 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10583 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10584 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10587template <
typename Derived>
10591 if (
auto *
Num =
C->getNumForLoops()) {
10592 E = getDerived().TransformExpr(
Num);
10596 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10597 C->getLParenLoc(), E.get());
10600template <
typename Derived>
10604 if (
Expr *Evt =
C->getEventHandler()) {
10605 E = getDerived().TransformExpr(Evt);
10609 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10610 C->getLParenLoc(),
C->getEndLoc());
10613template <
typename Derived>
10620template <
typename Derived>
10627template <
typename Derived>
10634template <
typename Derived>
10640template <
typename Derived>
10646template <
typename Derived>
10653template <
typename Derived>
10660template <
typename Derived>
10667template <
typename Derived>
10673template <
typename Derived>
10679template <
typename Derived>
10681 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10684 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10685 C->getLParenLoc(),
C->getEndLoc());
10688template <
typename Derived>
10694template <
typename Derived>
10699template <
typename Derived>
10704template <
typename Derived>
10709template <
typename Derived>
10715template <
typename Derived>
10722template <
typename Derived>
10729template <
typename Derived>
10736template <
typename Derived>
10743template <
typename Derived>
10750template <
typename Derived>
10756template <
typename Derived>
10763template <
typename Derived>
10769template <
typename Derived>
10776template <
typename Derived>
10778 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10779 if (IVR.isInvalid())
10783 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10784 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10786 if (ER.isInvalid())
10788 InteropInfo.PreferTypes.push_back(ER.get());
10790 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10791 C->getBeginLoc(),
C->getLParenLoc(),
10792 C->getVarLoc(),
C->getEndLoc());
10795template <
typename Derived>
10797 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10798 if (ER.isInvalid())
10800 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10801 C->getLParenLoc(),
C->getVarLoc(),
10805template <
typename Derived>
10809 if (
Expr *IV =
C->getInteropVar()) {
10810 ER = getDerived().TransformExpr(IV);
10811 if (ER.isInvalid())
10814 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10815 C->getLParenLoc(),
C->getVarLoc(),
10819template <
typename Derived>
10823 if (
Cond.isInvalid())
10825 return getDerived().RebuildOMPNovariantsClause(
10826 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10829template <
typename Derived>
10833 if (
Cond.isInvalid())
10835 return getDerived().RebuildOMPNocontextClause(
10836 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10839template <
typename Derived>
10842 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10843 if (ThreadID.isInvalid())
10845 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10846 C->getLParenLoc(),
C->getEndLoc());
10849template <
typename Derived>
10851 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10854 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10855 C->getLParenLoc(),
C->getEndLoc());
10858template <
typename Derived>
10861 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10864template <
typename Derived>
10868 "unified_shared_memory clause cannot appear in dependent context");
10871template <
typename Derived>
10874 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10877template <
typename Derived>
10881 "dynamic_allocators clause cannot appear in dependent context");
10884template <
typename Derived>
10888 "atomic_default_mem_order clause cannot appear in dependent context");
10891template <
typename Derived>
10894 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10897template <
typename Derived>
10900 C->getBeginLoc(),
C->getLParenLoc(),
10904template <
typename Derived>
10908 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10909 C->getLParenLoc(),
C->getEndLoc());
10912template <
typename Derived>
10915 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10918 return getDerived().RebuildOMPMessageClause(
10919 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10922template <
typename Derived>
10926 Vars.reserve(
C->varlist_size());
10927 for (
auto *
VE :
C->varlist()) {
10929 if (EVar.isInvalid())
10931 Vars.push_back(EVar.get());
10933 return getDerived().RebuildOMPPrivateClause(
10934 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10937template <
typename Derived>
10941 Vars.reserve(
C->varlist_size());
10942 for (
auto *
VE :
C->varlist()) {
10944 if (EVar.isInvalid())
10946 Vars.push_back(EVar.get());
10948 return getDerived().RebuildOMPFirstprivateClause(
10949 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10952template <
typename Derived>
10956 Vars.reserve(
C->varlist_size());
10957 for (
auto *
VE :
C->varlist()) {
10959 if (EVar.isInvalid())
10961 Vars.push_back(EVar.get());
10963 return getDerived().RebuildOMPLastprivateClause(
10964 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10965 C->getLParenLoc(),
C->getEndLoc());
10968template <
typename Derived>
10972 Vars.reserve(
C->varlist_size());
10973 for (
auto *
VE :
C->varlist()) {
10975 if (EVar.isInvalid())
10977 Vars.push_back(EVar.get());
10979 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10980 C->getLParenLoc(),
C->getEndLoc());
10983template <
typename Derived>
10987 Vars.reserve(
C->varlist_size());
10988 for (
auto *
VE :
C->varlist()) {
10990 if (EVar.isInvalid())
10992 Vars.push_back(EVar.get());
10995 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
10998 if (NameInfo.getName()) {
10999 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11000 if (!NameInfo.getName())
11006 for (
auto *E :
C->reduction_ops()) {
11011 for (
auto *D : ULE->decls()) {
11014 Decls.addDecl(InstD, InstD->getAccess());
11018 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11019 true, Decls.begin(), Decls.end(),
11022 UnresolvedReductions.push_back(
nullptr);
11024 return getDerived().RebuildOMPReductionClause(
11025 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11026 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11027 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11030template <
typename Derived>
11034 Vars.reserve(
C->varlist_size());
11035 for (
auto *
VE :
C->varlist()) {
11037 if (EVar.isInvalid())
11039 Vars.push_back(EVar.get());
11042 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11045 if (NameInfo.getName()) {
11046 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11047 if (!NameInfo.getName())
11053 for (
auto *E :
C->reduction_ops()) {
11058 for (
auto *D : ULE->decls()) {
11061 Decls.addDecl(InstD, InstD->getAccess());
11065 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11066 true, Decls.begin(), Decls.end(),
11069 UnresolvedReductions.push_back(
nullptr);
11071 return getDerived().RebuildOMPTaskReductionClause(
11072 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11073 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11076template <
typename Derived>
11080 Vars.reserve(
C->varlist_size());
11081 for (
auto *
VE :
C->varlist()) {
11083 if (EVar.isInvalid())
11085 Vars.push_back(EVar.get());
11088 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11091 if (NameInfo.getName()) {
11092 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11093 if (!NameInfo.getName())
11099 for (
auto *E :
C->reduction_ops()) {
11104 for (
auto *D : ULE->decls()) {
11107 Decls.addDecl(InstD, InstD->getAccess());
11111 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11112 true, Decls.begin(), Decls.end(),
11115 UnresolvedReductions.push_back(
nullptr);
11117 return getDerived().RebuildOMPInReductionClause(
11118 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11119 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11122template <
typename Derived>
11126 Vars.reserve(
C->varlist_size());
11127 for (
auto *
VE :
C->varlist()) {
11129 if (EVar.isInvalid())
11131 Vars.push_back(EVar.get());
11133 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11134 if (Step.isInvalid())
11136 return getDerived().RebuildOMPLinearClause(
11137 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11138 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11142template <
typename Derived>
11146 Vars.reserve(
C->varlist_size());
11147 for (
auto *
VE :
C->varlist()) {
11149 if (EVar.isInvalid())
11151 Vars.push_back(EVar.get());
11153 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11154 if (Alignment.isInvalid())
11156 return getDerived().RebuildOMPAlignedClause(
11157 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11158 C->getColonLoc(),
C->getEndLoc());
11161template <
typename Derived>
11165 Vars.reserve(
C->varlist_size());
11166 for (
auto *
VE :
C->varlist()) {
11168 if (EVar.isInvalid())
11170 Vars.push_back(EVar.get());
11172 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11173 C->getLParenLoc(),
C->getEndLoc());
11176template <
typename Derived>
11180 Vars.reserve(
C->varlist_size());
11181 for (
auto *
VE :
C->varlist()) {
11183 if (EVar.isInvalid())
11185 Vars.push_back(EVar.get());
11187 return getDerived().RebuildOMPCopyprivateClause(
11188 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11191template <
typename Derived>
11194 Vars.reserve(
C->varlist_size());
11195 for (
auto *
VE :
C->varlist()) {
11197 if (EVar.isInvalid())
11199 Vars.push_back(EVar.get());
11201 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11202 C->getLParenLoc(),
C->getEndLoc());
11205template <
typename Derived>
11208 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11211 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11212 C->getLParenLoc(),
C->getEndLoc());
11215template <
typename Derived>
11219 Expr *DepModifier =
C->getModifier();
11221 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11222 if (DepModRes.isInvalid())
11224 DepModifier = DepModRes.get();
11226 Vars.reserve(
C->varlist_size());
11227 for (
auto *
VE :
C->varlist()) {
11229 if (EVar.isInvalid())
11231 Vars.push_back(EVar.get());
11233 return getDerived().RebuildOMPDependClause(
11234 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11235 C->getOmpAllMemoryLoc()},
11236 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11239template <
typename Derived>
11242 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11245 return getDerived().RebuildOMPDeviceClause(
11246 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11247 C->getModifierLoc(),
C->getEndLoc());
11250template <
typename Derived,
class T>
11257 Vars.reserve(
C->varlist_size());
11258 for (
auto *
VE :
C->varlist()) {
11262 Vars.push_back(EVar.
get());
11266 if (
C->getMapperQualifierLoc()) {
11267 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11268 C->getMapperQualifierLoc());
11272 MapperIdScopeSpec.
Adopt(QualifierLoc);
11273 MapperIdInfo =
C->getMapperIdInfo();
11274 if (MapperIdInfo.
getName()) {
11275 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11281 for (
auto *E :
C->mapperlists()) {
11286 for (
auto *D : ULE->decls()) {
11289 Decls.addDecl(InstD, InstD->
getAccess());
11294 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11297 UnresolvedMappers.push_back(
nullptr);
11303template <
typename Derived>
11304OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11305 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11307 Expr *IteratorModifier =
C->getIteratorModifier();
11308 if (IteratorModifier) {
11309 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11310 if (MapModRes.isInvalid())
11312 IteratorModifier = MapModRes.
get();
11318 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11320 return getDerived().RebuildOMPMapClause(
11321 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11322 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11323 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11326template <
typename Derived>
11329 Expr *Allocator =
C->getAllocator();
11331 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11332 if (AllocatorRes.isInvalid())
11334 Allocator = AllocatorRes.get();
11336 Expr *Alignment =
C->getAlignment();
11338 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11339 if (AlignmentRes.isInvalid())
11341 Alignment = AlignmentRes.get();
11344 Vars.reserve(
C->varlist_size());
11345 for (
auto *
VE :
C->varlist()) {
11347 if (EVar.isInvalid())
11349 Vars.push_back(EVar.get());
11351 return getDerived().RebuildOMPAllocateClause(
11352 Allocator, Alignment,
C->getFirstAllocateModifier(),
11353 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11354 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11355 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11358template <
typename Derived>
11362 Vars.reserve(
C->varlist_size());
11363 for (
auto *
VE :
C->varlist()) {
11365 if (EVar.isInvalid())
11367 Vars.push_back(EVar.get());
11369 return getDerived().RebuildOMPNumTeamsClause(
11370 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11373template <
typename Derived>
11377 Vars.reserve(
C->varlist_size());
11378 for (
auto *
VE :
C->varlist()) {
11380 if (EVar.isInvalid())
11382 Vars.push_back(EVar.get());
11384 return getDerived().RebuildOMPThreadLimitClause(
11385 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11388template <
typename Derived>
11391 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11394 return getDerived().RebuildOMPPriorityClause(
11395 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11398template <
typename Derived>
11401 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11404 return getDerived().RebuildOMPGrainsizeClause(
11405 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11406 C->getModifierLoc(),
C->getEndLoc());
11409template <
typename Derived>
11412 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11415 return getDerived().RebuildOMPNumTasksClause(
11416 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11417 C->getModifierLoc(),
C->getEndLoc());
11420template <
typename Derived>
11422 ExprResult E = getDerived().TransformExpr(
C->getHint());
11425 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11426 C->getLParenLoc(),
C->getEndLoc());
11429template <
typename Derived>
11432 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11435 return getDerived().RebuildOMPDistScheduleClause(
11436 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11437 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11440template <
typename Derived>
11446 C->getDefaultmapKind(),
11449 C->getDefaultmapModifierLoc(),
11450 C->getDefaultmapKindLoc(),
11454template <
typename Derived>
11462 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11464 return getDerived().RebuildOMPToClause(
11465 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11466 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11469template <
typename Derived>
11477 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11479 return getDerived().RebuildOMPFromClause(
11480 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11481 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11484template <
typename Derived>
11488 Vars.reserve(
C->varlist_size());
11489 for (
auto *
VE :
C->varlist()) {
11491 if (EVar.isInvalid())
11493 Vars.push_back(EVar.get());
11496 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11499template <
typename Derived>
11503 Vars.reserve(
C->varlist_size());
11504 for (
auto *
VE :
C->varlist()) {
11506 if (EVar.isInvalid())
11508 Vars.push_back(EVar.get());
11511 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11514template <
typename Derived>
11518 Vars.reserve(
C->varlist_size());
11519 for (
auto *
VE :
C->varlist()) {
11521 if (EVar.isInvalid())
11523 Vars.push_back(EVar.get());
11526 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11529template <
typename Derived>
11533 Vars.reserve(
C->varlist_size());
11534 for (
auto *
VE :
C->varlist()) {
11536 if (EVar.isInvalid())
11538 Vars.push_back(EVar.get());
11541 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11544template <
typename Derived>
11548 Vars.reserve(
C->varlist_size());
11549 for (
auto *
VE :
C->varlist()) {
11551 if (EVar.isInvalid())
11553 Vars.push_back(EVar.get());
11555 return getDerived().RebuildOMPNontemporalClause(
11556 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11559template <
typename Derived>
11563 Vars.reserve(
C->varlist_size());
11564 for (
auto *
VE :
C->varlist()) {
11566 if (EVar.isInvalid())
11568 Vars.push_back(EVar.get());
11570 return getDerived().RebuildOMPInclusiveClause(
11571 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11574template <
typename Derived>
11578 Vars.reserve(
C->varlist_size());
11579 for (
auto *
VE :
C->varlist()) {
11581 if (EVar.isInvalid())
11583 Vars.push_back(EVar.get());
11585 return getDerived().RebuildOMPExclusiveClause(
11586 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11589template <
typename Derived>
11593 Data.reserve(
C->getNumberOfAllocators());
11594 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11596 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11597 if (Allocator.isInvalid())
11600 if (
Expr *AT = D.AllocatorTraits) {
11601 AllocatorTraits = getDerived().TransformExpr(AT);
11602 if (AllocatorTraits.isInvalid())
11606 NewD.Allocator = Allocator.get();
11607 NewD.AllocatorTraits = AllocatorTraits.get();
11608 NewD.LParenLoc = D.LParenLoc;
11609 NewD.RParenLoc = D.RParenLoc;
11611 return getDerived().RebuildOMPUsesAllocatorsClause(
11612 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11615template <
typename Derived>
11619 Locators.reserve(
C->varlist_size());
11621 if (
Expr *Modifier =
C->getModifier()) {
11622 ModifierRes = getDerived().TransformExpr(Modifier);
11623 if (ModifierRes.isInvalid())
11626 for (
Expr *E :
C->varlist()) {
11627 ExprResult Locator = getDerived().TransformExpr(E);
11628 if (Locator.isInvalid())
11630 Locators.push_back(Locator.get());
11632 return getDerived().RebuildOMPAffinityClause(
11633 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11634 ModifierRes.get(), Locators);
11637template <
typename Derived>
11640 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11641 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11644template <
typename Derived>
11647 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11648 C->getLParenLoc(),
C->getEndLoc());
11651template <
typename Derived>
11655 if (
Size.isInvalid())
11657 return getDerived().RebuildOMPXDynCGroupMemClause(
11658 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11661template <
typename Derived>
11665 Vars.reserve(
C->varlist_size());
11666 for (
auto *
VE :
C->varlist()) {
11668 if (EVar.isInvalid())
11670 Vars.push_back(EVar.get());
11672 return getDerived().RebuildOMPDoacrossClause(
11673 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11674 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11677template <
typename Derived>
11681 for (
auto *A :
C->getAttrs())
11682 NewAttrs.push_back(getDerived().TransformAttr(A));
11683 return getDerived().RebuildOMPXAttributeClause(
11684 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11687template <
typename Derived>
11696template <
typename Derived>
11697class OpenACCClauseTransform final
11699 TreeTransform<Derived> &Self;
11700 ArrayRef<const OpenACCClause *> ExistingClauses;
11701 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11702 OpenACCClause *NewClause =
nullptr;
11705 ExprResult Res = Self.TransformExpr(VarRef);
11707 if (!Res.isUsable())
11710 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11711 ParsedClause.getClauseKind(),
11717 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11718 llvm::SmallVector<Expr *> InstantiatedVarList;
11719 for (Expr *CurVar : VarList) {
11722 if (VarRef.isUsable())
11723 InstantiatedVarList.push_back(VarRef.get());
11726 return InstantiatedVarList;
11730 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11731 ArrayRef<const OpenACCClause *> ExistingClauses,
11732 SemaOpenACC::OpenACCParsedClause &PC)
11733 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11735 OpenACCClause *CreatedClause()
const {
return NewClause; }
11737#define VISIT_CLAUSE(CLAUSE_NAME) \
11738 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11739#include "clang/Basic/OpenACCClauses.def"
11742template <
typename Derived>
11743void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11745 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11748 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11749 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11750 ParsedClause.getEndLoc());
11753template <
typename Derived>
11754void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11756 assert(
Cond &&
"If constructed with invalid Condition");
11760 if (Res.isInvalid() || !Res.get().second)
11763 ParsedClause.setConditionDetails(Res.get().second);
11766 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11767 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11768 ParsedClause.getEndLoc());
11771template <
typename Derived>
11772void OpenACCClauseTransform<Derived>::VisitSelfClause(
11778 for (
Expr *CurVar :
C.getVarList()) {
11781 if (!Res.isUsable())
11784 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11785 ParsedClause.getClauseKind(),
11788 if (Res.isUsable())
11789 InstantiatedVarList.push_back(Res.get());
11792 ParsedClause.setVarListDetails(InstantiatedVarList,
11796 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11797 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11798 ParsedClause.getEndLoc());
11801 if (
C.hasConditionExpr()) {
11804 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11807 if (Res.isInvalid() || !Res.get().second)
11810 ParsedClause.setConditionDetails(Res.get().second);
11814 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11815 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11816 ParsedClause.getEndLoc());
11820template <
typename Derived>
11821void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11825 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11828 if (!Res.isUsable())
11833 C.getBeginLoc(), Res.get());
11834 if (!Res.isUsable())
11837 InstantiatedIntExprs.push_back(Res.get());
11840 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11842 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11843 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11844 ParsedClause.getEndLoc());
11847template <
typename Derived>
11848void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11853 for (
const auto [RefExpr, InitRecipe] :
11854 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11857 if (VarRef.isUsable()) {
11858 InstantiatedVarList.push_back(VarRef.get());
11862 if (InitRecipe.isSet())
11863 InitRecipes.push_back(InitRecipe);
11865 InitRecipes.push_back(
11866 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11869 ParsedClause.setVarListDetails(InstantiatedVarList,
11873 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11874 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11875 ParsedClause.getEndLoc());
11878template <
typename Derived>
11879void OpenACCClauseTransform<Derived>::VisitHostClause(
11881 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11885 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11886 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11887 ParsedClause.getEndLoc());
11890template <
typename Derived>
11891void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11893 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11897 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11898 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11899 ParsedClause.getEndLoc());
11902template <
typename Derived>
11903void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11908 for (
const auto [RefExpr, InitRecipe] :
11909 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11912 if (VarRef.isUsable()) {
11913 InstantiatedVarList.push_back(VarRef.get());
11917 if (InitRecipe.isSet())
11918 InitRecipes.push_back(InitRecipe);
11920 InitRecipes.push_back(
11921 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
11925 ParsedClause.setVarListDetails(InstantiatedVarList,
11929 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11930 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11931 ParsedClause.getEndLoc());
11934template <
typename Derived>
11935void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11937 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11941 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11942 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11943 ParsedClause.getEndLoc());
11946template <
typename Derived>
11947void OpenACCClauseTransform<Derived>::VisitPresentClause(
11949 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11953 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11954 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11955 ParsedClause.getEndLoc());
11958template <
typename Derived>
11959void OpenACCClauseTransform<Derived>::VisitCopyClause(
11961 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11962 C.getModifierList());
11965 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
11966 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11967 ParsedClause.getModifierList(), ParsedClause.getVarList(),
11968 ParsedClause.getEndLoc());
11971template <
typename Derived>
11972void OpenACCClauseTransform<Derived>::VisitLinkClause(
11974 llvm_unreachable(
"link clause not valid unless a decl transform");
11977template <
typename Derived>
11978void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
11980 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
11982template <
typename Derived>
11983void OpenACCClauseTransform<Derived>::VisitNoHostClause(
11985 llvm_unreachable(
"nohost clause not valid unless a decl transform");
11987template <
typename Derived>
11988void OpenACCClauseTransform<Derived>::VisitBindClause(
11990 llvm_unreachable(
"bind clause not valid unless a decl transform");
11993template <
typename Derived>
11994void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11996 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11997 C.getModifierList());
12000 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12001 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12002 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12003 ParsedClause.getEndLoc());
12006template <
typename Derived>
12007void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12009 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12010 C.getModifierList());
12013 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12014 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12015 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12016 ParsedClause.getEndLoc());
12019template <
typename Derived>
12020void OpenACCClauseTransform<Derived>::VisitCreateClause(
12022 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12023 C.getModifierList());
12026 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12027 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12028 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12029 ParsedClause.getEndLoc());
12031template <
typename Derived>
12032void OpenACCClauseTransform<Derived>::VisitAttachClause(
12037 llvm::erase_if(VarList, [&](
Expr *E) {
12038 return Self.getSema().OpenACC().CheckVarIsPointerType(
12044 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12045 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12046 ParsedClause.getEndLoc());
12049template <
typename Derived>
12050void OpenACCClauseTransform<Derived>::VisitDetachClause(
12055 llvm::erase_if(VarList, [&](
Expr *E) {
12056 return Self.getSema().OpenACC().CheckVarIsPointerType(
12062 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12063 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12064 ParsedClause.getEndLoc());
12067template <
typename Derived>
12068void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12070 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12073 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12074 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12075 ParsedClause.getEndLoc());
12078template <
typename Derived>
12079void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12081 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12084 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12085 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12086 ParsedClause.getEndLoc());
12089template <
typename Derived>
12090void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12095 llvm::erase_if(VarList, [&](
Expr *E) {
12096 return Self.getSema().OpenACC().CheckVarIsPointerType(
12102 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12103 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12104 ParsedClause.getEndLoc());
12107template <
typename Derived>
12108void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12110 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12111 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12114 if (!Res.isUsable())
12119 C.getBeginLoc(), Res.get());
12120 if (!Res.isUsable())
12123 ParsedClause.setIntExprDetails(Res.get());
12125 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12126 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12127 ParsedClause.getEndLoc());
12130template <
typename Derived>
12131void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12133 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12134 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12137 if (!Res.isUsable())
12142 C.getBeginLoc(), Res.get());
12143 if (!Res.isUsable())
12146 ParsedClause.setIntExprDetails(Res.get());
12148 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12149 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12150 ParsedClause.getEndLoc());
12153template <
typename Derived>
12154void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12156 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12157 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12160 if (!Res.isUsable())
12165 C.getBeginLoc(), Res.get());
12166 if (!Res.isUsable())
12169 ParsedClause.setIntExprDetails(Res.get());
12171 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12172 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12173 ParsedClause.getEndLoc());
12176template <
typename Derived>
12177void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12179 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12180 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12183 if (!Res.isUsable())
12188 C.getBeginLoc(), Res.get());
12189 if (!Res.isUsable())
12192 ParsedClause.setIntExprDetails(Res.get());
12194 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12195 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12196 ParsedClause.getEndLoc());
12199template <
typename Derived>
12200void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12202 if (
C.hasIntExpr()) {
12204 if (!Res.isUsable())
12209 C.getBeginLoc(), Res.get());
12210 if (!Res.isUsable())
12212 ParsedClause.setIntExprDetails(Res.get());
12216 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12217 ParsedClause.getLParenLoc(),
12218 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12220 ParsedClause.getEndLoc());
12223template <
typename Derived>
12224void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12226 if (
C.hasIntExpr()) {
12231 if (!Res.isUsable())
12236 C.getBeginLoc(), Res.get());
12237 if (!Res.isUsable())
12239 ParsedClause.setIntExprDetails(Res.get());
12243 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12244 ParsedClause.getLParenLoc(),
12245 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12247 ParsedClause.getEndLoc());
12250template <
typename Derived>
12251void OpenACCClauseTransform<Derived>::VisitVectorClause(
12253 if (
C.hasIntExpr()) {
12258 if (!Res.isUsable())
12263 C.getBeginLoc(), Res.get());
12264 if (!Res.isUsable())
12266 ParsedClause.setIntExprDetails(Res.get());
12270 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12271 ParsedClause.getLParenLoc(),
12272 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12274 ParsedClause.getEndLoc());
12277template <
typename Derived>
12278void OpenACCClauseTransform<Derived>::VisitWaitClause(
12280 if (
C.hasExprs()) {
12281 Expr *DevNumExpr =
nullptr;
12285 if (
C.getDevNumExpr()) {
12287 if (!Res.isUsable())
12291 C.getBeginLoc(), Res.get());
12292 if (!Res.isUsable())
12295 DevNumExpr = Res.get();
12299 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12301 if (!Res.isUsable())
12305 C.getBeginLoc(), Res.get());
12306 if (!Res.isUsable())
12309 InstantiatedQueueIdExprs.push_back(Res.get());
12312 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12313 std::move(InstantiatedQueueIdExprs));
12317 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12318 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12319 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12320 ParsedClause.getEndLoc());
12323template <
typename Derived>
12324void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12328 Self.getSema().getASTContext(),
C.getClauseKind(),
12329 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12330 C.getArchitectures(), ParsedClause.getEndLoc());
12333template <
typename Derived>
12334void OpenACCClauseTransform<Derived>::VisitAutoClause(
12338 ParsedClause.getBeginLoc(),
12339 ParsedClause.getEndLoc());
12342template <
typename Derived>
12343void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12346 ParsedClause.getBeginLoc(),
12347 ParsedClause.getEndLoc());
12350template <
typename Derived>
12351void OpenACCClauseTransform<Derived>::VisitSeqClause(
12354 ParsedClause.getBeginLoc(),
12355 ParsedClause.getEndLoc());
12357template <
typename Derived>
12358void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12361 ParsedClause.getBeginLoc(),
12362 ParsedClause.getEndLoc());
12365template <
typename Derived>
12366void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12369 ParsedClause.getBeginLoc(),
12370 ParsedClause.getEndLoc());
12373template <
typename Derived>
12374void OpenACCClauseTransform<Derived>::VisitReductionClause(
12380 for (
const auto [Var, OrigRecipe] :
12381 llvm::zip(TransformedVars,
C.getRecipes())) {
12383 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12384 if (Res.isUsable()) {
12385 ValidVars.push_back(Res.get());
12387 if (OrigRecipe.isSet())
12388 Recipes.push_back(OrigRecipe);
12390 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12391 C.getReductionOp(), Res.get()));
12395 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12396 ExistingClauses, ParsedClause.getDirectiveKind(),
12397 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12398 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12401template <
typename Derived>
12402void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12404 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12405 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12409 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12411 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12414 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12416 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12418 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12419 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12420 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12423template <
typename Derived>
12424void OpenACCClauseTransform<Derived>::VisitTileClause(
12429 for (
Expr *E :
C.getSizeExprs()) {
12432 if (!NewSizeExpr.isUsable())
12435 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12437 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12439 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12441 if (!NewSizeExpr.isUsable())
12443 TransformedExprs.push_back(NewSizeExpr.get());
12446 ParsedClause.setIntExprDetails(TransformedExprs);
12448 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12449 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12450 ParsedClause.getEndLoc());
12452template <
typename Derived>
12453void OpenACCClauseTransform<Derived>::VisitGangClause(
12458 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12460 if (!ER.isUsable())
12463 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12464 ParsedClause.getDirectiveKind(),
12465 C.getExpr(I).first, ER.get());
12466 if (!ER.isUsable())
12468 TransformedGangKinds.push_back(
C.getExpr(I).first);
12469 TransformedIntExprs.push_back(ER.get());
12472 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12473 ParsedClause.getDirectiveKind(), ExistingClauses,
12474 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12475 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12478template <
typename Derived>
12479OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12484 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12485 ParsedClause.setEndLoc(OldClause->getEndLoc());
12487 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12488 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12490 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12492 Transform.Visit(OldClause);
12494 return Transform.CreatedClause();
12497template <
typename Derived>
12499TreeTransform<Derived>::TransformOpenACCClauseList(
12502 for (
const auto *Clause : OldClauses) {
12503 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12504 TransformedClauses, DirKind, Clause))
12505 TransformedClauses.push_back(TransformedClause);
12507 return TransformedClauses;
12510template <
typename Derived>
12513 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12516 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12519 if (getSema().OpenACC().ActOnStartStmtDirective(
12520 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12525 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12526 C->clauses(), TransformedClauses);
12527 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12528 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12529 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12531 return getDerived().RebuildOpenACCComputeConstruct(
12532 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12533 C->getEndLoc(), TransformedClauses, StrBlock);
12536template <
typename Derived>
12540 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12543 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12546 if (getSema().OpenACC().ActOnStartStmtDirective(
12547 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12552 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12553 C->clauses(), TransformedClauses);
12555 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12556 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12558 return getDerived().RebuildOpenACCLoopConstruct(
12559 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12560 TransformedClauses,
Loop);
12563template <
typename Derived>
12565 OpenACCCombinedConstruct *
C) {
12566 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12569 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12572 if (getSema().OpenACC().ActOnStartStmtDirective(
12573 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12578 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12579 C->clauses(), TransformedClauses);
12581 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12582 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12584 return getDerived().RebuildOpenACCCombinedConstruct(
12585 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12586 C->getEndLoc(), TransformedClauses,
Loop);
12589template <
typename Derived>
12592 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12595 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12597 if (getSema().OpenACC().ActOnStartStmtDirective(
12598 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12602 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12603 C->clauses(), TransformedClauses);
12604 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12605 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12606 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12608 return getDerived().RebuildOpenACCDataConstruct(
12609 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12610 TransformedClauses, StrBlock);
12613template <
typename Derived>
12615 OpenACCEnterDataConstruct *
C) {
12616 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12619 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12621 if (getSema().OpenACC().ActOnStartStmtDirective(
12622 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12625 return getDerived().RebuildOpenACCEnterDataConstruct(
12626 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12627 TransformedClauses);
12630template <
typename Derived>
12632 OpenACCExitDataConstruct *
C) {
12633 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12636 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12638 if (getSema().OpenACC().ActOnStartStmtDirective(
12639 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12642 return getDerived().RebuildOpenACCExitDataConstruct(
12643 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12644 TransformedClauses);
12647template <
typename Derived>
12649 OpenACCHostDataConstruct *
C) {
12650 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12653 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12655 if (getSema().OpenACC().ActOnStartStmtDirective(
12656 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12660 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12661 C->clauses(), TransformedClauses);
12662 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12663 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12664 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12666 return getDerived().RebuildOpenACCHostDataConstruct(
12667 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12668 TransformedClauses, StrBlock);
12671template <
typename Derived>
12674 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12677 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12679 if (getSema().OpenACC().ActOnStartStmtDirective(
12680 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12683 return getDerived().RebuildOpenACCInitConstruct(
12684 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12685 TransformedClauses);
12688template <
typename Derived>
12690 OpenACCShutdownConstruct *
C) {
12691 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12694 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12696 if (getSema().OpenACC().ActOnStartStmtDirective(
12697 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12700 return getDerived().RebuildOpenACCShutdownConstruct(
12701 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12702 TransformedClauses);
12704template <
typename Derived>
12707 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12710 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12712 if (getSema().OpenACC().ActOnStartStmtDirective(
12713 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12716 return getDerived().RebuildOpenACCSetConstruct(
12717 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12718 TransformedClauses);
12721template <
typename Derived>
12723 OpenACCUpdateConstruct *
C) {
12724 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12727 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12729 if (getSema().OpenACC().ActOnStartStmtDirective(
12730 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12733 return getDerived().RebuildOpenACCUpdateConstruct(
12734 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12735 TransformedClauses);
12738template <
typename Derived>
12741 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12744 if (
C->hasDevNumExpr()) {
12745 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12747 if (DevNumExpr.isUsable())
12748 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12750 C->getBeginLoc(), DevNumExpr.get());
12755 for (
Expr *QE :
C->getQueueIdExprs()) {
12756 assert(QE &&
"Null queue id expr?");
12757 ExprResult NewEQ = getDerived().TransformExpr(QE);
12759 if (!NewEQ.isUsable())
12763 C->getBeginLoc(), NewEQ.get());
12764 if (NewEQ.isUsable())
12765 QueueIdExprs.push_back(NewEQ.get());
12769 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12772 if (getSema().OpenACC().ActOnStartStmtDirective(
12773 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12776 return getDerived().RebuildOpenACCWaitConstruct(
12777 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12778 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12779 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12781template <
typename Derived>
12783 OpenACCCacheConstruct *
C) {
12784 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12787 for (
Expr *Var :
C->getVarList()) {
12788 assert(Var &&
"Null var listexpr?");
12790 ExprResult NewVar = getDerived().TransformExpr(Var);
12792 if (!NewVar.isUsable())
12795 NewVar = getSema().OpenACC().ActOnVar(
12797 if (!NewVar.isUsable())
12800 TransformedVarList.push_back(NewVar.get());
12803 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12804 C->getBeginLoc(), {}))
12807 return getDerived().RebuildOpenACCCacheConstruct(
12808 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12809 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12813template <
typename Derived>
12815 OpenACCAtomicConstruct *
C) {
12816 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12819 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12822 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12823 C->getBeginLoc(), {}))
12828 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12830 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12831 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12832 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12835 return getDerived().RebuildOpenACCAtomicConstruct(
12836 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12837 C->getEndLoc(), TransformedClauses, AssocStmt);
12840template <
typename Derived>
12843 if (getDerived().AlwaysRebuild())
12852template<
typename Derived>
12855 return TransformExpr(E->getSubExpr());
12858template <
typename Derived>
12861 if (!E->isTypeDependent())
12864 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12869 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12872 return getDerived().RebuildSYCLUniqueStableNameExpr(
12873 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12876template<
typename Derived>
12879 if (!E->isTypeDependent())
12883 E->getIdentKind());
12886template<
typename Derived>
12890 if (E->getQualifierLoc()) {
12892 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12898 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
12900 if (!ND || ND->isInvalidDecl())
12904 if (E->getFoundDecl() != E->getDecl()) {
12905 Found = cast_or_null<NamedDecl>(
12906 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
12912 if (NameInfo.getName()) {
12913 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12914 if (!NameInfo.getName())
12918 if (!getDerived().AlwaysRebuild() &&
12919 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12920 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
12921 Found == E->getFoundDecl() &&
12922 NameInfo.getName() == E->getDecl()->getDeclName() &&
12923 !E->hasExplicitTemplateArgs()) {
12933 if (E->hasExplicitTemplateArgs()) {
12934 TemplateArgs = &TransArgs;
12935 TransArgs.setLAngleLoc(E->getLAngleLoc());
12936 TransArgs.setRAngleLoc(E->getRAngleLoc());
12937 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
12938 E->getNumTemplateArgs(),
12943 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
12944 Found, TemplateArgs);
12947template<
typename Derived>
12953template <
typename Derived>
12959template<
typename Derived>
12965template<
typename Derived>
12971template<
typename Derived>
12977template<
typename Derived>
12983template<
typename Derived>
12986 return getDerived().TransformCallExpr(E);
12989template<
typename Derived>
12994 if (E->isExprPredicate())
12995 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
12997 ControllingType = getDerived().TransformType(E->getControllingType());
12999 if (ControllingExpr.isInvalid() && !ControllingType)
13010 AssocTypes.push_back(AssocType);
13012 AssocTypes.push_back(
nullptr);
13016 getDerived().TransformExpr(Assoc.getAssociationExpr());
13017 if (AssocExpr.isInvalid())
13019 AssocExprs.push_back(AssocExpr.get());
13022 if (!ControllingType)
13023 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13024 E->getDefaultLoc(),
13026 ControllingExpr.get(),
13029 return getDerived().RebuildGenericSelectionExpr(
13030 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13031 ControllingType, AssocTypes, AssocExprs);
13034template<
typename Derived>
13037 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13038 if (SubExpr.isInvalid())
13041 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13044 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13051template<
typename Derived>
13055 return getDerived().TransformDependentScopeDeclRefExpr(
13056 DRE,
true,
nullptr);
13058 return getDerived().TransformUnresolvedLookupExpr(
13064template<
typename Derived>
13069 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13075 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13083template<
typename Derived>
13085TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13087 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13097 bool ExprChanged =
false;
13098 typedef Sema::OffsetOfComponent Component;
13100 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13101 const OffsetOfNode &ON = E->getComponent(I);
13103 Comp.isBrackets =
true;
13104 Comp.LocStart = ON.getSourceRange().getBegin();
13105 Comp.LocEnd = ON.getSourceRange().getEnd();
13106 switch (ON.getKind()) {
13108 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13109 ExprResult Index = getDerived().TransformExpr(FromIndex);
13110 if (Index.isInvalid())
13113 ExprChanged = ExprChanged || Index.get() != FromIndex;
13114 Comp.isBrackets =
true;
13115 Comp.U.E = Index.get();
13121 Comp.isBrackets =
false;
13122 Comp.U.IdentInfo = ON.getFieldName();
13123 if (!
Comp.U.IdentInfo)
13133 Components.push_back(Comp);
13137 if (!getDerived().AlwaysRebuild() &&
13138 Type == E->getTypeSourceInfo() &&
13143 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13144 Components, E->getRParenLoc());
13147template<
typename Derived>
13150 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13151 "opaque value expression requires transformation");
13155template <
typename Derived>
13159 for (
Expr *
C : E->subExpressions()) {
13161 if (NewC.isInvalid())
13167 if (!getDerived().AlwaysRebuild() && !Changed)
13169 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13173template<
typename Derived>
13183 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13184 if (result.isInvalid())
return ExprError();
13189 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13195template<
typename Derived>
13199 if (E->isArgumentType()) {
13206 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13209 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13211 E->getSourceRange());
13225 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13227 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13228 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13229 PE, DRE,
false, &RecoveryTSI);
13231 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13234 return getDerived().RebuildUnaryExprOrTypeTrait(
13235 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13236 }
else if (SubExpr.isInvalid())
13239 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13242 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13243 E->getOperatorLoc(),
13245 E->getSourceRange());
13248template<
typename Derived>
13251 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13252 if (LHS.isInvalid())
13255 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13256 if (RHS.isInvalid())
13260 if (!getDerived().AlwaysRebuild() &&
13261 LHS.get() == E->getLHS() &&
13262 RHS.get() == E->getRHS())
13265 return getDerived().RebuildArraySubscriptExpr(
13267 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13270template <
typename Derived>
13274 if (
Base.isInvalid())
13277 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13278 if (RowIdx.isInvalid())
13281 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13282 if (ColumnIdx.isInvalid())
13285 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13286 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13289 return getDerived().RebuildMatrixSubscriptExpr(
13290 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13293template <
typename Derived>
13297 if (
Base.isInvalid())
13301 if (E->getLowerBound()) {
13302 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13303 if (LowerBound.isInvalid())
13308 if (E->getLength()) {
13309 Length = getDerived().TransformExpr(E->getLength());
13310 if (Length.isInvalid())
13315 if (E->isOMPArraySection()) {
13316 if (
Expr *Str = E->getStride()) {
13317 Stride = getDerived().TransformExpr(Str);
13318 if (Stride.isInvalid())
13323 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13324 LowerBound.get() == E->getLowerBound() &&
13325 Length.get() == E->getLength() &&
13326 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13329 return getDerived().RebuildArraySectionExpr(
13330 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13331 LowerBound.get(), E->getColonLocFirst(),
13332 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13333 Length.get(), Stride.get(), E->getRBracketLoc());
13336template <
typename Derived>
13340 if (
Base.isInvalid())
13344 bool ErrorFound =
false;
13345 for (
Expr *
Dim : E->getDimensions()) {
13347 if (DimRes.isInvalid()) {
13351 Dims.push_back(DimRes.get());
13356 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13357 E->getRParenLoc(), Dims,
13358 E->getBracketsRanges());
13361template <
typename Derived>
13364 unsigned NumIterators = E->numOfIterators();
13367 bool ErrorFound =
false;
13368 bool NeedToRebuild = getDerived().AlwaysRebuild();
13369 for (
unsigned I = 0; I < NumIterators; ++I) {
13371 Data[I].DeclIdent = D->getIdentifier();
13372 Data[I].DeclIdentLoc = D->getLocation();
13373 if (D->getLocation() == D->getBeginLoc()) {
13375 "Implicit type must be int.");
13377 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13385 ErrorFound = ErrorFound ||
13386 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13387 !
Data[I].Type.get().isNull())) ||
13388 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13391 Data[I].Range.Begin = Begin.get();
13392 Data[I].Range.End = End.get();
13393 Data[I].Range.Step = Step.get();
13394 Data[I].AssignLoc = E->getAssignLoc(I);
13395 Data[I].ColonLoc = E->getColonLoc(I);
13396 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13399 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13400 D->getType().getTypePtrOrNull()) ||
13406 if (!NeedToRebuild)
13409 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13410 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13411 if (!Res.isUsable())
13414 for (
unsigned I = 0; I < NumIterators; ++I)
13415 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13416 IE->getIteratorDecl(I));
13420template<
typename Derived>
13429 bool ArgChanged =
false;
13431 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13435 if (!getDerived().AlwaysRebuild() &&
13436 Callee.get() == E->getCallee() &&
13442 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13445 if (E->hasStoredFPFeatures()) {
13447 getSema().CurFPFeatures =
13449 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13452 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13454 E->getRParenLoc());
13457template<
typename Derived>
13461 if (
Base.isInvalid())
13465 if (E->hasQualifier()) {
13467 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13475 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13476 E->getMemberDecl()));
13480 NamedDecl *FoundDecl = E->getFoundDecl();
13481 if (FoundDecl == E->getMemberDecl()) {
13484 FoundDecl = cast_or_null<NamedDecl>(
13485 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13490 if (!getDerived().AlwaysRebuild() &&
13491 Base.get() == E->getBase() &&
13492 QualifierLoc == E->getQualifierLoc() &&
13493 Member == E->getMemberDecl() &&
13494 FoundDecl == E->getFoundDecl() &&
13495 !E->hasExplicitTemplateArgs()) {
13500 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13510 if (E->hasExplicitTemplateArgs()) {
13511 TransArgs.setLAngleLoc(E->getLAngleLoc());
13512 TransArgs.setRAngleLoc(E->getRAngleLoc());
13513 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13514 E->getNumTemplateArgs(),
13527 NamedDecl *FirstQualifierInScope =
nullptr;
13529 if (MemberNameInfo.getName()) {
13530 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13531 if (!MemberNameInfo.getName())
13535 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13542 (E->hasExplicitTemplateArgs()
13543 ? &TransArgs :
nullptr),
13544 FirstQualifierInScope);
13547template<
typename Derived>
13550 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13551 if (LHS.isInvalid())
13555 getDerived().TransformInitializer(E->getRHS(),
false);
13556 if (RHS.isInvalid())
13559 if (!getDerived().AlwaysRebuild() &&
13560 LHS.get() == E->getLHS() &&
13561 RHS.get() == E->getRHS())
13564 if (E->isCompoundAssignmentOp())
13566 return getDerived().RebuildBinaryOperator(
13567 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13570 getSema().CurFPFeatures =
13571 NewOverrides.applyOverrides(getSema().getLangOpts());
13572 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13573 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13574 LHS.get(), RHS.get());
13577template <
typename Derived>
13582 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13583 if (LHS.isInvalid())
13586 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13587 if (RHS.isInvalid())
13593 bool ChangedAnyLookups =
false;
13594 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13595 const_cast<Expr *
>(Decomp.InnerBinOp)};
13596 for (
Expr *PossibleBinOp : PossibleBinOps) {
13597 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13600 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13606 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13607 E->getOperatorLoc(),
Callee->getFoundDecl()));
13611 ChangedAnyLookups =
true;
13612 UnqualLookups.addDecl(
Found);
13615 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13616 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13622 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13627 return getDerived().RebuildCXXRewrittenBinaryOperator(
13628 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13631template<
typename Derived>
13637 getSema().CurFPFeatures =
13638 NewOverrides.applyOverrides(getSema().getLangOpts());
13639 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13640 return getDerived().TransformBinaryOperator(E);
13643template<
typename Derived>
13649 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13650 if (commonExpr.isInvalid())
13653 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13654 if (rhs.isInvalid())
13657 if (!getDerived().AlwaysRebuild() &&
13658 commonExpr.get() == e->getCommon() &&
13659 rhs.get() == e->getFalseExpr())
13662 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13663 e->getQuestionLoc(),
13669template<
typename Derived>
13673 if (
Cond.isInvalid())
13676 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13677 if (LHS.isInvalid())
13680 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13681 if (RHS.isInvalid())
13684 if (!getDerived().AlwaysRebuild() &&
13685 Cond.get() == E->getCond() &&
13686 LHS.get() == E->getLHS() &&
13687 RHS.get() == E->getRHS())
13690 return getDerived().RebuildConditionalOperator(
Cond.get(),
13691 E->getQuestionLoc(),
13697template<
typename Derived>
13702 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13705template<
typename Derived>
13713 = getDerived().TransformExpr(E->getSubExprAsWritten());
13714 if (SubExpr.isInvalid())
13717 if (!getDerived().AlwaysRebuild() &&
13718 Type == E->getTypeInfoAsWritten() &&
13719 SubExpr.get() == E->getSubExpr())
13722 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13728template<
typename Derived>
13736 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13737 if (
Init.isInvalid())
13740 if (!getDerived().AlwaysRebuild() &&
13742 Init.get() == E->getInitializer())
13749 return getDerived().RebuildCompoundLiteralExpr(
13750 E->getLParenLoc(), NewT,
13751 E->getInitializer()->getEndLoc(),
Init.get());
13754template<
typename Derived>
13758 if (
Base.isInvalid())
13761 if (!getDerived().AlwaysRebuild() &&
13762 Base.get() == E->getBase())
13768 return getDerived().RebuildExtVectorElementExpr(
13769 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13773template<
typename Derived>
13779 bool InitChanged =
false;
13785 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13786 Inits, &InitChanged))
13789 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13796 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13797 E->getRBraceLoc());
13800template<
typename Derived>
13807 if (
Init.isInvalid())
13812 bool ExprChanged =
false;
13814 if (D.isFieldDesignator()) {
13815 if (D.getFieldDecl()) {
13817 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13818 if (Field != D.getFieldDecl())
13821 ExprChanged =
true;
13822 if (
Field->isAnonymousStructOrUnion())
13828 ExprChanged =
true;
13831 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13835 if (D.isArrayDesignator()) {
13836 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13837 if (Index.isInvalid())
13840 Desig.AddDesignator(
13843 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13844 ArrayExprs.push_back(Index.get());
13848 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13850 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13851 if (Start.isInvalid())
13854 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13855 if (End.isInvalid())
13859 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13861 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13862 End.get() != E->getArrayRangeEnd(D);
13864 ArrayExprs.push_back(Start.get());
13865 ArrayExprs.push_back(End.get());
13868 if (!getDerived().AlwaysRebuild() &&
13869 Init.get() == E->getInit() &&
13873 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13874 E->getEqualOrColonLoc(),
13875 E->usesGNUSyntax(),
Init.get());
13880template<
typename Derived>
13884 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13889template<
typename Derived>
13893 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13897template<
typename Derived>
13900 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13904template<
typename Derived>
13907 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13911template<
typename Derived>
13919 QualType T = getDerived().TransformType(E->getType());
13923 if (!getDerived().AlwaysRebuild() &&
13927 return getDerived().RebuildImplicitValueInitExpr(
T);
13930template<
typename Derived>
13933 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
13937 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13938 if (SubExpr.isInvalid())
13941 if (!getDerived().AlwaysRebuild() &&
13942 TInfo == E->getWrittenTypeInfo() &&
13943 SubExpr.get() == E->getSubExpr())
13946 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
13947 TInfo, E->getRParenLoc());
13950template<
typename Derived>
13953 bool ArgumentChanged =
false;
13955 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
13959 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
13961 E->getRParenLoc());
13969template<
typename Derived>
13972 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
13977 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
13981template<
typename Derived>
13986 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
13987 if (SubStmt.isInvalid()) {
13992 unsigned OldDepth = E->getTemplateDepth();
13993 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13995 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13996 SubStmt.get() == E->getSubStmt()) {
14002 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14003 E->getRParenLoc(), NewDepth);
14006template<
typename Derived>
14010 if (
Cond.isInvalid())
14013 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14014 if (LHS.isInvalid())
14017 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14018 if (RHS.isInvalid())
14021 if (!getDerived().AlwaysRebuild() &&
14022 Cond.get() == E->getCond() &&
14023 LHS.get() == E->getLHS() &&
14024 RHS.get() == E->getRHS())
14027 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14028 Cond.get(), LHS.get(), RHS.get(),
14029 E->getRParenLoc());
14032template<
typename Derived>
14038template<
typename Derived>
14041 switch (E->getOperator()) {
14045 case OO_Array_Delete:
14046 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14051 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14064 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14065 FakeLParenLoc = EndLoc;
14069 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14073 if (E->getOperator() == OO_Subscript)
14074 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14075 Args, E->getEndLoc());
14077 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14081#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14085#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14086#include "clang/Basic/OperatorKinds.def"
14088 case OO_Conditional:
14089 llvm_unreachable(
"conditional operator is not actually overloadable");
14093 llvm_unreachable(
"not an overloaded operator?");
14097 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14098 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14100 First = getDerived().TransformExpr(E->getArg(0));
14101 if (
First.isInvalid())
14105 if (E->getNumArgs() == 2) {
14107 getDerived().TransformInitializer(E->getArg(1),
false);
14108 if (Second.isInvalid())
14114 getSema().CurFPFeatures =
14115 NewOverrides.applyOverrides(getSema().getLangOpts());
14116 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14120 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14122 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14125 return getDerived().RebuildCXXOperatorCallExpr(
14126 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14127 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14132 Callee = ICE->getSubExprAsWritten();
14134 ValueDecl *VD = cast_or_null<ValueDecl>(
14135 getDerived().TransformDecl(DR->getLocation(), DR));
14140 Functions.addDecl(VD);
14142 return getDerived().RebuildCXXOperatorCallExpr(
14143 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14144 false, Functions,
First.get(), Second.get());
14147template<
typename Derived>
14150 return getDerived().TransformCallExpr(E);
14153template <
typename Derived>
14156 getSema().CurContext != E->getParentContext();
14158 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14161 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14162 E->getBeginLoc(), E->getEndLoc(),
14163 getSema().CurContext);
14166template <
typename Derived>
14171template<
typename Derived>
14180 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14181 if (EC.isInvalid())
14185 bool ArgChanged =
false;
14187 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14191 if (!getDerived().AlwaysRebuild() &&
14192 Callee.get() == E->getCallee() &&
14198 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14199 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14201 E->getRParenLoc(), EC.get());
14204template<
typename Derived>
14220 return getDerived().RebuildCXXNamedCastExpr(
14227template<
typename Derived>
14236 if (Sub.isInvalid())
14239 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14243template<
typename Derived>
14245TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14246 return getDerived().TransformCXXNamedCastExpr(E);
14249template<
typename Derived>
14255template<
typename Derived>
14262template<
typename Derived>
14268template<
typename Derived>
14274template<
typename Derived>
14279 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14284 = getDerived().TransformExpr(E->getSubExprAsWritten());
14285 if (SubExpr.isInvalid())
14288 if (!getDerived().AlwaysRebuild() &&
14289 Type == E->getTypeInfoAsWritten() &&
14290 SubExpr.get() == E->getSubExpr())
14293 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14297 E->isListInitialization());
14300template<
typename Derived>
14303 if (E->isTypeOperand()) {
14305 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14309 if (!getDerived().AlwaysRebuild() &&
14310 TInfo == E->getTypeOperandSourceInfo())
14313 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14314 TInfo, E->getEndLoc());
14320 Expr *Op = E->getExprOperand();
14322 if (E->isGLValue())
14323 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14324 RD && RD->isPolymorphic())
14330 ExprResult SubExpr = getDerived().TransformExpr(Op);
14331 if (SubExpr.isInvalid())
14334 if (!getDerived().AlwaysRebuild() &&
14335 SubExpr.get() == E->getExprOperand())
14338 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14339 SubExpr.get(), E->getEndLoc());
14342template<
typename Derived>
14345 if (E->isTypeOperand()) {
14347 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14351 if (!getDerived().AlwaysRebuild() &&
14352 TInfo == E->getTypeOperandSourceInfo())
14355 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14356 TInfo, E->getEndLoc());
14362 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14363 if (SubExpr.isInvalid())
14366 if (!getDerived().AlwaysRebuild() &&
14367 SubExpr.get() == E->getExprOperand())
14370 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14371 SubExpr.get(), E->getEndLoc());
14374template<
typename Derived>
14380template<
typename Derived>
14387template<
typename Derived>
14403 auto &S = getSema();
14404 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14405 return S.getCurrentThisType();
14406 if (S.getCurLambda())
14407 return getDerived().TransformType(E->getType());
14408 return S.getCurrentThisType();
14411 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14412 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14415 getSema().MarkThisReferenced(E);
14419 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14422template<
typename Derived>
14425 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14426 if (SubExpr.isInvalid())
14429 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14431 if (!getDerived().AlwaysRebuild() &&
14432 SubExpr.get() == E->getSubExpr())
14435 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14436 E->isThrownVariableInScope());
14439template<
typename Derived>
14443 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14448 if (E->hasRewrittenInit()) {
14449 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14450 if (InitRes.isInvalid())
14454 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14455 E->getUsedContext() == SemaRef.
CurContext &&
14456 InitRes.get() == E->getRewrittenExpr())
14459 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14463template<
typename Derived>
14467 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14471 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14475 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14478template<
typename Derived>
14482 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14486 if (!getDerived().AlwaysRebuild() &&
14487 T == E->getTypeSourceInfo())
14490 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14491 T->getTypeLoc().getEndLoc(),
14492 E->getRParenLoc());
14495template<
typename Derived>
14500 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14501 if (!AllocTypeInfo)
14505 std::optional<Expr *> ArraySize;
14506 if (E->isArray()) {
14508 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14509 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14510 if (NewArraySize.isInvalid())
14513 ArraySize = NewArraySize.get();
14517 bool ArgumentChanged =
false;
14519 if (getDerived().TransformExprs(E->getPlacementArgs(),
14520 E->getNumPlacementArgs(),
true,
14521 PlacementArgs, &ArgumentChanged))
14525 Expr *OldInit = E->getInitializer();
14528 NewInit = getDerived().TransformInitializer(OldInit,
true);
14529 if (NewInit.isInvalid())
14534 if (E->getOperatorNew()) {
14535 OperatorNew = cast_or_null<FunctionDecl>(
14536 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14542 if (E->getOperatorDelete()) {
14543 OperatorDelete = cast_or_null<FunctionDecl>(
14544 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14545 if (!OperatorDelete)
14549 if (!getDerived().AlwaysRebuild() &&
14550 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14551 ArraySize == E->getArraySize() &&
14552 NewInit.get() == OldInit &&
14553 OperatorNew == E->getOperatorNew() &&
14554 OperatorDelete == E->getOperatorDelete() &&
14555 !ArgumentChanged) {
14560 if (OperatorDelete)
14563 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14575 QualType AllocType = AllocTypeInfo->getType();
14586 = dyn_cast<ConstantArrayType>(ArrayT)) {
14590 AllocType = ConsArrayT->getElementType();
14592 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14593 if (DepArrayT->getSizeExpr()) {
14594 ArraySize = DepArrayT->getSizeExpr();
14595 AllocType = DepArrayT->getElementType();
14600 return getDerived().RebuildCXXNewExpr(
14601 E->getBeginLoc(), E->isGlobalNew(),
14602 E->getBeginLoc(), PlacementArgs,
14603 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14604 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14607template<
typename Derived>
14616 if (E->getOperatorDelete()) {
14617 OperatorDelete = cast_or_null<FunctionDecl>(
14618 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14619 if (!OperatorDelete)
14623 if (!getDerived().AlwaysRebuild() &&
14624 Operand.get() == E->getArgument() &&
14625 OperatorDelete == E->getOperatorDelete()) {
14628 if (OperatorDelete)
14631 if (!E->getArgument()->isTypeDependent()) {
14633 E->getDestroyedType());
14634 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14642 return getDerived().RebuildCXXDeleteExpr(
14643 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14646template<
typename Derived>
14651 if (
Base.isInvalid())
14655 bool MayBePseudoDestructor =
false;
14657 E->getOperatorLoc(),
14658 E->isArrow()? tok::arrow : tok::period,
14660 MayBePseudoDestructor);
14661 if (
Base.isInvalid())
14664 QualType ObjectType = ObjectTypePtr.get();
14666 if (QualifierLoc) {
14668 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14673 SS.
Adopt(QualifierLoc);
14676 if (E->getDestroyedTypeInfo()) {
14677 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14678 E->getDestroyedTypeInfo(), ObjectType,
14680 if (!DestroyedTypeInfo)
14682 Destroyed = DestroyedTypeInfo;
14683 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14687 E->getDestroyedTypeLoc());
14691 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14692 nullptr, SS, ObjectTypePtr,
false);
14698 E->getDestroyedTypeLoc());
14702 if (E->getScopeTypeInfo()) {
14703 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14704 E->getScopeTypeInfo(), ObjectType,
nullptr);
14705 if (!ScopeTypeInfo)
14709 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14710 E->getOperatorLoc(),
14714 E->getColonColonLoc(),
14719template <
typename Derived>
14724 bool AllEmptyPacks =
true;
14725 for (
auto *OldD : Old->
decls()) {
14741 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14742 Decls = UPD->expansions();
14745 for (
auto *D : Decls) {
14746 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14747 for (
auto *SD : UD->shadows())
14754 AllEmptyPacks &= Decls.empty();
14763 if (AllEmptyPacks && !RequiresADL) {
14775 getSema().FilterAcceptableTemplateNames(R,
14782 diag::err_template_kw_refers_to_non_template)
14786 diag::note_template_kw_refers_to_non_template)
14795template <
typename Derived>
14801template <
typename Derived>
14804 bool IsAddressOfOperand) {
14809 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14816 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14820 SS.
Adopt(QualifierLoc);
14824 CXXRecordDecl *NamingClass
14825 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14828 if (!NamingClass) {
14833 R.setNamingClass(NamingClass);
14854 SS, TemplateKWLoc, R,
14861 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14864 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14868template<
typename Derived>
14871 bool ArgChanged =
false;
14873 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14875 TypeLoc FromTL = From->getTypeLoc();
14878 TLB.
reserve(FromTL.getFullDataSize());
14879 QualType To = getDerived().TransformType(TLB, FromTL);
14883 if (To == From->getType())
14884 Args.push_back(From);
14886 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14896 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14902 bool Expand =
true;
14903 bool RetainExpansion =
false;
14905 ExpansionTL.getTypePtr()->getNumExpansions();
14907 if (getDerived().TryExpandParameterPacks(
14908 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
14909 Unexpanded,
true, Expand,
14910 RetainExpansion, NumExpansions))
14920 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14922 QualType To = getDerived().TransformType(TLB, PatternTL);
14926 To = getDerived().RebuildPackExpansionType(To,
14927 PatternTL.getSourceRange(),
14928 ExpansionTL.getEllipsisLoc(),
14936 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14942 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14945 TLB.
reserve(PatternTL.getFullDataSize());
14946 QualType To = getDerived().TransformType(TLB, PatternTL);
14950 if (To->containsUnexpandedParameterPack()) {
14951 To = getDerived().RebuildPackExpansionType(To,
14952 PatternTL.getSourceRange(),
14953 ExpansionTL.getEllipsisLoc(),
14963 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14966 if (!RetainExpansion)
14971 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14974 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14976 QualType To = getDerived().TransformType(TLB, PatternTL);
14980 To = getDerived().RebuildPackExpansionType(To,
14981 PatternTL.getSourceRange(),
14982 ExpansionTL.getEllipsisLoc(),
14990 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14993 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14996 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15000template<
typename Derived>
15006 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15007 Old->NumTemplateArgs, TransArgs))
15010 return getDerived().RebuildConceptSpecializationExpr(
15011 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15012 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15016template<
typename Derived>
15030 getSema().Context, getSema().CurContext,
15031 E->getBody()->getBeginLoc());
15035 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15036 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15037 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15041 Param->setDeclContext(Body);
15047 if (!TypeParamResult.isUnset())
15048 return TypeParamResult;
15051 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15056 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15057 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15058 ER->getReturnTypeRequirement()
15059 .getTypeConstraintTemplateParameterList()->getParam(0)
15060 ->setDeclContext(Body);
15065 return getDerived().RebuildRequiresExpr(
15066 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15067 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15070template<
typename Derived>
15076 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15077 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15078 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15079 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15081 TransReq =
getDerived().TransformNestedRequirement(
15085 Transformed.push_back(TransReq);
15090template<
typename Derived>
15103 return getDerived().RebuildTypeRequirement(TransType);
15106template<
typename Derived>
15109 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15115 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15118 TransExpr = TransExprRes.
get();
15121 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15123 if (RetReq.isEmpty())
15124 TransRetReq.emplace();
15125 else if (RetReq.isSubstitutionFailure())
15126 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15127 else if (RetReq.isTypeConstraint()) {
15129 RetReq.getTypeConstraintTemplateParameterList();
15131 getDerived().TransformTemplateParameterList(OrigTPL);
15134 TransRetReq.emplace(TPL);
15136 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15137 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15140 std::move(*TransRetReq));
15146template<
typename Derived>
15152 return getDerived().RebuildNestedRequirement(
15160 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15163template<
typename Derived>
15170 if (!getDerived().AlwaysRebuild() &&
15187template<
typename Derived>
15194 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15195 if (SubExpr.isInvalid())
15198 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15202 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15203 SubExpr.get(), E->getEndLoc());
15206template <
typename Derived>
15211 DRE, AddrTaken, RecoveryTSI);
15224template <
typename Derived>
15231template <
typename Derived>
15247 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15252 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15258 return getDerived().RebuildDependentScopeDeclRefExpr(
15259 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15260 IsAddressOfOperand, RecoveryTSI);
15264 if (getDerived().TransformTemplateArguments(
15268 return getDerived().RebuildDependentScopeDeclRefExpr(
15269 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15273template<
typename Derived>
15279 if (getDerived().AllowSkippingCXXConstructExpr() &&
15280 ((E->getNumArgs() == 1 ||
15281 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15282 (!getDerived().DropCallArgument(E->getArg(0))) &&
15283 !E->isListInitialization()))
15289 QualType T = getDerived().TransformType(E->getType());
15294 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15298 bool ArgumentChanged =
false;
15303 E->isListInitialization());
15304 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15309 if (!getDerived().AlwaysRebuild() &&
15310 T == E->getType() &&
15312 !ArgumentChanged) {
15319 return getDerived().RebuildCXXConstructExpr(
15320 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15321 E->hadMultipleCandidates(), E->isListInitialization(),
15322 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15323 E->getConstructionKind(), E->getParenOrBraceRange());
15326template<
typename Derived>
15329 QualType T = getDerived().TransformType(E->getType());
15334 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15338 if (!getDerived().AlwaysRebuild() &&
15339 T == E->getType() &&
15347 return getDerived().RebuildCXXInheritedCtorInitExpr(
15349 E->constructsVBase(), E->inheritedFromVBase());
15356template<
typename Derived>
15359 if (
auto *Dtor = E->getTemporary()->getDestructor())
15362 return getDerived().TransformExpr(E->getSubExpr());
15370template<
typename Derived>
15376template<
typename Derived>
15381 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15386 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15390 bool ArgumentChanged =
false;
15392 Args.reserve(E->getNumArgs());
15396 E->isListInitialization());
15397 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15401 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15402 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15403 if (Res.isInvalid())
15405 Args = {Res.get()};
15409 if (!getDerived().AlwaysRebuild() &&
15410 T == E->getTypeSourceInfo() &&
15412 !ArgumentChanged) {
15419 return getDerived().RebuildCXXTemporaryObjectExpr(
15420 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15423template<
typename Derived>
15428 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15429 struct TransformedInitCapture {
15431 SourceLocation EllipsisLoc;
15433 SmallVector<InitCaptureInfoTy, 4> Expansions;
15436 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15438 CEnd = E->capture_end();
15440 if (!E->isInitCapture(
C))
15443 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15448 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15451 if (NewExprInitResult.isInvalid()) {
15455 Expr *NewExprInit = NewExprInitResult.get();
15458 getSema().buildLambdaInitCaptureInitialization(
15459 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15460 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15464 Result.Expansions.push_back(
15465 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15469 if (OldVD->isParameterPack()) {
15478 bool Expand =
true;
15479 bool RetainExpansion =
false;
15481 ExpansionTL.getTypePtr()->getNumExpansions();
15483 if (getDerived().TryExpandParameterPacks(
15484 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15485 Unexpanded,
true, Expand,
15486 RetainExpansion, NumExpansions))
15488 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15489 "capture since it cannot be extended");
15491 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15496 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15497 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15534 while (DC->isRequiresExprBody())
15536 if ((getSema().isUnevaluatedContext() ||
15537 getSema().isConstantEvaluatedContext()) &&
15538 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15543 E->getIntroducerRange(),
nullptr, DependencyKind,
15544 E->getCaptureDefault());
15545 getDerived().transformedLocalDecl(OldClass, {
Class});
15548 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15551 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15552 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15553 E->hasExplicitParameters(), E->isMutable());
15563 CEnd = E->capture_end();
15567 if (
C->isImplicit())
15571 if (
C->capturesThis()) {
15579 dyn_cast_if_present<CXXRecordDecl>(
15580 getSema().getFunctionLevelDeclContext()),
15582 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15589 if (
C->capturesVLAType())
15593 if (E->isInitCapture(
C)) {
15594 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15599 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15601 QualType InitQualType = Info.second;
15602 if (
Init.isInvalid() || InitQualType.isNull()) {
15606 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15607 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15608 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15609 getSema().CurContext);
15614 NewVDs.push_back(NewVD);
15615 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15620 if (NewC.EllipsisLoc.isInvalid())
15621 LSI->ContainsUnexpandedParameterPack |=
15622 Init.get()->containsUnexpandedParameterPack();
15628 getDerived().transformedLocalDecl(OldVD, NewVDs);
15632 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15640 if (
C->isPackExpansion()) {
15642 bool ShouldExpand =
false;
15643 bool RetainExpansion =
false;
15645 if (getDerived().TryExpandParameterPacks(
15646 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15647 true, ShouldExpand,
15648 RetainExpansion, NumExpansions)) {
15653 if (ShouldExpand) {
15658 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15660 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15661 getDerived().TransformDecl(
C->getLocation(), Pack));
15662 if (!CapturedVar) {
15668 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15676 EllipsisLoc =
C->getEllipsisLoc();
15680 auto *CapturedVar = cast_or_null<ValueDecl>(
15681 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15682 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15689 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15690 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15693 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15696 getSema().finishLambdaExplicitCaptures(LSI);
15700 auto TPL = getDerived().TransformTemplateParameterList(
15701 E->getTemplateParameterList());
15702 LSI->GLTemplateParameterList = TPL;
15704 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15706 LSI->ContainsUnexpandedParameterPack |=
15707 TPL->containsUnexpandedParameterPack();
15712 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15714 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15715 if (NewCallOpType.isNull())
15717 LSI->ContainsUnexpandedParameterPack |=
15718 NewCallOpType->containsUnexpandedParameterPack();
15720 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15725 assert(FPTL &&
"Not a FunctionProtoType?");
15728 if (!TRC.ArgPackSubstIndex)
15731 getSema().CompleteLambdaCallOperator(
15732 NewCallOperator, E->getCallOperator()->getLocation(),
15733 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15734 E->getCallOperator()->getConstexprKind(),
15735 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15736 E->hasExplicitResultType());
15738 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15739 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15745 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15746 if (getDerived().ReplacingOriginal()) {
15747 Numbering = OldClass->getLambdaNumbering();
15750 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15755 getSema().PushExpressionEvaluationContextForFunction(
15757 E->getCallOperator());
15761 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15762 getSema().pushCodeSynthesisContext(
C);
15766 Invalid ?
StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
15768 getSema().popCodeSynthesisContext();
15771 FuncScopeCleanup.disable();
15773 if (Body.isInvalid()) {
15774 SavedContext.pop();
15775 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15780 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15783 SavedContext.pop();
15818 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15819 Class->setLambdaDependencyKind(DependencyKind);
15821 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15822 Body.get()->getEndLoc(), LSI);
15825template<
typename Derived>
15831template<
typename Derived>
15840 if (!
C->isImplicit())
15844 if (
C->capturesThis()) {
15845 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15852 if (
C->capturesVLAType())
15855 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15859 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15865 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15871template<
typename Derived>
15880 bool ArgumentChanged =
false;
15892 if (!getDerived().AlwaysRebuild() &&
15898 return getDerived().RebuildCXXUnresolvedConstructExpr(
15902template<
typename Derived>
15911 if (!E->isImplicitAccess()) {
15912 OldBase = E->getBase();
15913 Base = getDerived().TransformExpr(OldBase);
15914 if (
Base.isInvalid())
15919 bool MayBePseudoDestructor =
false;
15921 E->getOperatorLoc(),
15922 E->isArrow()? tok::arrow : tok::period,
15924 MayBePseudoDestructor);
15925 if (
Base.isInvalid())
15928 ObjectType = ObjectTy.get();
15929 BaseType = ((
Expr*)
Base.get())->getType();
15932 BaseType = getDerived().TransformType(E->getBaseType());
15939 = getDerived().TransformFirstQualifierInScope(
15940 E->getFirstQualifierFoundInScope(),
15941 E->getQualifierLoc().getBeginLoc());
15944 if (E->getQualifier()) {
15946 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
15948 FirstQualifierInScope);
15960 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
15961 if (!NameInfo.getName())
15964 if (!E->hasExplicitTemplateArgs()) {
15967 if (!getDerived().AlwaysRebuild() &&
15968 Base.get() == OldBase &&
15969 BaseType == E->getBaseType() &&
15970 QualifierLoc == E->getQualifierLoc() &&
15971 NameInfo.getName() == E->getMember() &&
15972 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
15975 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15978 E->getOperatorLoc(),
15981 FirstQualifierInScope,
15987 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
15988 E->getNumTemplateArgs(),
15992 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15995 E->getOperatorLoc(),
15998 FirstQualifierInScope,
16003template <
typename Derived>
16009 if (!Old->isImplicitAccess()) {
16010 Base = getDerived().TransformExpr(Old->getBase());
16011 if (
Base.isInvalid())
16014 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16015 if (
Base.isInvalid())
16017 BaseType =
Base.get()->getType();
16019 BaseType = getDerived().TransformType(Old->getBaseType());
16023 if (Old->getQualifierLoc()) {
16025 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16035 if (TransformOverloadExprDecls(Old,
false, R))
16039 if (Old->getNamingClass()) {
16041 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16045 R.setNamingClass(NamingClass);
16049 if (Old->hasExplicitTemplateArgs()) {
16050 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16051 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16052 if (getDerived().TransformTemplateArguments(
16053 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16061 NamedDecl *FirstQualifierInScope =
nullptr;
16063 return getDerived().RebuildUnresolvedMemberExpr(
16064 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16065 TemplateKWLoc, FirstQualifierInScope, R,
16066 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16069template<
typename Derived>
16074 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16075 if (SubExpr.isInvalid())
16078 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16081 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16084template<
typename Derived>
16087 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16088 if (Pattern.isInvalid())
16091 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16094 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16095 E->getNumExpansions());
16098template <
typename Derived>
16103 if (!Arg.isPackExpansion()) {
16115 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16116 OrigNumExpansions);
16128 if (!NumExpansions) {
16140template<
typename Derived>
16159 bool ShouldExpand =
false;
16160 bool RetainExpansion =
false;
16161 UnsignedOrNone NumExpansions = std::nullopt;
16162 if (getDerived().TryExpandParameterPacks(
16164 true, ShouldExpand,
16165 RetainExpansion, NumExpansions))
16170 if (ShouldExpand) {
16172 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16173 ArgStorage = getSema().Context.getPackExpansionType(
16174 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16175 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16179 ExprResult DRE = getSema().BuildDeclRefExpr(
16180 VD, VD->getType().getNonLValueExprType(getSema().Context),
16183 if (DRE.isInvalid())
16186 new (getSema().Context)
16190 PackArgs = ArgStorage;
16195 if (!PackArgs.size()) {
16196 auto *Pack = cast_or_null<NamedDecl>(
16200 return getDerived().RebuildSizeOfPackExpr(
16207 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16219 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16222 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16223 PackLocIterator(*
this, PackArgs.end()),
16224 TransformedPackArgs,
true))
16231 bool PartialSubstitution =
false;
16232 for (
auto &Loc : TransformedPackArgs.arguments()) {
16233 Args.push_back(Loc.getArgument());
16234 if (Loc.getArgument().isPackExpansion())
16235 PartialSubstitution =
true;
16238 if (PartialSubstitution)
16239 return getDerived().RebuildSizeOfPackExpr(
16241 std::nullopt, Args);
16243 return getDerived().RebuildSizeOfPackExpr(
16245 static_cast<unsigned>(Args.size()),
16249template <
typename Derived>
16252 if (!E->isValueDependent())
16260 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16261 if (IndexExpr.isInvalid())
16266 bool FullySubstituted =
true;
16267 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16268 Expr *Pattern = E->getPackIdExpression();
16270 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16272 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16276 bool ShouldExpand =
true;
16277 bool RetainExpansion =
false;
16279 NumExpansions = std::nullopt;
16280 if (getDerived().TryExpandParameterPacks(
16281 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16282 true, ShouldExpand,
16283 RetainExpansion, NumExpansions))
16285 if (!ShouldExpand) {
16287 ExprResult Pack = getDerived().TransformExpr(Pattern);
16288 if (Pack.isInvalid())
16290 return getDerived().RebuildPackIndexingExpr(
16291 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16294 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16297 if (
Out.isInvalid())
16299 if (
Out.get()->containsUnexpandedParameterPack()) {
16300 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16301 OrigNumExpansions);
16302 if (
Out.isInvalid())
16304 FullySubstituted =
false;
16306 ExpandedExprs.push_back(
Out.get());
16310 if (RetainExpansion) {
16311 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16314 if (
Out.isInvalid())
16317 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16318 OrigNumExpansions);
16319 if (
Out.isInvalid())
16321 FullySubstituted =
false;
16322 ExpandedExprs.push_back(
Out.get());
16324 }
else if (!E->expandsToEmptyPack()) {
16325 if (getDerived().TransformExprs(E->getExpressions().data(),
16326 E->getExpressions().size(),
false,
16331 return getDerived().RebuildPackIndexingExpr(
16332 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16333 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16336template <
typename Derived>
16339 if (!getSema().ArgPackSubstIndex)
16346 E->getAssociatedDecl(), E->getParameterPack(),
16347 E->getParameterPackLocation(), Arg, SemaRef.
getPackIndex(Pack),
16351template <
typename Derived>
16355 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16356 if (Replacement.isInvalid())
16359 Decl *AssociatedDecl =
16360 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16361 if (!AssociatedDecl)
16364 if (Replacement.get() == OrigReplacement &&
16365 AssociatedDecl == E->getAssociatedDecl())
16373 ->asArray()[E->getIndex()]);
16374 if (
QualType ParamType = Param->getType();
16376 Replacement.get() != OrigReplacement) {
16384 Param, ParamType, Replacement.get(), SugaredConverted,
16385 CanonicalConverted,
16387 if (Replacement.isInvalid())
16391 Replacement = E->getReplacement();
16395 Replacement.get()->getType(), Replacement.get()->getValueKind(),
16396 E->getNameLoc(), Replacement.get(), AssociatedDecl, E->getIndex(),
16397 E->getPackIndex(), E->isReferenceParameter(), E->getFinal());
16400template<
typename Derived>
16407template<
typename Derived>
16414template<
typename Derived>
16418 if (
Expr *OldCallee = E->getCallee()) {
16419 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16420 if (CalleeResult.isInvalid())
16425 Expr *Pattern = E->getPattern();
16428 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16429 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16433 bool Expand =
true;
16434 bool RetainExpansion =
false;
16436 NumExpansions = OrigNumExpansions;
16437 if (getDerived().TryExpandParameterPacks(
16438 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16439 true, Expand, RetainExpansion,
16449 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16450 if (LHS.isInvalid())
16454 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16455 if (RHS.isInvalid())
16458 if (!getDerived().AlwaysRebuild() &&
16459 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16462 return getDerived().RebuildCXXFoldExpr(
16463 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16464 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16470 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16471 SemaRef.
Diag(E->getEllipsisLoc(),
16472 clang::diag::err_fold_expression_limit_exceeded)
16473 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16474 << E->getSourceRange();
16475 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16484 bool LeftFold = E->isLeftFold();
16488 if (!LeftFold && RetainExpansion) {
16489 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16492 if (
Out.isInvalid())
16495 Result = getDerived().RebuildCXXFoldExpr(
16496 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16497 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16502 bool WarnedOnComparison =
false;
16503 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16505 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16507 if (
Out.isInvalid())
16510 if (
Out.get()->containsUnexpandedParameterPack()) {
16512 Result = getDerived().RebuildCXXFoldExpr(
16513 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16514 E->getOperator(), E->getEllipsisLoc(),
16515 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16516 OrigNumExpansions);
16517 }
else if (
Result.isUsable()) {
16524 Result = getDerived().RebuildCXXOperatorCallExpr(
16526 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16527 Functions, LHS, RHS);
16529 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16530 E->getOperator(), LHS, RHS,
16532 if (!WarnedOnComparison &&
Result.isUsable()) {
16533 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16534 BO && BO->isComparisonOp()) {
16535 WarnedOnComparison =
true;
16536 SemaRef.
Diag(BO->getBeginLoc(),
16537 diag::warn_comparison_in_fold_expression)
16538 << BO->getOpcodeStr();
16551 if (LeftFold && RetainExpansion) {
16552 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16555 if (
Out.isInvalid())
16558 Result = getDerived().RebuildCXXFoldExpr(
16559 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16560 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16566 PE->setIsProducedByFoldExpansion();
16571 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16576template <
typename Derived>
16582 QualType T = getDerived().TransformType(E->getType());
16584 bool ArgChanged =
false;
16586 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16587 TransformedInits, &ArgChanged))
16590 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16593 return getDerived().RebuildCXXParenListInitExpr(
16594 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16595 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16598template<
typename Derived>
16605template<
typename Derived>
16611template<
typename Derived>
16617template<
typename Derived>
16620 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16621 if (SubExpr.isInvalid())
16624 if (!getDerived().AlwaysRebuild() &&
16625 SubExpr.get() == E->getSubExpr())
16628 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16631template<
typename Derived>
16636 bool ArgChanged =
false;
16637 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16638 false, Elements, &ArgChanged))
16641 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16644 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16649template<
typename Derived>
16655 bool ArgChanged =
false;
16656 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16659 if (OrigElement.isPackExpansion()) {
16662 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16663 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16664 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16668 bool Expand =
true;
16669 bool RetainExpansion =
false;
16672 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16673 OrigElement.Value->getEndLoc());
16674 if (getDerived().TryExpandParameterPacks(
16675 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16676 true, Expand, RetainExpansion,
16685 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16686 if (Key.isInvalid())
16689 if (Key.get() != OrigElement.Key)
16693 if (
Value.isInvalid())
16700 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16702 Elements.push_back(Expansion);
16712 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16714 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16715 if (Key.isInvalid())
16719 if (
Value.isInvalid())
16729 if (Key.get()->containsUnexpandedParameterPack() ||
16730 Value.get()->containsUnexpandedParameterPack())
16731 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16733 Elements.push_back(Element);
16743 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16744 if (Key.isInvalid())
16747 if (Key.get() != OrigElement.Key)
16752 = getDerived().TransformExpr(OrigElement.Value);
16753 if (
Value.isInvalid())
16761 Elements.push_back(Element);
16764 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16767 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16771template<
typename Derived>
16775 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16776 if (!EncodedTypeInfo)
16779 if (!getDerived().AlwaysRebuild() &&
16780 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16783 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16785 E->getRParenLoc());
16788template<
typename Derived>
16798template<
typename Derived>
16802 = getDerived().TransformType(E->getTypeInfoAsWritten());
16810 if (!getDerived().AlwaysRebuild() &&
16811 TSInfo == E->getTypeInfoAsWritten() &&
16812 Result.get() == E->getSubExpr())
16816 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16820template <
typename Derived>
16826template<
typename Derived>
16830 bool ArgChanged =
false;
16832 Args.reserve(E->getNumArgs());
16833 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16840 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16841 if (!ReceiverTypeInfo)
16845 if (!getDerived().AlwaysRebuild() &&
16846 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16851 E->getSelectorLocs(SelLocs);
16852 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16855 E->getMethodDecl(),
16862 if (!E->getMethodDecl())
16867 E->getSelectorLocs(SelLocs);
16868 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16871 E->getReceiverType(),
16872 E->getMethodDecl(),
16880 "Only class and instance messages may be instantiated");
16882 = getDerived().TransformExpr(E->getInstanceReceiver());
16883 if (Receiver.isInvalid())
16887 if (!getDerived().AlwaysRebuild() &&
16888 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
16893 E->getSelectorLocs(SelLocs);
16894 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16897 E->getMethodDecl(),
16903template<
typename Derived>
16909template<
typename Derived>
16915template<
typename Derived>
16920 if (
Base.isInvalid())
16926 if (!getDerived().AlwaysRebuild() &&
16927 Base.get() == E->getBase())
16930 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
16932 E->isArrow(), E->isFreeIvar());
16935template<
typename Derived>
16940 if (!E->isObjectReceiver())
16945 if (
Base.isInvalid())
16951 if (!getDerived().AlwaysRebuild() &&
16952 Base.get() == E->getBase())
16955 if (E->isExplicitProperty())
16956 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16957 E->getExplicitProperty(),
16960 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16962 E->getImplicitPropertyGetter(),
16963 E->getImplicitPropertySetter(),
16967template<
typename Derived>
16972 if (
Base.isInvalid())
16976 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
16977 if (Key.isInvalid())
16981 if (!getDerived().AlwaysRebuild() &&
16982 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
16985 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
16986 Base.get(), Key.get(),
16987 E->getAtIndexMethodDecl(),
16988 E->setAtIndexMethodDecl());
16991template<
typename Derived>
16996 if (
Base.isInvalid())
17000 if (!getDerived().AlwaysRebuild() &&
17001 Base.get() == E->getBase())
17004 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17009template<
typename Derived>
17012 bool ArgumentChanged =
false;
17014 SubExprs.reserve(E->getNumSubExprs());
17015 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17016 SubExprs, &ArgumentChanged))
17019 if (!getDerived().AlwaysRebuild() &&
17023 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17025 E->getRParenLoc());
17028template<
typename Derived>
17031 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17032 if (SrcExpr.isInvalid())
17039 if (!getDerived().AlwaysRebuild() &&
17040 Type == E->getTypeSourceInfo() &&
17041 SrcExpr.get() == E->getSrcExpr())
17044 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17045 SrcExpr.get(),
Type,
17046 E->getRParenLoc());
17049template<
typename Derived>
17052 BlockDecl *oldBlock = E->getBlockDecl();
17058 blockScope->TheDecl->setBlockMissingReturnType(
17059 oldBlock->blockMissingReturnType());
17068 if (getDerived().TransformFunctionTypeParams(
17069 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17070 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17072 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17077 getDerived().TransformType(exprFunctionType->getReturnType());
17079 auto epi = exprFunctionType->getExtProtoInfo();
17080 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17083 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17087 if (!params.empty())
17088 blockScope->TheDecl->setParams(params);
17090 if (!oldBlock->blockMissingReturnType()) {
17091 blockScope->HasImplicitReturnType =
false;
17092 blockScope->ReturnType = exprResultType;
17096 StmtResult body = getDerived().TransformStmt(E->getBody());
17097 if (body.isInvalid()) {
17098 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17106 for (
const auto &I : oldBlock->captures()) {
17107 VarDecl *oldCapture = I.getVariable();
17110 if (oldCapture->isParameterPack())
17114 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17116 assert(blockScope->CaptureMap.count(newCapture));
17122 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17123 "this pointer isn't captured in the old block");
17131template<
typename Derived>
17134 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17135 if (SrcExpr.isInvalid())
17138 QualType Type = getDerived().TransformType(E->getType());
17141 E->getRParenLoc());
17144template<
typename Derived>
17147 bool ArgumentChanged =
false;
17149 SubExprs.reserve(E->getNumSubExprs());
17150 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17151 SubExprs, &ArgumentChanged))
17154 if (!getDerived().AlwaysRebuild() &&
17158 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17159 E->getOp(), E->getRParenLoc());
17166template<
typename Derived>
17169 return SemaRef.BuildPointerType(PointeeType,
Star,
17173template<
typename Derived>
17176 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17180template<
typename Derived>
17183 bool WrittenAsLValue,
17185 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17189template <
typename Derived>
17193 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17197template<
typename Derived>
17204 return SemaRef.ObjC().BuildObjCTypeParamType(
17205 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17209template<
typename Derived>
17220 return SemaRef.ObjC().BuildObjCObjectType(
17221 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17222 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17227template<
typename Derived>
17231 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17234template <
typename Derived>
17237 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17238 if (SizeExpr || !Size)
17239 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17240 IndexTypeQuals, BracketsRange,
17244 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17246 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17249 for (
const auto &
T : Types)
17250 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17260 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17261 IndexTypeQuals, BracketsRange,
17265template <
typename Derived>
17268 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17269 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17270 IndexTypeQuals, BracketsRange);
17273template <
typename Derived>
17277 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17278 IndexTypeQuals, BracketsRange);
17281template <
typename Derived>
17284 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17285 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17287 IndexTypeQuals, BracketsRange);
17290template <
typename Derived>
17293 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17294 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17296 IndexTypeQuals, BracketsRange);
17299template <
typename Derived>
17302 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17306template <
typename Derived>
17308 unsigned NumElements,
17311 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17314template <
typename Derived>
17318 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17321template<
typename Derived>
17323 unsigned NumElements,
17325 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17326 NumElements,
true);
17330 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17333template<
typename Derived>
17338 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17341template <
typename Derived>
17343 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17344 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17348template <
typename Derived>
17352 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17356template <
typename Derived>
17360 return SemaRef.BuildFunctionType(
T, ParamTypes,
17366template<
typename Derived>
17368 return SemaRef.Context.getFunctionNoProtoType(
T);
17371template <
typename Derived>
17375 assert(D &&
"no decl found");
17379 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17383 if (UPD->expansions().empty()) {
17384 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17385 << UPD->isCXXClassMember() << UPD;
17394 for (
auto *E : UPD->expansions()) {
17401 else if (
T.isNull())
17404 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17405 "mismatched resolved types in using pack expansion");
17407 return T.isNull() ? FallbackT :
T;
17409 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17410 assert(Using->hasTypename() &&
17411 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17414 assert(++Using->shadow_begin() == Using->shadow_end());
17419 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17422 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17423 return SemaRef.Context.getUnresolvedUsingType(
17427template <
typename Derived>
17430 return SemaRef.BuildTypeofExprType(E, Kind);
17433template<
typename Derived>
17436 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17439template <
typename Derived>
17441 return SemaRef.BuildDecltypeType(E);
17444template <
typename Derived>
17449 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17450 FullySubstituted, Expansions);
17453template<
typename Derived>
17455 UnaryTransformType::UTTKind UKind,
17457 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17460template <
typename Derived>
17464 return SemaRef.CheckTemplateIdType(
17469template<
typename Derived>
17472 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17475template<
typename Derived>
17479 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17480 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17483template <
typename Derived>
17487 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17491 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17494template <
typename Derived>
17497 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17500template <
typename Derived>
17508template <
typename Derived>
17515 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17518 AllowInjectedClassName);
17522template<
typename Derived>
17529 bool AllowInjectedClassName) {
17532 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17537 false,
Template, AllowInjectedClassName);
17541template <
typename Derived>
17546 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17551 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17552 Opc,
First, Second);
17567 if (Op == OO_Subscript) {
17568 if (!
First->getType()->isOverloadableType() &&
17570 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17572 }
else if (Op == OO_Arrow) {
17575 if (
First->getType()->isDependentType())
17578 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17579 }
else if (Second ==
nullptr || isPostIncDec) {
17580 if (!
First->getType()->isOverloadableType() ||
17581 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17588 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17592 !
First->getType()->isOverloadableType() &&
17598 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17607 if (!Second || isPostIncDec) {
17610 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17617 First, Second, RequiresADL);
17624template<
typename Derived>
17634 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17640 ->getAsCanonical<RecordType>())) {
17642 return SemaRef.BuildPseudoDestructorExpr(
17643 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17644 CCLoc, TildeLoc, Destroyed);
17656 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17657 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17658 diag::err_expected_class_or_namespace)
17659 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17663 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17667 return getSema().BuildMemberReferenceExpr(
17668 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17674template<
typename Derived>
17682 for (
unsigned I = 0; I < NumParams; ++I) {
17683 if (I != ContextParamPos) {
17689 Params.push_back(std::make_pair(StringRef(), QualType()));
17692 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17700 if (Body.isInvalid()) {
17701 getSema().ActOnCapturedRegionError();
17705 return getSema().ActOnCapturedRegionEnd(Body.get());
17708template <
typename Derived>
17714 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17718template <
typename Derived>
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::Record Record
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for expressions involving.
This file declares semantic analysis for SYCL constructs.
static bool PreparePackForExpansion(Sema &S, const CXXBaseSpecifier &Base, const MultiLevelTemplateArgumentList &TemplateArgs, TypeSourceInfo *&Out, UnexpandedInfo &Info)
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
static QualType getPointeeType(const MemRegion *R)
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
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.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
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
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
attr::Kind getKind() const
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
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.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
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 new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
unsigned getLambdaDependencyKind() const
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
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 '::'.
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
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...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
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.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
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.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
SourceLocation getBeginLoc() const LLVM_READONLY
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
SourceLocation getLBracLoc() const
bool hasStoredFPFeatures() const
Stmt * getStmtExprResult()
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
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.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
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.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
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 an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
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
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
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.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() 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...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
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.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
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.
LabelStmt - Represents a label, which has a substatement.
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.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end 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.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() 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.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents clauses with a list of expressions that are mappable.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Wrapper for source info for ObjC interfaces.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
@ 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.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
@ 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.
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 ...
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult ActOnConstantExpression(ExprResult Res)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt={})
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
VarDecl * buildCoroutinePromise(SourceLocation Loc)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
ExprResult BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, const NonTypeTemplateParmDecl *NTTP, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool FullySubstituted=false)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, UnsignedOrNone NumExpansions)
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 *.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
TemplateArgument getPackSubstitutedTemplateArgument(TemplateArgument Arg) const
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
bool buildCoroutineParameterMoves(SourceLocation Loc)
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
UnsignedOrNone getPackIndex(TemplateArgument Pack) const
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult 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...
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
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 ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
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 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.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
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)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
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
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
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.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
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.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
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.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
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.
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.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
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.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
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 isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
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.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
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.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
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
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ 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.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ 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.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
MutableArrayRef< Expr * > MultiExprArg
@ 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.
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
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)
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
@ 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.
TemplateParameterList * getReplacedTemplateParameterList(const Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
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.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
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)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
UnsignedOrNone ArgPackSubstIndex
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
Data for list of allocators.
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
An RAII helper that pops function a function scope on exit.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions