13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
50#include "llvm/ADT/ArrayRef.h"
51#include "llvm/Support/ErrorHandling.h"
55using namespace llvm::omp;
122template<
typename Derived>
127 class ForgetPartiallySubstitutedPackRAII {
135 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
136 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
137 Old =
Self.ForgetPartiallySubstitutedPack();
140 ~ForgetPartiallySubstitutedPackRAII() {
141 Self.RememberPartiallySubstitutedPack(Old);
143 ForgetPartiallySubstitutedPackRAII(
144 const ForgetPartiallySubstitutedPackRAII &) =
delete;
145 ForgetPartiallySubstitutedPackRAII &
146 operator=(
const ForgetPartiallySubstitutedPackRAII &) =
delete;
162 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
166 return static_cast<const Derived&
>(*this);
234 if (Location.isValid())
235 Self.getDerived().setBase(Location, Entity);
239 Self.getDerived().setBase(OldLocation, OldEntity);
314 bool FailOnPackProducingTemplates,
315 bool &ShouldExpand,
bool &RetainExpansion,
317 ShouldExpand =
false;
345 struct ForgetSubstitutionRAII {
351 Old =
Self.ForgetSubstitution();
354 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
454 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
455#include "clang/Basic/AttrList.inc"
465 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
466 const X##Attr *A) { \
467 return getDerived().Transform##X##Attr(A); \
469#include "clang/Basic/AttrList.inc"
515 bool *ArgChanged =
nullptr);
524 llvm::DenseMap<Decl *, Decl *>::iterator Known
527 return Known->second;
555 assert(
New.size() == 1 &&
556 "must override transformedLocalDecl if performing pack expansion");
594 NamedDecl *FirstQualifierInScope =
nullptr);
639 NamedDecl *FirstQualifierInScope =
nullptr,
640 bool AllowInjectedClassName =
false);
652 bool Uneval =
false);
679 bool Uneval =
false) {
698 template<
typename InputIterator>
702 bool Uneval =
false);
704 template <
typename InputIterator>
708 bool Uneval =
false);
729 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
733#define ABSTRACT_TYPELOC(CLASS, PARENT)
734#define TYPELOC(CLASS, PARENT) \
735 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
736#include "clang/AST/TypeLocNodes.def"
740 bool SuppressObjCLifetime);
744 bool SuppressObjCLifetime);
746 template<
typename Fn>
764 bool AllowInjectedClassName);
792 return getDerived().TransformFunctionTypeParams(
793 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
811 KWLoc, Params,
nullptr,
812 nullptr, PTypes, &TransParams, PInfos))
826 bool ExpectParameterPack);
855 bool IsAddressOfOperand,
863 bool IsAddressOfOperand);
871#define STMT(Node, Parent) \
872 LLVM_ATTRIBUTE_NOINLINE \
873 StmtResult Transform##Node(Node *S);
874#define VALUESTMT(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
877#define EXPR(Node, Parent) \
878 LLVM_ATTRIBUTE_NOINLINE \
879 ExprResult Transform##Node(Node *E);
880#define ABSTRACT_STMT(Stmt)
881#include "clang/AST/StmtNodes.inc"
883#define GEN_CLANG_CLAUSE_CLASS
884#define CLAUSE_CLASS(Enum, Str, Class) \
885 LLVM_ATTRIBUTE_NOINLINE \
886 OMPClause *Transform##Class(Class *S);
887#include "llvm/Frontend/OpenMP/OMP.inc"
965 const llvm::APInt *Size,
Expr *SizeExpr,
966 unsigned IndexTypeQuals,
SourceRange BracketsRange);
975 const llvm::APInt &Size,
Expr *SizeExpr,
976 unsigned IndexTypeQuals,
986 unsigned IndexTypeQuals,
996 unsigned IndexTypeQuals,
1007 unsigned IndexTypeQuals,
1045 unsigned NumColumns);
1062 Expr *AddrSpaceExpr,
1086 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1099 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1109 return SemaRef.Context.getCanonicalTagType(Tag);
1126 UnaryTransformType::UTTKind UKind,
1138 bool FullySubstituted,
1148 return SemaRef.Context.getAutoType(
1149 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1157 return SemaRef.Context.getDeducedTemplateSpecializationType(
1176 return SemaRef.BuildParenType(InnerType);
1189 bool DeducedTSTContext) {
1191 SS.
Adopt(QualifierLoc);
1195 if (!
SemaRef.computeDeclContext(SS))
1203 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1204 *Id, IdLoc, DeducedTSTContext);
1217 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1222 switch (
Result.getResultKind()) {
1233 llvm_unreachable(
"Tag lookup cannot find non-tags");
1245 switch (
Result.getResultKind()) {
1251 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1252 << SomeDecl << NTK << Kind;
1257 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1263 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1265 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1266 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1322 bool AllowInjectedClassName);
1335 bool AllowInjectedClassName);
1341 bool AllowInjectedClassName);
1351 Decl *AssociatedDecl,
unsigned Index,
1354 ArgPack, AssociatedDecl, Index, Final);
1408 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1418 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1420 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1432 Then, ElseLoc, Else);
1486 Inc, RParenLoc, Body);
1531 bool IsVolatile,
unsigned NumOutputs,
1538 NumInputs, Names, Constraints, Exprs,
1539 AsmString, Clobbers, NumLabels, RParenLoc);
1548 StringRef AsmString,
1549 unsigned NumOutputs,
unsigned NumInputs,
1555 NumOutputs, NumInputs,
1556 Constraints, Clobbers, Exprs, EndLoc);
1585 CoawaitLoc, Operand, OpCoawaitLookup);
1589 Suspend.
get(),
true);
1690 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1702 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1716 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1742 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1779 std::optional<unsigned> FillIdx,
1781 unsigned FillCount = FillIdx ? 1 : 0;
1783 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1814 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1850 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1863 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1870 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1883 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1945 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1973 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1974 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1975 UnresolvedReductions);
1989 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1990 ReductionId, UnresolvedReductions);
2005 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2006 ReductionId, UnresolvedReductions);
2019 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2020 StepModifierLoc, EndLoc);
2033 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2093 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2106 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2121 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2122 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2123 ColonLoc, VarList, Locs,
2124 false, UnresolvedMappers);
2141 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2142 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2156 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2157 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2169 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2194 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2207 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2242 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2257 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2258 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2274 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2275 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2288 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2330 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2377 StartLoc, LParenLoc, EndLoc,
Data);
2390 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2402 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2415 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2426 LParenLoc, VarLoc, EndLoc);
2438 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2509 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2590 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2638 ForLoc, Element, Collection, RParenLoc);
2656 StartLoc, IdLoc, Id);
2693 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2694 if (RangeStmt->isSingleDecl()) {
2695 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2696 if (RangeVar->isInvalidDecl())
2699 Expr *RangeExpr = RangeVar->getInit();
2706 diag::err_objc_for_range_init_stmt)
2707 <<
Init->getSourceRange();
2710 ForLoc, LoopVar, RangeExpr, RParenLoc);
2717 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2731 QualifierLoc, NameInfo, Nested);
2793 SS.
Adopt(QualifierLoc);
2847 UnaryExprOrTypeTrait ExprKind,
2858 UnaryExprOrTypeTrait ExprKind,
2913 if (IsOMPArraySection)
2915 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2916 Stride, RBracketLoc);
2918 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2919 "Stride/second colon not allowed for OpenACC");
2922 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2934 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2946 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2956 Expr *ExecConfig =
nullptr) {
2958 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2965 nullptr, Callee, LParenLoc, Args, RParenLoc);
2983 if (!
Member->getDeclName()) {
2987 assert(
Member->getType()->isRecordType() &&
2988 "unnamed member not of record type?");
3001 if (!isArrow &&
Base->isPRValue()) {
3016 SS.
Adopt(QualifierLoc);
3019 if (
Base->containsErrors())
3024 if (isArrow && !BaseType->isPointerType())
3030 R.addDecl(FoundDecl);
3033 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3038 ->getAsCXXRecordDecl()) {
3042 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3050 FirstQualifierInScope,
3051 R, ExplicitTemplateArgs,
3061 bool ForFoldExpression =
false) {
3139 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3152 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3192 unsigned NumUserSpecifiedExprs,
3197 InitLoc, LParenLoc, RParenLoc);
3227 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3239 Expr *ControllingExpr,
3244 ControllingExpr, Types, Exprs);
3259 ControllingType, Types, Exprs);
3292 case Stmt::CXXStaticCastExprClass:
3293 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3294 RAngleLoc, LParenLoc,
3295 SubExpr, RParenLoc);
3297 case Stmt::CXXDynamicCastExprClass:
3298 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3299 RAngleLoc, LParenLoc,
3300 SubExpr, RParenLoc);
3302 case Stmt::CXXReinterpretCastExprClass:
3303 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3304 RAngleLoc, LParenLoc,
3308 case Stmt::CXXConstCastExprClass:
3309 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3310 RAngleLoc, LParenLoc,
3311 SubExpr, RParenLoc);
3313 case Stmt::CXXAddrspaceCastExprClass:
3314 return getDerived().RebuildCXXAddrspaceCastExpr(
3315 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3318 llvm_unreachable(
"Invalid C++ named cast");
3396 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3408 bool ListInitialization) {
3412 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3414 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3415 RParenLoc, ListInitialization);
3417 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3419 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3420 ListInitialization);
3424 ListInitialization);
3488 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3498 bool IsThrownVariableInScope) {
3508 Expr *RewrittenExpr) {
3510 RewrittenExpr,
getSema().CurContext);
3544 std::optional<Expr *> ArraySize,
3563 bool IsGlobalDelete,
3614 bool IsAddressOfOperand,
3617 SS.
Adopt(QualifierLoc);
3619 if (TemplateArgs || TemplateKWLoc.
isValid())
3621 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3624 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3646 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3647 bool ListInitialization,
bool StdInitListInitialization,
3654 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3657 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3664 HadMultipleCandidates,
3666 StdInitListInitialization,
3667 RequiresZeroInit, ConstructKind,
3675 bool ConstructsVBase,
3676 bool InheritedFromVBase) {
3678 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3689 bool ListInitialization) {
3691 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3702 bool ListInitialization) {
3704 RParenLoc, ListInitialization);
3721 SS.
Adopt(QualifierLoc);
3723 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3724 OperatorLoc, IsArrow,
3726 FirstQualifierInScope,
3728 TemplateArgs,
nullptr);
3744 SS.
Adopt(QualifierLoc);
3746 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3747 OperatorLoc, IsArrow,
3749 FirstQualifierInScope,
3750 R, TemplateArgs,
nullptr);
3758 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3771 RParenLoc, Length, PartialArgs);
3776 Expr *PackIdExpression,
Expr *IndexExpr,
3778 bool FullySubstituted =
false) {
3780 IndexExpr, RSquareLoc, ExpandedExprs,
3806 NamedConcept, TALI);
3824 LocalParameters, RParenLoc, Requirements,
3831 return SemaRef.BuildTypeRequirement(SubstDiag);
3835 return SemaRef.BuildTypeRequirement(
T);
3843 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3850 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3857 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3862 return SemaRef.BuildNestedRequirement(Constraint);
3878 Expr **Elements,
unsigned NumElements) {
3888 RB,
Base, Key, getterMethod, setterMethod);
3907 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3919 return SemaRef.ObjC().BuildClassMessage(
3920 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3933 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3936 SelectorLocs, RBracLoc, Args);
3948 return Method->isInstanceMethod()
3949 ?
SemaRef.ObjC().BuildInstanceMessage(
3950 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3951 SelectorLocs, RBracLoc, Args)
3952 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3954 SelectorLocs, RBracLoc, Args);
3963 bool IsArrow,
bool IsFreeIvar) {
3972 if (IsFreeIvar &&
Result.isUsable())
4009 PropertyLoc,
Base));
4038 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4041 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4049 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4050 CK_BuiltinFnToFnPtr).get();
4066 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4081 EllipsisLoc, NumExpansions);
4105 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4141 EllipsisLoc, RHS, RParenLoc,
4150 Init->containsUnexpandedParameterPack();
4151 else if (PVD->hasUninstantiatedDefaultArg())
4153 PVD->getUninstantiatedDefaultArg()
4154 ->containsUnexpandedParameterPack();
4308 Exprs.push_back(DevNumExpr);
4309 llvm::append_range(Exprs, QueueIdExprs);
4346 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4370 ObjectType, FirstQualifierInScope);
4376 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4377 DependentNameTypeLoc TL,
4378 bool DeducibleTSTContext,
4379 QualType ObjectType = QualType(),
4380 NamedDecl *UnqualLookup =
nullptr);
4383 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4388 OpenACCDirectiveKind DirKind,
4389 const OpenACCClause *OldClause);
4392template <
typename Derived>
4402#define STMT(Node, Parent) \
4403 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4404#define VALUESTMT(Node, Parent) \
4405 case Stmt::Node##Class: \
4406 return getDerived().Transform##Node(cast<Node>(S), SDK);
4407#define ABSTRACT_STMT(Node)
4408#define EXPR(Node, Parent)
4409#include "clang/AST/StmtNodes.inc"
4412#define STMT(Node, Parent)
4413#define ABSTRACT_STMT(Stmt)
4414#define EXPR(Node, Parent) case Stmt::Node##Class:
4415#include "clang/AST/StmtNodes.inc"
4420 E =
getSema().ActOnStmtExprResult(E);
4428template<
typename Derived>
4436#define GEN_CLANG_CLAUSE_CLASS
4437#define CLAUSE_CLASS(Enum, Str, Class) \
4439 return getDerived().Transform##Class(cast<Class>(S));
4440#include "llvm/Frontend/OpenMP/OMP.inc"
4447template<
typename Derived>
4454#define STMT(Node, Parent) case Stmt::Node##Class: break;
4455#define ABSTRACT_STMT(Stmt)
4456#define EXPR(Node, Parent) \
4457 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4458#include "clang/AST/StmtNodes.inc"
4464template<
typename Derived>
4472 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4473 Init = FE->getSubExpr();
4475 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4481 Init = MTE->getSubExpr();
4484 Init = Binder->getSubExpr();
4487 Init = ICE->getSubExprAsWritten();
4490 dyn_cast<CXXStdInitializerListExpr>(
Init))
4527 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4528 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4529 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4530 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4532 bool ArgChanged =
false;
4534 true, NewArgs, &ArgChanged))
4545 if (
Parens.isInvalid()) {
4548 assert(NewArgs.empty() &&
4549 "no parens or braces but have direct init with arguments?");
4556template<
typename Derived>
4562 for (
unsigned I = 0; I != NumInputs; ++I) {
4572 Expr *Pattern = Expansion->getPattern();
4575 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4576 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4581 bool RetainExpansion =
false;
4582 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4586 Unexpanded,
true, Expand,
4587 RetainExpansion, NumExpansions))
4600 Expansion->getEllipsisLoc(),
4602 if (Out.isInvalid())
4607 Outputs.push_back(Out.get());
4613 if (ArgChanged) *ArgChanged =
true;
4617 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4620 if (Out.isInvalid())
4623 if (Out.get()->containsUnexpandedParameterPack()) {
4625 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4626 if (Out.isInvalid())
4630 Outputs.push_back(Out.get());
4635 if (RetainExpansion) {
4636 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4639 if (Out.isInvalid())
4643 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4644 if (Out.isInvalid())
4647 Outputs.push_back(Out.get());
4654 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4659 if (
Result.get() != Inputs[I] && ArgChanged)
4662 Outputs.push_back(
Result.get());
4668template <
typename Derived>
4679 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4685 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4694 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4701template <
typename Derived>
4709 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4721 llvm_unreachable(
"unexpected null nested name specifier");
4752 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4753 QualifierLoc, ObjectType, FirstQualifierInScope);
4757 FirstQualifierInScope =
nullptr;
4759 SS.
Adopt(QualifierLoc);
4763 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4765 FirstQualifierInScope,
false))
4773 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4774 FirstQualifierInScope);
4780 if (
T->isDependentType() ||
T->isRecordType() ||
4781 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4782 if (
T->isEnumeralType())
4784 diag::warn_cxx98_compat_enum_nested_name_spec);
4791 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4815template<
typename Derived>
4835 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4842 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4852 NewTInfo =
getDerived().TransformType(OldTInfo);
4855 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4863 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4876 llvm_unreachable(
"Unknown name kind.");
4879template <
typename Derived>
4883 QualType ObjectType,
bool AllowInjectedClassName) {
4885 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4886 ObjectType, AllowInjectedClassName);
4888 NameLoc, ObjectType,
4889 AllowInjectedClassName);
4892template <
typename Derived>
4896 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4898 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4901 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4902 QualifierLoc, ObjectType, FirstQualifierInScope);
4909 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4910 FirstQualifierInScope, AllowInjectedClassName);
4911 if (NewUnderlyingName.
isNull())
4913 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4917 NewUnderlyingName == UnderlyingName)
4920 SS.
Adopt(QualifierLoc);
4921 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4927 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4928 QualifierLoc, ObjectType, FirstQualifierInScope);
4942 SS.
Adopt(QualifierLoc);
4943 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4944 NameLoc, ObjectType,
4945 AllowInjectedClassName);
4950 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4957 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4961 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4962 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4965 Decl *AssociatedDecl =
4966 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4968 AssociatedDecl == S->getAssociatedDecl())
4970 return SemaRef.Context.getSubstTemplateTemplateParm(
4971 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4976 "DeducedTemplateName should not escape partial ordering");
4980 assert(!QualifierLoc &&
"Unexpected qualifier");
4987 assert(!QualifierLoc &&
4988 "Unexpected qualified SubstTemplateTemplateParmPack");
4990 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4991 SubstPack->getIndex(), SubstPack->getFinal());
4995 llvm_unreachable(
"overloaded function decl survived to here");
4998template <
typename Derived>
5003 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5009template<
typename Derived>
5013 Output =
getSema().getTrivialTemplateArgumentLoc(
5017template <
typename Derived>
5025 llvm_unreachable(
"Unexpected TemplateArgument");
5048 if (NewT ==
T && D == NewD)
5065 llvm_unreachable(
"unexpected template argument kind");
5097 llvm_unreachable(
"Caller should expand pack expansions");
5113 E =
SemaRef.ActOnConstantExpression(E);
5128template<
typename Derived,
typename InputIterator>
5136 typedef typename std::iterator_traits<InputIterator>::difference_type
5151 : Self(Self), Iter(Iter) { }
5166 Self.InventTemplateArgumentLoc(*Iter,
Result);
5174 return X.Iter == Y.Iter;
5179 return X.Iter != Y.Iter;
5183template<
typename Derived>
5184template<
typename InputIterator>
5204 PackLocIterator(*
this, In.getArgument().pack_begin()),
5205 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5212 if (In.getArgument().isPackExpansion()) {
5224 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5234 if (Out.getArgument().containsUnexpandedParameterPack()) {
5237 if (Out.getArgument().isNull())
5247 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5255 if (Out.getArgument().isNull())
5274template <
typename Derived>
5275template <
typename InputIterator>
5284 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5296 PackLocIterator(*
this, In.getArgument().pack_begin()),
5297 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5303 if (!isNonDependentConceptArgument(In.getArgument())) {
5318template <
typename Derived>
5329 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5332 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5333 if (IsLateExpansionAttempt) {
5338 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5340 if (!SawPackTypes) {
5345 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5353 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5359 if (ComputeInfo(In,
false, Info, Pattern))
5371 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5372 std::in_place,
getSema(), std::nullopt);
5378 if (Out.getArgument().isNull())
5415 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5416 if (ComputeInfo(Out,
true, Info, OutPattern))
5429template<
typename Derived>
5447template <
typename Derived>
5467template<
typename Derived>
5470 switch (
T.getTypeLocClass()) {
5471#define ABSTRACT_TYPELOC(CLASS, PARENT)
5472#define TYPELOC(CLASS, PARENT) \
5473 case TypeLoc::CLASS: \
5474 return getDerived().Transform##CLASS##Type(TLB, \
5475 T.castAs<CLASS##TypeLoc>());
5476#include "clang/AST/TypeLocNodes.def"
5479 llvm_unreachable(
"unhandled type loc!");
5482template<
typename Derived>
5495template <
typename Derived>
5533template<
typename Derived>
5538 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5539 auto SuppressObjCLifetime =
5540 T.getType().getLocalQualifiers().hasObjCLifetime();
5542 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5543 SuppressObjCLifetime);
5544 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5545 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5546 TLB, STTP, SuppressObjCLifetime);
5548 Result = getDerived().TransformType(TLB, UnqualTL);
5567template <
typename Derived>
5577 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5584 if (
T.getPointerAuth().isPresent()) {
5585 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5588 if (!
T->isDependentType()) {
5589 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5590 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5598 if (
T->isFunctionType()) {
5599 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5609 if (
T->isReferenceType()) {
5619 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5621 else if (
T.getObjCLifetime()) {
5625 const AutoType *AutoTy;
5626 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5632 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5634 AutoTy->getKeyword(),
5635 AutoTy->getTypeConstraintConcept(),
5636 AutoTy->getTypeConstraintArguments());
5641 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5647 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5650template <
typename Derived>
5651QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5654 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5657 case TypeLoc::TemplateSpecialization:
5658 return getDerived().TransformTemplateSpecializationType(
5660 FirstQualifierInScope,
true);
5661 case TypeLoc::DependentName:
5662 return getDerived().TransformDependentNameType(
5664 ObjectType, FirstQualifierInScope);
5668 return getDerived().TransformType(TLB, TL);
5672template <
class TyLoc>
static inline
5674 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5675 NewT.setNameLoc(
T.getNameLoc());
5679template<
typename Derived>
5680QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5682 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5683 NewT.setBuiltinLoc(T.getBuiltinLoc());
5684 if (T.needsExtraLocalData())
5685 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5689template<
typename Derived>
5696template <
typename Derived>
5700 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5703template<
typename Derived>
5706 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5707 if (OriginalType.isNull())
5711 if (getDerived().AlwaysRebuild() ||
5712 OriginalType != TL.getOriginalLoc().getType())
5719template <
typename Derived>
5723 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5724 if (OriginalType.isNull())
5728 if (getDerived().AlwaysRebuild() ||
5729 OriginalType != TL.getElementLoc().getType())
5736template<
typename Derived>
5740 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5741 if (PointeeType.isNull())
5745 if (PointeeType->getAs<ObjCObjectType>()) {
5757 if (getDerived().AlwaysRebuild() ||
5758 PointeeType != TL.getPointeeLoc().getType()) {
5759 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5766 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5773template<
typename Derived>
5778 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5779 if (PointeeType.isNull())
5783 if (getDerived().AlwaysRebuild() ||
5784 PointeeType != TL.getPointeeLoc().getType()) {
5785 Result = getDerived().RebuildBlockPointerType(PointeeType,
5800template<
typename Derived>
5808 if (PointeeType.
isNull())
5813 PointeeType !=
T->getPointeeTypeAsWritten()) {
5815 T->isSpelledAsLValue(),
5837template<
typename Derived>
5841 return TransformReferenceType(TLB, TL);
5844template<
typename Derived>
5846TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5847 RValueReferenceTypeLoc TL) {
5848 return TransformReferenceType(TLB, TL);
5851template<
typename Derived>
5855 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5856 if (PointeeType.isNull())
5863 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5864 if (!NewQualifierLoc)
5867 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5869 NewCls = cast_or_null<CXXRecordDecl>(
5870 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5876 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5877 NewQualifierLoc.getNestedNameSpecifier() !=
5878 OldQualifierLoc.getNestedNameSpecifier() ||
5881 SS.
Adopt(NewQualifierLoc);
5882 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5891 if (MPT && PointeeType != MPT->getPointeeType()) {
5898 NewTL.setQualifierLoc(NewQualifierLoc);
5903template<
typename Derived>
5908 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5909 if (ElementType.isNull())
5913 Expr *OldSize = TL.getSizeExpr();
5915 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5916 Expr *NewSize =
nullptr;
5920 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5925 if (getDerived().AlwaysRebuild() ||
5926 ElementType !=
T->getElementType() ||
5927 (
T->getSizeExpr() && NewSize != OldSize)) {
5928 Result = getDerived().RebuildConstantArrayType(ElementType,
5929 T->getSizeModifier(),
5930 T->getSize(), NewSize,
5931 T->getIndexTypeCVRQualifiers(),
5932 TL.getBracketsRange());
5943 NewTL.setRBracketLoc(TL.getRBracketLoc());
5944 NewTL.setSizeExpr(NewSize);
5949template<
typename Derived>
5954 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5955 if (ElementType.isNull())
5959 if (getDerived().AlwaysRebuild() ||
5960 ElementType !=
T->getElementType()) {
5961 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5962 T->getSizeModifier(),
5963 T->getIndexTypeCVRQualifiers(),
5964 TL.getBracketsRange());
5971 NewTL.setRBracketLoc(TL.getRBracketLoc());
5972 NewTL.setSizeExpr(
nullptr);
5977template<
typename Derived>
5982 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5983 if (ElementType.isNull())
5990 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5992 if (SizeResult.isInvalid())
5996 if (SizeResult.isInvalid())
6002 if (getDerived().AlwaysRebuild() ||
6003 ElementType !=
T->getElementType() ||
6004 Size !=
T->getSizeExpr()) {
6005 Result = getDerived().RebuildVariableArrayType(ElementType,
6006 T->getSizeModifier(),
6008 T->getIndexTypeCVRQualifiers(),
6009 TL.getBracketsRange());
6018 NewTL.setRBracketLoc(TL.getRBracketLoc());
6019 NewTL.setSizeExpr(Size);
6024template<
typename Derived>
6029 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6030 if (ElementType.isNull())
6038 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6041 Expr *origSize = TL.getSizeExpr();
6042 if (!origSize) origSize =
T->getSizeExpr();
6045 = getDerived().TransformExpr(origSize);
6047 if (sizeResult.isInvalid())
6050 Expr *size = sizeResult.get();
6053 if (getDerived().AlwaysRebuild() ||
6054 ElementType !=
T->getElementType() ||
6056 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6057 T->getSizeModifier(),
6059 T->getIndexTypeCVRQualifiers(),
6060 TL.getBracketsRange());
6069 NewTL.setRBracketLoc(TL.getRBracketLoc());
6070 NewTL.setSizeExpr(size);
6075template <
typename Derived>
6079 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6080 if (ElementType.isNull())
6088 if (
Size.isInvalid())
6092 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6093 Size.get() !=
T->getSizeExpr()) {
6094 Result = getDerived().RebuildDependentVectorType(
6095 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6113template<
typename Derived>
6120 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6121 if (ElementType.isNull())
6130 if (
Size.isInvalid())
6134 if (getDerived().AlwaysRebuild() ||
6135 ElementType !=
T->getElementType() ||
6136 Size.get() !=
T->getSizeExpr()) {
6137 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6139 T->getAttributeLoc());
6157template <
typename Derived>
6162 QualType ElementType = getDerived().TransformType(
T->getElementType());
6163 if (ElementType.isNull())
6167 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6168 Result = getDerived().RebuildConstantMatrixType(
6169 ElementType,
T->getNumRows(),
T->getNumColumns());
6176 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6177 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6178 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6183template <
typename Derived>
6188 QualType ElementType = getDerived().TransformType(
T->getElementType());
6189 if (ElementType.isNull()) {
6197 Expr *origRows = TL.getAttrRowOperand();
6199 origRows =
T->getRowExpr();
6200 Expr *origColumns = TL.getAttrColumnOperand();
6202 origColumns =
T->getColumnExpr();
6204 ExprResult rowResult = getDerived().TransformExpr(origRows);
6206 if (rowResult.isInvalid())
6209 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6211 if (columnResult.isInvalid())
6214 Expr *rows = rowResult.get();
6215 Expr *columns = columnResult.get();
6218 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6219 rows != origRows || columns != origColumns) {
6220 Result = getDerived().RebuildDependentSizedMatrixType(
6221 ElementType, rows, columns,
T->getAttributeLoc());
6231 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6232 NewTL.setAttrRowOperand(rows);
6233 NewTL.setAttrColumnOperand(columns);
6237template <
typename Derived>
6243 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6245 if (pointeeType.isNull())
6252 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6254 if (AddrSpace.isInvalid())
6258 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6259 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6260 Result = getDerived().RebuildDependentAddressSpaceType(
6261 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6272 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6273 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6276 TLB.TypeWasModifiedSafely(
Result);
6282template <
typename Derived>
6286 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6287 if (ElementType.isNull())
6291 if (getDerived().AlwaysRebuild() ||
6292 ElementType !=
T->getElementType()) {
6293 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6294 T->getVectorKind());
6305template<
typename Derived>
6309 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6310 if (ElementType.isNull())
6314 if (getDerived().AlwaysRebuild() ||
6315 ElementType !=
T->getElementType()) {
6316 Result = getDerived().RebuildExtVectorType(ElementType,
6317 T->getNumElements(),
6329template <
typename Derived>
6332 bool ExpectParameterPack) {
6367 if (NewTSI == OldTSI && indexAdjustment == 0)
6377 getDerived().transformedLocalDecl(OldParm, {newParm});
6381template <
typename Derived>
6389 unsigned *LastParamTransformed) {
6390 int indexAdjustment = 0;
6392 unsigned NumParams = Params.size();
6393 for (
unsigned i = 0; i != NumParams; ++i) {
6394 if (LastParamTransformed)
6395 *LastParamTransformed = i;
6397 assert(OldParm->getFunctionScopeIndex() == i);
6401 if (OldParm->isParameterPack()) {
6406 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6409 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6412 bool ShouldExpand =
false;
6413 bool RetainExpansion =
false;
6415 if (Unexpanded.size() > 0) {
6416 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6417 NumExpansions = OrigNumExpansions;
6421 ShouldExpand, RetainExpansion, NumExpansions)) {
6426 const AutoType *AT =
6427 Pattern.getType().getTypePtr()->getContainedAutoType();
6428 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6429 "Could not find parameter packs or undeduced auto type!");
6436 getDerived().ExpandingFunctionParameterPack(OldParm);
6437 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6440 =
getDerived().TransformFunctionTypeParam(OldParm,
6448 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6449 OutParamTypes.push_back(NewParm->
getType());
6451 PVars->push_back(NewParm);
6456 if (RetainExpansion) {
6457 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6459 =
getDerived().TransformFunctionTypeParam(OldParm,
6467 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6468 OutParamTypes.push_back(NewParm->
getType());
6470 PVars->push_back(NewParm);
6486 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6491 "Parameter pack no longer a parameter pack after "
6494 NewParm =
getDerived().TransformFunctionTypeParam(
6495 OldParm, indexAdjustment, std::nullopt,
6503 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6504 OutParamTypes.push_back(NewParm->
getType());
6506 PVars->push_back(NewParm);
6514 bool IsPackExpansion =
false;
6517 if (
const PackExpansionType *Expansion
6518 = dyn_cast<PackExpansionType>(OldType)) {
6520 QualType Pattern = Expansion->getPattern();
6522 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6525 bool ShouldExpand =
false;
6526 bool RetainExpansion =
false;
6530 RetainExpansion, NumExpansions)) {
6537 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6544 NewType =
getSema().getASTContext().getPackExpansionType(
6545 NewType, std::nullopt);
6552 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6553 OutParamTypes.push_back(NewType);
6555 PVars->push_back(
nullptr);
6564 if (RetainExpansion) {
6565 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6571 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6572 OutParamTypes.push_back(NewType);
6574 PVars->push_back(
nullptr);
6579 OldType = Expansion->getPattern();
6580 IsPackExpansion =
true;
6582 NewType =
getDerived().TransformType(OldType);
6584 NewType =
getDerived().TransformType(OldType);
6590 if (IsPackExpansion)
6591 NewType =
getSema().Context.getPackExpansionType(NewType,
6595 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6596 OutParamTypes.push_back(NewType);
6598 PVars->push_back(
nullptr);
6603 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6605 assert(parm->getFunctionScopeIndex() == i);
6612template<
typename Derived>
6617 return getDerived().TransformFunctionProtoType(
6621 ExceptionStorage, Changed);
6625template<
typename Derived>
template<
typename Fn>
6644 if (
T->hasTrailingReturn()) {
6648 T->getExtParameterInfosOrNull(),
6649 ParamTypes, &ParamDecls, ExtParamInfos))
6659 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6661 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6676 T->getExtParameterInfosOrNull(),
6677 ParamTypes, &ParamDecls, ExtParamInfos))
6683 bool EPIChanged =
false;
6688 if (
auto NewExtParamInfos =
6704 std::optional<FunctionEffectSet> NewFX;
6716 std::optional<FunctionEffectMode> Mode =
6736 "FunctionEffectMode::None shouldn't be possible here");
6739 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6742 NewFX->insert(NewEC, Errs);
6743 assert(Errs.empty());
6753 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6764 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6770template<
typename Derived>
6793 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6808 if (
const PackExpansionType *PackExpansion =
6809 T->getAs<PackExpansionType>()) {
6814 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6816 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6821 bool Expand =
false;
6822 bool RetainExpansion =
false;
6823 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6828 true, Expand, RetainExpansion,
6841 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6842 Exceptions.push_back(
U);
6848 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6852 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6855 Exceptions.push_back(
U);
6859 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6864 Exceptions.push_back(
U);
6874template<
typename Derived>
6884 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6885 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6896template <
typename Derived>
6897QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6898 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6900 const UnresolvedUsingType *T = TL.getTypePtr();
6901 bool Changed =
false;
6903 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6904 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6905 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6908 Changed |= QualifierLoc != OldQualifierLoc;
6911 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6917 if (getDerived().AlwaysRebuild() || Changed) {
6918 Result = getDerived().RebuildUnresolvedUsingType(
6919 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6927 QualifierLoc, TL.getNameLoc());
6930 QualifierLoc, TL.getNameLoc());
6934template <
typename Derived>
6942 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6945 Changed |= QualifierLoc != OldQualifierLoc;
6948 auto *D = cast_or_null<UsingShadowDecl>(
6949 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6954 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6955 if (UnderlyingType.isNull())
6957 Changed |= UnderlyingType !=
T->desugar();
6960 if (getDerived().AlwaysRebuild() || Changed) {
6961 Result = getDerived().RebuildUsingType(
6962 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6972template<
typename Derived>
6980 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6983 Changed |= QualifierLoc != OldQualifierLoc;
6986 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6987 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6995 if (getDerived().AlwaysRebuild() || Changed) {
6996 Result = getDerived().RebuildTypedefType(
6997 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7003 QualifierLoc, TL.getNameLoc());
7007template<
typename Derived>
7015 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7025 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7027 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7034 NewTL.setLParenLoc(TL.getLParenLoc());
7035 NewTL.setRParenLoc(TL.getRParenLoc());
7040template<
typename Derived>
7044 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7050 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7051 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7058 NewTL.setLParenLoc(TL.getLParenLoc());
7059 NewTL.setRParenLoc(TL.getRParenLoc());
7060 NewTL.setUnmodifiedTInfo(New_Under_TI);
7065template<
typename Derived>
7068 const DecltypeType *
T = TL.getTypePtr();
7075 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7079 E = getSema().ActOnDecltypeExpression(E.get());
7084 if (getDerived().AlwaysRebuild() ||
7085 E.get() !=
T->getUnderlyingExpr()) {
7086 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7094 NewTL.setRParenLoc(TL.getRParenLoc());
7098template <
typename Derived>
7108 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7109 if (IndexExpr.isInvalid())
7112 QualType Pattern = TL.getPattern();
7114 const PackIndexingType *PIT = TL.
getTypePtr();
7118 bool NotYetExpanded = Types.empty();
7119 bool FullySubstituted =
true;
7121 if (Types.empty() && !PIT->expandsToEmptyPack())
7125 if (!
T->containsUnexpandedParameterPack()) {
7126 QualType Transformed = getDerived().TransformType(
T);
7127 if (Transformed.isNull())
7129 SubtitutedTypes.push_back(Transformed);
7134 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7135 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7138 bool ShouldExpand =
true;
7139 bool RetainExpansion =
false;
7141 if (getDerived().TryExpandParameterPacks(
7144 RetainExpansion, NumExpansions))
7146 if (!ShouldExpand) {
7152 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7155 if (NotYetExpanded) {
7156 FullySubstituted =
false;
7157 QualType Out = getDerived().RebuildPackIndexingType(
7167 SubtitutedTypes.push_back(Pack);
7170 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7175 SubtitutedTypes.push_back(Out);
7176 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7180 if (RetainExpansion) {
7181 FullySubstituted =
false;
7182 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7186 SubtitutedTypes.push_back(Out);
7194 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7196 QualType Out = getDerived().RebuildPackIndexingType(
7198 FullySubstituted, SubtitutedTypes);
7207template<
typename Derived>
7213 if (
Result->isDependentType()) {
7214 const UnaryTransformType *
T = TL.getTypePtr();
7216 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7219 QualType NewBase = NewBaseTSI->getType();
7221 Result = getDerived().RebuildUnaryTransformType(NewBase,
7230 NewTL.setParensRange(TL.getParensRange());
7231 NewTL.setUnderlyingTInfo(NewBaseTSI);
7235template<
typename Derived>
7238 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7243 TL.getTemplateNameLoc());
7247 QualType OldDeduced =
T->getDeducedType();
7249 if (!OldDeduced.isNull()) {
7250 NewDeduced = getDerived().TransformType(OldDeduced);
7251 if (NewDeduced.isNull())
7255 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7263 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7264 NewTL.setQualifierLoc(QualifierLoc);
7268template <
typename Derived>
7275 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7280 auto *TD = cast_or_null<TagDecl>(
7287 TD !=
T->getDecl()) {
7288 if (
T->isCanonicalUnqualified())
7305template <
typename Derived>
7311template <
typename Derived>
7312QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7314 return getDerived().TransformTagType(TLB, TL);
7317template<
typename Derived>
7324template<
typename Derived>
7328 return getDerived().TransformTemplateTypeParmType(
7333template <
typename Derived>
7339template<
typename Derived>
7340QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7341 TypeLocBuilder &TLB,
7342 SubstTemplateTypeParmTypeLoc TL) {
7343 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7346 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7351 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7352 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7353 if (Replacement.isNull())
7357 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7361 SubstTemplateTypeParmTypeLoc NewTL
7362 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7363 NewTL.setNameLoc(TL.getNameLoc());
7367template <
typename Derived>
7373template<
typename Derived>
7377 return getDerived().TransformSubstTemplateTypeParmPackType(
7381template <
typename Derived>
7387template<
typename Derived>
7388QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7390 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7391 if (ValueType.isNull())
7394 QualType
Result = TL.getType();
7395 if (getDerived().AlwaysRebuild() ||
7396 ValueType != TL.getValueLoc().getType()) {
7397 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7404 NewTL.setLParenLoc(TL.getLParenLoc());
7405 NewTL.setRParenLoc(TL.getRParenLoc());
7410template <
typename Derived>
7413 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7414 if (ValueType.isNull())
7418 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7421 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7432template <
typename Derived>
7438 if (getDerived().AlwaysRebuild()) {
7439 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7440 EIT->getNumBits(), TL.getNameLoc());
7450template <
typename Derived>
7457 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7460 if (BitsExpr.isInvalid())
7465 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7466 Result = getDerived().RebuildDependentBitIntType(
7467 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7483template <
typename Derived>
7486 llvm_unreachable(
"This type does not need to be transformed.");
7494 template<
typename ArgLocContainer>
7496 ArgLocContainer *Container;
7521 : Container(&Container), Index(Index) { }
7535 return Container->getArgLoc(Index);
7539 return pointer(Container->getArgLoc(Index));
7544 return X.Container == Y.Container &&
X.Index == Y.Index;
7553template<
typename Derived>
7554QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7556 const AutoType *T = TL.getTypePtr();
7557 QualType OldDeduced = T->getDeducedType();
7558 QualType NewDeduced;
7559 if (!OldDeduced.isNull()) {
7560 NewDeduced = getDerived().TransformType(OldDeduced);
7561 if (NewDeduced.isNull())
7568 if (
T->isConstrained()) {
7569 assert(TL.getConceptReference());
7570 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7571 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7573 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7574 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7576 if (getDerived().TransformTemplateArguments(
7577 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7581 if (TL.getNestedNameSpecifierLoc()) {
7583 = getDerived().TransformNestedNameSpecifierLoc(
7584 TL.getNestedNameSpecifierLoc());
7585 if (!NewNestedNameSpec)
7591 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7592 T->isDependentType() ||
T->isConstrained()) {
7595 NewArgList.reserve(NewTemplateArgs.size());
7596 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7597 NewArgList.push_back(ArgLoc.getArgument());
7598 Result = getDerived().RebuildAutoType(
7600 NewDeduced,
T->getKeyword(), NewCD, NewArgList);
7607 NewTL.setRParenLoc(TL.getRParenLoc());
7608 NewTL.setConceptReference(
nullptr);
7610 if (
T->isConstrained()) {
7612 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7613 TL.getConceptNameLoc(),
7614 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7616 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7617 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7619 NewTL.setConceptReference(CR);
7625template <
typename Derived>
7628 return getDerived().TransformTemplateSpecializationType(
7633template <
typename Derived>
7636 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7637 const TemplateSpecializationType *
T = TL.
getTypePtr();
7643 AllowInjectedClassName);
7652 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7661 QualType Result = getDerived().RebuildTemplateSpecializationType(
7674template <
typename Derived>
7678 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7679 if (modifiedType.isNull())
7686 oldType->getAttrKind(), modifiedType,
7687 TL.getAttr() ? TL.getAttr()->getLocation()
7688 : TL.getModifiedLoc().getBeginLoc()))
7692 const Attr *oldAttr = TL.getAttr();
7693 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7694 if (oldAttr && !newAttr)
7700 if (getDerived().AlwaysRebuild() ||
7701 modifiedType != oldType->getModifiedType()) {
7714 QualType equivalentType = modifiedType;
7715 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7717 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7719 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7720 if (equivalentType.isNull())
7726 if (
auto nullability = oldType->getImmediateNullability()) {
7727 if (!modifiedType->canHaveNullability()) {
7728 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7729 : TL.getModifiedLoc().getBeginLoc()),
7730 diag::err_nullability_nonpointer)
7747template <
typename Derived>
7751 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7752 if (InnerTy.isNull())
7755 Expr *OldCount = TL.getCountExpr();
7756 Expr *NewCount =
nullptr;
7758 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7759 if (CountResult.isInvalid())
7761 NewCount = CountResult.get();
7765 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7766 OldCount != NewCount) {
7769 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7776template <
typename Derived>
7781 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7782 if (InnerTy.isNull())
7786 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7788 InnerTy, OldTy->getLateParsedAttribute());
7796template <
typename Derived>
7800 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7803template <
typename Derived>
7806 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7807 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7808 if (InnerTy.isNull())
7812 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7824template <
typename Derived>
7828 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7830 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7831 if (WrappedTy.isNull())
7835 QualType OldContainedTy = oldType->getContainedType();
7837 if (!OldContainedTy.isNull()) {
7838 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7839 if (!oldContainedTSI)
7840 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7842 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7845 ContainedTy = ContainedTSI->getType();
7849 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7850 ContainedTy != oldType->getContainedType()) {
7852 WrappedTy, ContainedTy, oldType->getAttrs());
7858 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7862template <
typename Derived>
7866 return TL.getType();
7869template<
typename Derived>
7873 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7878 if (getDerived().AlwaysRebuild() ||
7879 Inner != TL.getInnerLoc().getType()) {
7880 Result = getDerived().RebuildParenType(Inner);
7887 NewTL.setRParenLoc(TL.getRParenLoc());
7891template <
typename Derived>
7895 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7900 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7902 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7912template<
typename Derived>
7913QualType TreeTransform<Derived>::TransformDependentNameType(
7915 return TransformDependentNameType(TLB, TL,
false);
7918template <
typename Derived>
7919QualType TreeTransform<Derived>::TransformDependentNameType(
7922 const DependentNameType *
T = TL.getTypePtr();
7926 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7927 QualifierLoc, ObjectType, UnqualLookup);
7931 assert((ObjectType.isNull() && !UnqualLookup) &&
7932 "must be transformed by TransformNestedNameSpecifierLoc");
7936 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7937 TL.getElaboratedKeywordLoc(),
7948 NewTL.setQualifierLoc(QualifierLoc);
7949 NewTL.setNameLoc(TL.getNameLoc());
7953 NewTL.setTemplateNameLoc(TL.getNameLoc());
7954 NewTL.setQualifierLoc(QualifierLoc);
7957 QualifierLoc, TL.getNameLoc());
7960 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7964 NewTL.setQualifierLoc(QualifierLoc);
7965 NewTL.setNameLoc(TL.getNameLoc());
7970template<
typename Derived>
7974 = getDerived().TransformType(TLB, TL.getPatternLoc());
7975 if (Pattern.isNull())
7979 if (getDerived().AlwaysRebuild() ||
7980 Pattern != TL.getPatternLoc().getType()) {
7981 Result = getDerived().RebuildPackExpansionType(Pattern,
7982 TL.getPatternLoc().getSourceRange(),
7983 TL.getEllipsisLoc(),
7984 TL.getTypePtr()->getNumExpansions());
7994template<
typename Derived>
7999 TLB.pushFullCopy(TL);
8000 return TL.getType();
8003template<
typename Derived>
8007 const ObjCTypeParamType *
T = TL.getTypePtr();
8009 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
8014 if (getDerived().AlwaysRebuild() ||
8015 OTP !=
T->getDecl()) {
8016 Result = getDerived().RebuildObjCTypeParamType(
8017 OTP, TL.getProtocolLAngleLoc(),
8018 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8019 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8025 if (TL.getNumProtocols()) {
8026 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8027 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8028 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8029 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8034template<
typename Derived>
8039 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8040 if (BaseType.isNull())
8043 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8047 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8049 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8050 QualType TypeArg = TypeArgInfo->getType();
8055 const auto *PackExpansion = PackExpansionLoc.getType()
8056 ->castAs<PackExpansionType>();
8060 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8064 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8065 bool Expand =
false;
8066 bool RetainExpansion =
false;
8067 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8068 if (getDerived().TryExpandParameterPacks(
8069 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8070 Unexpanded,
true, Expand,
8071 RetainExpansion, NumExpansions))
8081 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8082 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8084 if (NewPatternType.isNull())
8088 NewPatternType, NumExpansions);
8090 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8091 NewTypeArgInfos.push_back(
8092 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8098 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8102 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8104 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8106 if (NewTypeArg.isNull())
8109 NewTypeArgInfos.push_back(
8110 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8117 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8119 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8120 if (NewTypeArg.isNull())
8124 if (NewTypeArg == TypeArg) {
8125 NewTypeArgInfos.push_back(TypeArgInfo);
8129 NewTypeArgInfos.push_back(
8130 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8135 if (getDerived().AlwaysRebuild() || AnyChanged) {
8137 Result = getDerived().RebuildObjCObjectType(
8138 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8139 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8140 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8141 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8149 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8150 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8151 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8152 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8153 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8154 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8155 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8156 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8160template<
typename Derived>
8164 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8165 if (PointeeType.isNull())
8169 if (getDerived().AlwaysRebuild() ||
8170 PointeeType != TL.getPointeeLoc().getType()) {
8171 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8185template<
typename Derived>
8191template<
typename Derived>
8194 return getDerived().TransformCompoundStmt(S,
false);
8197template<
typename Derived>
8204 getSema().resetFPOptions(
8207 bool SubStmtInvalid =
false;
8208 bool SubStmtChanged =
false;
8210 for (
auto *B : S->
body()) {
8212 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8213 : StmtDiscardKind::Discarded);
8215 if (
Result.isInvalid()) {
8222 SubStmtInvalid =
true;
8226 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8227 Statements.push_back(
Result.getAs<Stmt>());
8233 if (!getDerived().AlwaysRebuild() &&
8237 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8243template<
typename Derived>
8252 LHS = getDerived().TransformExpr(S->getLHS());
8254 if (LHS.isInvalid())
8258 RHS = getDerived().TransformExpr(S->getRHS());
8260 if (RHS.isInvalid())
8267 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8269 S->getEllipsisLoc(),
8272 if (Case.isInvalid())
8277 getDerived().TransformStmt(S->getSubStmt());
8278 if (SubStmt.isInvalid())
8282 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8285template <
typename Derived>
8289 getDerived().TransformStmt(S->getSubStmt());
8290 if (SubStmt.isInvalid())
8294 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8298template<
typename Derived>
8301 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8302 if (SubStmt.isInvalid())
8305 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8313 if (LD == S->getDecl())
8314 S->getDecl()->setStmt(
nullptr);
8317 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8322template <
typename Derived>
8327 switch (R->getKind()) {
8331 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8332#include "clang/Basic/AttrList.inc"
8337template <
typename Derived>
8344 switch (R->getKind()) {
8348 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8349#include "clang/Basic/AttrList.inc"
8354template <
typename Derived>
8357 StmtDiscardKind SDK) {
8362 bool AttrsChanged =
false;
8366 for (
const auto *I : S->
getAttrs()) {
8368 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8369 AttrsChanged |= (I != R);
8382 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8386template<
typename Derived>
8391 if (
Init.isInvalid())
8395 if (!S->isConsteval()) {
8397 Cond = getDerived().TransformCondition(
8398 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8401 if (
Cond.isInvalid())
8406 std::optional<bool> ConstexprConditionValue;
8407 if (S->isConstexpr())
8408 ConstexprConditionValue =
Cond.getKnownValue();
8412 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8416 S->isNonNegatedConsteval());
8418 Then = getDerived().TransformStmt(S->getThen());
8419 if (Then.isInvalid())
8425 Then =
new (getSema().Context)
8426 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8431 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8435 S->isNegatedConsteval());
8437 Else = getDerived().TransformStmt(S->getElse());
8438 if (Else.isInvalid())
8440 }
else if (S->getElse() && ConstexprConditionValue &&
8441 *ConstexprConditionValue) {
8445 Else =
new (getSema().Context)
8446 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8449 if (!getDerived().AlwaysRebuild() &&
8450 Init.get() == S->getInit() &&
8451 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8452 Then.get() == S->getThen() &&
8453 Else.get() == S->getElse())
8456 return getDerived().RebuildIfStmt(
8457 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8458 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8461template<
typename Derived>
8466 if (
Init.isInvalid())
8471 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8473 if (
Cond.isInvalid())
8478 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8479 Init.get(),
Cond, S->getRParenLoc());
8484 StmtResult Body = getDerived().TransformStmt(S->getBody());
8485 if (Body.isInvalid())
8489 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8493template<
typename Derived>
8498 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8500 if (
Cond.isInvalid())
8509 StmtResult Body = getDerived().TransformStmt(S->getBody());
8510 if (Body.isInvalid())
8513 if (!getDerived().AlwaysRebuild() &&
8514 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8515 Body.get() == S->getBody())
8518 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8519 Cond, S->getRParenLoc(), Body.get());
8522template<
typename Derived>
8531 StmtResult Body = getDerived().TransformStmt(S->getBody());
8532 if (Body.isInvalid())
8537 if (
Cond.isInvalid())
8540 if (!getDerived().AlwaysRebuild() &&
8541 Cond.get() == S->getCond() &&
8542 Body.get() == S->getBody())
8545 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8546 S->getWhileLoc(),
Cond.get(),
8550template<
typename Derived>
8553 if (getSema().getLangOpts().OpenMP)
8554 getSema().OpenMP().startOpenMPLoop();
8558 if (
Init.isInvalid())
8563 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8564 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8569 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8571 if (
Cond.isInvalid())
8576 if (
Inc.isInvalid())
8580 if (S->getInc() && !FullInc.get())
8587 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8588 Cond.get().second, S->getInc(),
Inc.get());
8591 StmtResult Body = getDerived().TransformStmt(S->getBody());
8592 if (Body.isInvalid())
8597 if (!getDerived().AlwaysRebuild() &&
8598 Init.get() == S->getInit() &&
8599 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8600 Inc.get() == S->getInc() &&
8601 Body.get() == S->getBody())
8604 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8606 S->getRParenLoc(), Body.get());
8609template<
typename Derived>
8612 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8618 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8622template<
typename Derived>
8630 if (!getDerived().AlwaysRebuild() &&
8631 Target.get() == S->getTarget())
8634 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8638template<
typename Derived>
8641 if (!S->hasLabelTarget())
8644 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8653template<
typename Derived>
8656 if (!S->hasLabelTarget())
8659 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8668template <
typename Derived>
8676template<
typename Derived>
8686 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8689template<
typename Derived>
8692 bool DeclChanged =
false;
8695 for (
auto *D : S->decls()) {
8696 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8700 if (Transformed != D)
8704 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8705 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8706 LSI->ContainsUnexpandedParameterPack |=
8707 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8709 LSI->ContainsUnexpandedParameterPack |=
8712 .getTypeDeclType(TD)
8713 ->containsUnexpandedParameterPack();
8716 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8717 LSI->ContainsUnexpandedParameterPack |=
8718 VD->getType()->containsUnexpandedParameterPack();
8721 Decls.push_back(Transformed);
8724 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8727 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8730template<
typename Derived>
8740 bool ExprsChanged =
false;
8742 auto RebuildString = [&](
Expr *E) {
8747 ExprsChanged =
true;
8754 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8755 Names.push_back(S->getOutputIdentifier(I));
8761 Constraints.push_back(
Result.get());
8764 Expr *OutputExpr = S->getOutputExpr(I);
8765 Result = getDerived().TransformExpr(OutputExpr);
8769 ExprsChanged |=
Result.get() != OutputExpr;
8771 Exprs.push_back(
Result.get());
8775 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8776 Names.push_back(S->getInputIdentifier(I));
8782 Constraints.push_back(
Result.get());
8785 Expr *InputExpr = S->getInputExpr(I);
8786 Result = getDerived().TransformExpr(InputExpr);
8790 ExprsChanged |=
Result.get() != InputExpr;
8792 Exprs.push_back(
Result.get());
8796 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8797 Names.push_back(S->getLabelIdentifier(I));
8802 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8803 Exprs.push_back(
Result.get());
8807 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8811 Clobbers.push_back(
Result.get());
8814 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8815 if (AsmString.isInvalid())
8818 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8821 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8822 S->isVolatile(), S->getNumOutputs(),
8823 S->getNumInputs(), Names.data(),
8824 Constraints, Exprs, AsmString.get(),
8825 Clobbers, S->getNumLabels(),
8829template<
typename Derived>
8834 bool HadError =
false, HadChange =
false;
8838 TransformedExprs.reserve(SrcExprs.size());
8839 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8841 if (!
Result.isUsable()) {
8844 HadChange |= (
Result.get() != SrcExprs[i]);
8845 TransformedExprs.push_back(
Result.get());
8850 if (!HadChange && !getDerived().AlwaysRebuild())
8853 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8854 AsmToks, S->getAsmString(),
8855 S->getNumOutputs(), S->getNumInputs(),
8856 S->getAllConstraints(), S->getClobbers(),
8857 TransformedExprs, S->getEndLoc());
8861template<
typename Derived>
8866 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8867 ScopeInfo->NeedsCoroutineSuspends &&
8868 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8869 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8870 "expected clean scope info");
8874 ScopeInfo->setNeedsCoroutineSuspends(
false);
8887 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8888 ScopeInfo->CoroutinePromise = Promise;
8893 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8894 if (InitSuspend.isInvalid())
8897 getDerived().TransformStmt(S->getFinalSuspendStmt());
8898 if (FinalSuspend.isInvalid() ||
8901 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8904 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8905 if (BodyRes.isInvalid())
8909 if (Builder.isInvalid())
8912 Expr *ReturnObject = S->getReturnValueInit();
8913 assert(ReturnObject &&
"the return object is expected to be valid");
8914 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8916 if (Res.isInvalid())
8918 Builder.ReturnValue = Res.get();
8923 if (S->hasDependentPromiseType()) {
8926 if (!Promise->getType()->isDependentType()) {
8927 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8928 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8929 "these nodes should not have been built yet");
8930 if (!Builder.buildDependentStatements())
8934 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8935 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8936 if (Res.isInvalid())
8938 Builder.OnFallthrough = Res.get();
8941 if (
auto *OnException = S->getExceptionHandler()) {
8942 StmtResult Res = getDerived().TransformStmt(OnException);
8943 if (Res.isInvalid())
8945 Builder.OnException = Res.get();
8948 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8949 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8950 if (Res.isInvalid())
8952 Builder.ReturnStmtOnAllocFailure = Res.get();
8956 assert(S->getAllocate() && S->getDeallocate() &&
8957 "allocation and deallocation calls must already be built");
8958 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8959 if (AllocRes.isInvalid())
8961 Builder.Allocate = AllocRes.get();
8963 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8964 if (DeallocRes.isInvalid())
8966 Builder.Deallocate = DeallocRes.get();
8968 if (
auto *ResultDecl = S->getResultDecl()) {
8969 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8970 if (Res.isInvalid())
8972 Builder.ResultDecl = Res.get();
8977 if (Res.isInvalid())
8979 Builder.ReturnStmt = Res.get();
8983 return getDerived().RebuildCoroutineBodyStmt(Builder);
8986template<
typename Derived>
8996 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9000template <
typename Derived>
9013 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9014 getSema().getCurScope(), E->getKeywordLoc());
9018 return getDerived().RebuildCoawaitExpr(
9019 E->getKeywordLoc(),
Operand.get(),
9023template <
typename Derived>
9026 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9028 if (OperandResult.isInvalid())
9032 E->getOperatorCoawaitLookup());
9039 return getDerived().RebuildDependentCoawaitExpr(
9040 E->getKeywordLoc(), OperandResult.get(),
9044template<
typename Derived>
9054 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9059template<
typename Derived>
9063 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9064 if (TryBody.isInvalid())
9068 bool AnyCatchChanged =
false;
9070 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9071 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9072 if (Catch.isInvalid())
9074 if (Catch.get() != S->getCatchStmt(I))
9075 AnyCatchChanged =
true;
9076 CatchStmts.push_back(Catch.get());
9081 if (S->getFinallyStmt()) {
9082 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9083 if (Finally.isInvalid())
9088 if (!getDerived().AlwaysRebuild() &&
9089 TryBody.get() == S->getTryBody() &&
9091 Finally.get() == S->getFinallyStmt())
9095 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9096 CatchStmts, Finally.get());
9099template<
typename Derived>
9104 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9106 if (FromVar->getTypeSourceInfo()) {
9107 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9114 T = TSInfo->getType();
9116 T = getDerived().TransformType(FromVar->getType());
9121 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9126 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9127 if (Body.isInvalid())
9130 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9135template<
typename Derived>
9139 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9140 if (Body.isInvalid())
9144 if (!getDerived().AlwaysRebuild() &&
9145 Body.get() == S->getFinallyBody())
9149 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9153template<
typename Derived>
9157 if (S->getThrowExpr()) {
9158 Operand = getDerived().TransformExpr(S->getThrowExpr());
9163 if (!getDerived().AlwaysRebuild() &&
9164 Operand.get() == S->getThrowExpr())
9167 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9170template<
typename Derived>
9179 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9185 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9186 if (Body.isInvalid())
9190 if (!getDerived().AlwaysRebuild() &&
9191 Object.get() == S->getSynchExpr() &&
9192 Body.get() == S->getSynchBody())
9196 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9197 Object.get(), Body.get());
9200template<
typename Derived>
9205 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9206 if (Body.isInvalid())
9210 if (!getDerived().AlwaysRebuild() &&
9211 Body.get() == S->getSubStmt())
9215 return getDerived().RebuildObjCAutoreleasePoolStmt(
9216 S->getAtLoc(), Body.get());
9219template<
typename Derived>
9224 StmtResult Element = getDerived().TransformStmt(
9225 S->getElement(), StmtDiscardKind::NotDiscarded);
9226 if (Element.isInvalid())
9230 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9231 if (Collection.isInvalid())
9235 StmtResult Body = getDerived().TransformStmt(S->getBody());
9236 if (Body.isInvalid())
9240 if (!getDerived().AlwaysRebuild() &&
9241 Element.get() == S->getElement() &&
9242 Collection.get() == S->getCollection() &&
9243 Body.get() == S->getBody())
9247 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9254template <
typename Derived>
9258 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9260 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9264 Var = getDerived().RebuildExceptionDecl(
9265 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9266 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9267 if (!Var || Var->isInvalidDecl())
9272 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9273 if (Handler.isInvalid())
9276 if (!getDerived().AlwaysRebuild() && !Var &&
9277 Handler.get() == S->getHandlerBlock())
9280 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9283template <
typename Derived>
9286 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9287 if (TryBlock.isInvalid())
9291 bool HandlerChanged =
false;
9293 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9294 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9295 if (Handler.isInvalid())
9298 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9299 Handlers.push_back(Handler.getAs<
Stmt>());
9302 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9304 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9308 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9312template<
typename Derived>
9323 auto &LastRecord = getSema().currentEvaluationContext();
9324 LastRecord.InLifetimeExtendingContext =
true;
9325 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9328 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9329 if (
Init.isInvalid())
9333 if (
Range.isInvalid())
9338 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9339 auto ForRangeLifetimeExtendTemps =
9340 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9342 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9343 if (Begin.isInvalid())
9345 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9346 if (End.isInvalid())
9350 if (
Cond.isInvalid())
9354 if (
Cond.isInvalid())
9360 if (
Inc.isInvalid())
9365 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9366 if (LoopVar.isInvalid())
9370 if (getDerived().AlwaysRebuild() ||
9371 Init.get() != S->getInit() ||
9372 Range.get() != S->getRangeStmt() ||
9373 Begin.get() != S->getBeginStmt() ||
9374 End.get() != S->getEndStmt() ||
9375 Cond.get() != S->getCond() ||
9376 Inc.get() != S->getInc() ||
9377 LoopVar.get() != S->getLoopVarStmt()) {
9378 NewStmt = getDerived().RebuildCXXForRangeStmt(
9379 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9380 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9381 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9382 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9384 getSema().ActOnInitializerError(
9395 StmtResult Body = getDerived().TransformStmt(S->getBody());
9396 if (Body.isInvalid())
9403 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9404 NewStmt = getDerived().RebuildCXXForRangeStmt(
9405 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9406 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9407 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9408 if (NewStmt.isInvalid())
9412 if (NewStmt.get() == S)
9415 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9418template <
typename Derived>
9424 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9425 if (!ESD || ESD->isInvalidDecl())
9432 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9435 return getDerived().TransformStmt(SubStmt);
9454 if (S->isDependent() || S->isIterating()) {
9460 if (S->isDependent()) {
9466 ExpansionInitializer =
9467 getDerived().TransformExpr(S->getExpansionInitializer());
9468 if (ExpansionInitializer.isInvalid())
9470 }
else if (S->isIterating()) {
9471 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9472 if (
Range.isInvalid())
9476 ExpansionInitializer =
9479 LifetimeExtendTemps =
9484 if (S->isEnumerating()) {
9486 getDerived().TransformStmt(S->getExpansionVarStmt());
9487 if (ExpansionVar.isInvalid())
9492 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9493 }
else if (S->isIterating()) {
9494 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9495 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9496 if (Begin.isInvalid() || Iter.isInvalid())
9503 getDerived().TransformStmt(S->getExpansionVarStmt());
9504 if (ExpansionVar.isInvalid())
9510 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9514 NewPattern->getRangeVar(), LifetimeExtendTemps);
9515 }
else if (S->isDependent()) {
9517 getDerived().TransformStmt(S->getExpansionVarStmt());
9518 if (ExpansionVar.isInvalid())
9523 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9524 S->getRParenLoc(), LifetimeExtendTemps);
9526 if (Res.isInvalid())
9536 llvm_unreachable(
"destructuring pattern should never be instantiated");
9539 StmtResult Body = getDerived().TransformStmt(S->getBody());
9540 if (Body.isInvalid())
9546template <
typename Derived>
9549 bool SubStmtChanged =
false;
9552 for (
Stmt *OldDS : OldStmts) {
9553 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9554 if (NewDS.isInvalid())
9557 SubStmtChanged |= NewDS.get() != OldDS;
9558 NewStmts.push_back(NewDS.get());
9565 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9566 if (!ESD || ESD->isInvalidDecl())
9580 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9583 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9591 if (TransformStmts(Instantiations, S->getInstantiations()))
9594 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9598 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9599 S->shouldApplyLifetimeExtensionToPreamble());
9602template <
typename Derived>
9606 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9607 if (
Range.isInvalid() || Idx.isInvalid())
9610 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9611 Idx.get() == E->getIndexExpr())
9618template<
typename Derived>
9624 if (S->getQualifierLoc()) {
9626 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9633 if (NameInfo.getName()) {
9634 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9635 if (!NameInfo.getName())
9640 if (!getDerived().AlwaysRebuild() &&
9641 QualifierLoc == S->getQualifierLoc() &&
9642 NameInfo.getName() == S->getNameInfo().getName())
9647 SS.
Adopt(QualifierLoc);
9649 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9651 if (S->isIfExists())
9654 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9657 if (S->isIfNotExists())
9660 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9671 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9672 if (SubStmt.isInvalid())
9680 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9687template<
typename Derived>
9691 if (E->getQualifierLoc()) {
9693 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9699 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9704 if (
Base.isInvalid())
9710 QualifierLoc, E->getMemberLoc());
9713template <
typename Derived>
9717 if (BaseRes.isInvalid())
9719 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9720 if (IdxRes.isInvalid())
9723 if (!getDerived().AlwaysRebuild() &&
9724 BaseRes.get() == E->getBase() &&
9725 IdxRes.get() == E->getIdx())
9728 return getDerived().RebuildArraySubscriptExpr(
9729 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9732template <
typename Derived>
9734 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9735 if (TryBlock.isInvalid())
9738 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9739 if (Handler.isInvalid())
9742 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9743 Handler.get() == S->getHandler())
9746 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9747 TryBlock.get(), Handler.get());
9750template <
typename Derived>
9753 if (
Block.isInvalid())
9756 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9759template <
typename Derived>
9761 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9762 if (FilterExpr.isInvalid())
9766 if (
Block.isInvalid())
9769 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9773template <
typename Derived>
9781template<
typename Derived>
9791template <
typename Derived>
9793TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9797 return getDerived().TransformStmt(L->getLoopStmt());
9800template <
typename Derived>
9807 TClauses.reserve(Clauses.size());
9811 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9813 getDerived().getSema().OpenMP().EndOpenMPClause();
9815 TClauses.push_back(Clause);
9817 TClauses.push_back(
nullptr);
9821 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9822 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9823 D->getDirectiveKind(),
9829 if (D->getDirectiveKind() == OMPD_atomic ||
9830 D->getDirectiveKind() == OMPD_critical ||
9831 D->getDirectiveKind() == OMPD_section ||
9832 D->getDirectiveKind() == OMPD_master)
9833 CS = D->getAssociatedStmt();
9835 CS = D->getRawStmt();
9838 getSema().getLangOpts().OpenMPIRBuilder)
9842 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9847 if (TClauses.size() != Clauses.size()) {
9853 if (D->getDirectiveKind() == OMPD_critical) {
9855 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9858 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9860 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9864 return getDerived().RebuildOMPExecutableDirective(
9865 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9866 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9874template <
typename Derived>
9881 TClauses.reserve(Clauses.size());
9884 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9886 getDerived().getSema().OpenMP().EndOpenMPClause();
9888 TClauses.push_back(Clause);
9890 TClauses.push_back(
nullptr);
9894 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9895 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9896 D->getDirectiveKind(),
9901 assert(D->getDirectiveKind() == OMPD_assume &&
9902 "Unexpected informational directive");
9903 Stmt *CS = D->getAssociatedStmt();
9907 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9911 if (TClauses.size() != Clauses.size())
9916 return getDerived().RebuildOMPInformationalDirective(
9917 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9918 D->getBeginLoc(), D->getEndLoc());
9921template <
typename Derived>
9926 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9927 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9931template <
typename Derived>
9933TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9934 DeclarationNameInfo DirName;
9935 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9936 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9937 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9938 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9942template <
typename Derived>
9946 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9947 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9948 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9949 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9953template <
typename Derived>
9957 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9958 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9959 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9960 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9964template <
typename Derived>
9968 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9969 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9970 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9971 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9975template <
typename Derived>
9979 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9980 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9981 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9982 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9986template <
typename Derived>
9990 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9991 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9992 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9993 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9997template <
typename Derived>
9999 OMPInterchangeDirective *D) {
10001 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10002 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10003 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10004 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10008template <
typename Derived>
10012 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10013 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10014 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10015 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10019template <
typename Derived>
10023 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10024 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10025 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10026 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10030template <
typename Derived>
10034 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10035 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10036 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10037 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10041template <
typename Derived>
10045 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10046 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10047 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10048 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10052template <
typename Derived>
10056 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10057 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10058 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10059 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10063template <
typename Derived>
10067 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10068 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10069 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10070 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10074template <
typename Derived>
10078 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10079 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10080 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10081 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10085template <
typename Derived>
10089 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10090 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10091 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10092 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10096template <
typename Derived>
10100 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10101 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10102 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10103 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10107template <
typename Derived>
10111 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
10112 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10113 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10117template <
typename Derived>
10119 OMPParallelForDirective *D) {
10121 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10122 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10123 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10124 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10128template <
typename Derived>
10130 OMPParallelForSimdDirective *D) {
10132 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10133 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10134 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10135 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10139template <
typename Derived>
10141 OMPParallelMasterDirective *D) {
10143 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10144 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10145 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10146 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10150template <
typename Derived>
10152 OMPParallelMaskedDirective *D) {
10154 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10155 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10156 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10157 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10161template <
typename Derived>
10163 OMPParallelSectionsDirective *D) {
10165 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10166 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10167 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10168 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10172template <
typename Derived>
10176 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10177 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10178 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10179 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10183template <
typename Derived>
10185 OMPTaskyieldDirective *D) {
10187 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10188 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10189 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10190 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10194template <
typename Derived>
10198 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10199 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10200 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10201 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10205template <
typename Derived>
10209 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10210 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10211 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10212 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10216template <
typename Derived>
10220 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10221 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10222 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10223 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10227template <
typename Derived>
10231 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10232 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10233 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10234 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10238template <
typename Derived>
10240 OMPTaskgroupDirective *D) {
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10243 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10244 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10249template <
typename Derived>
10253 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10254 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10255 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10256 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10260template <
typename Derived>
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10265 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10266 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10271template <
typename Derived>
10275 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10276 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10277 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10278 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10282template <
typename Derived>
10284 OMPOrderedStandaloneDirective *D) {
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10287 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10295 OMPOrderedBlockAssocDirective *D) {
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10299 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10304template <
typename Derived>
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10310 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10319 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10320 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10321 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10322 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10326template <
typename Derived>
10328 OMPTargetDataDirective *D) {
10330 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10331 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10332 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10333 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10337template <
typename Derived>
10339 OMPTargetEnterDataDirective *D) {
10341 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10342 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10343 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10344 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10348template <
typename Derived>
10350 OMPTargetExitDataDirective *D) {
10352 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10353 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10354 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10355 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10359template <
typename Derived>
10361 OMPTargetParallelDirective *D) {
10363 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10364 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10365 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10366 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10370template <
typename Derived>
10372 OMPTargetParallelForDirective *D) {
10374 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10375 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10376 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10377 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10381template <
typename Derived>
10383 OMPTargetUpdateDirective *D) {
10385 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10386 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10387 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10388 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10392template <
typename Derived>
10396 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10397 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10398 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10399 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10403template <
typename Derived>
10405 OMPCancellationPointDirective *D) {
10407 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10408 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10409 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10410 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10414template <
typename Derived>
10418 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10419 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10420 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10421 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10425template <
typename Derived>
10429 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10430 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10431 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10432 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10436template <
typename Derived>
10438 OMPTaskLoopSimdDirective *D) {
10440 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10441 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10442 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10443 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10447template <
typename Derived>
10449 OMPMasterTaskLoopDirective *D) {
10451 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10452 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10453 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10454 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10458template <
typename Derived>
10460 OMPMaskedTaskLoopDirective *D) {
10462 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10463 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10464 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10465 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10469template <
typename Derived>
10471 OMPMasterTaskLoopSimdDirective *D) {
10473 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10474 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10475 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10476 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10480template <
typename Derived>
10482 OMPMaskedTaskLoopSimdDirective *D) {
10484 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10485 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10486 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10487 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10491template <
typename Derived>
10493 OMPParallelMasterTaskLoopDirective *D) {
10495 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10496 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10497 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10498 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10502template <
typename Derived>
10504 OMPParallelMaskedTaskLoopDirective *D) {
10506 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10507 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10508 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10509 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10513template <
typename Derived>
10516 OMPParallelMasterTaskLoopSimdDirective *D) {
10518 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10519 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10520 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10521 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10525template <
typename Derived>
10528 OMPParallelMaskedTaskLoopSimdDirective *D) {
10530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10531 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10532 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10537template <
typename Derived>
10539 OMPDistributeDirective *D) {
10541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10542 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10543 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10548template <
typename Derived>
10550 OMPDistributeParallelForDirective *D) {
10552 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10553 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10554 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10555 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10559template <
typename Derived>
10562 OMPDistributeParallelForSimdDirective *D) {
10564 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10565 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10566 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10567 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10571template <
typename Derived>
10573 OMPDistributeSimdDirective *D) {
10575 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10576 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10577 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10578 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10582template <
typename Derived>
10584 OMPTargetParallelForSimdDirective *D) {
10586 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10587 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10588 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10589 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10593template <
typename Derived>
10595 OMPTargetSimdDirective *D) {
10597 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10598 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10599 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10600 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10604template <
typename Derived>
10606 OMPTeamsDistributeDirective *D) {
10608 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10609 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10610 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10611 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10615template <
typename Derived>
10617 OMPTeamsDistributeSimdDirective *D) {
10619 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10620 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10621 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10622 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10626template <
typename Derived>
10628 OMPTeamsDistributeParallelForSimdDirective *D) {
10630 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10631 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10633 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10634 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10638template <
typename Derived>
10640 OMPTeamsDistributeParallelForDirective *D) {
10642 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10643 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10644 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10645 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10649template <
typename Derived>
10651 OMPTargetTeamsDirective *D) {
10653 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10654 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10655 auto Res = getDerived().TransformOMPExecutableDirective(D);
10656 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10660template <
typename Derived>
10662 OMPTargetTeamsDistributeDirective *D) {
10664 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10665 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10666 auto Res = getDerived().TransformOMPExecutableDirective(D);
10667 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10671template <
typename Derived>
10674 OMPTargetTeamsDistributeParallelForDirective *D) {
10676 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10677 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10679 auto Res = getDerived().TransformOMPExecutableDirective(D);
10680 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10684template <
typename Derived>
10687 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10689 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10690 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10692 auto Res = getDerived().TransformOMPExecutableDirective(D);
10693 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10697template <
typename Derived>
10700 OMPTargetTeamsDistributeSimdDirective *D) {
10702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10703 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10704 auto Res = getDerived().TransformOMPExecutableDirective(D);
10705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10709template <
typename Derived>
10713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10714 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10715 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10716 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10720template <
typename Derived>
10724 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10725 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10731template <
typename Derived>
10735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10736 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10742template <
typename Derived>
10744 OMPGenericLoopDirective *D) {
10746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10747 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10753template <
typename Derived>
10755 OMPTeamsGenericLoopDirective *D) {
10757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10758 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10764template <
typename Derived>
10766 OMPTargetTeamsGenericLoopDirective *D) {
10768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10769 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10775template <
typename Derived>
10777 OMPParallelGenericLoopDirective *D) {
10779 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10780 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10781 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10782 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10786template <
typename Derived>
10789 OMPTargetParallelGenericLoopDirective *D) {
10791 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10792 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10793 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10794 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10801template <
typename Derived>
10804 if (
Cond.isInvalid())
10806 return getDerived().RebuildOMPIfClause(
10807 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10808 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10811template <
typename Derived>
10814 if (
Cond.isInvalid())
10816 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10817 C->getLParenLoc(),
C->getEndLoc());
10820template <
typename Derived>
10823 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10824 if (NumThreads.isInvalid())
10826 return getDerived().RebuildOMPNumThreadsClause(
10827 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10828 C->getModifierLoc(),
C->getEndLoc());
10831template <
typename Derived>
10834 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10837 return getDerived().RebuildOMPSafelenClause(
10838 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10841template <
typename Derived>
10844 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10847 return getDerived().RebuildOMPAllocatorClause(
10848 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10851template <
typename Derived>
10854 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10857 return getDerived().RebuildOMPSimdlenClause(
10858 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10861template <
typename Derived>
10864 TransformedSizes.reserve(
C->getNumSizes());
10866 for (
Expr *E :
C->getSizesRefs()) {
10868 TransformedSizes.push_back(
nullptr);
10877 TransformedSizes.push_back(
T.get());
10880 if (!Changed && !getDerived().AlwaysRebuild())
10882 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10883 C->getLParenLoc(),
C->getEndLoc());
10886template <
typename Derived>
10890 TransformedCounts.reserve(
C->getNumCounts());
10891 for (
Expr *E :
C->getCountsRefs()) {
10893 TransformedCounts.push_back(
nullptr);
10900 TransformedCounts.push_back(
T.get());
10903 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
10904 C->getLParenLoc(),
C->getEndLoc(),
10905 C->getOmpFillIndex(),
C->getOmpFillLoc());
10908template <
typename Derived>
10912 TransformedArgs.reserve(
C->getNumLoops());
10914 for (
Expr *E :
C->getArgsRefs()) {
10916 TransformedArgs.push_back(
nullptr);
10925 TransformedArgs.push_back(
T.get());
10928 if (!Changed && !getDerived().AlwaysRebuild())
10930 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10931 C->getLParenLoc(),
C->getEndLoc());
10934template <
typename Derived>
10936 if (!getDerived().AlwaysRebuild())
10938 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10941template <
typename Derived>
10944 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10947 Expr *Factor =
T.get();
10948 bool Changed = Factor !=
C->getFactor();
10950 if (!Changed && !getDerived().AlwaysRebuild())
10952 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10956template <
typename Derived>
10959 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10963 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10964 if (Cn.isInvalid())
10968 Expr *Count = Cn.get();
10970 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10973 if (!Changed && !getDerived().AlwaysRebuild())
10976 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10977 C->getLParenLoc(),
C->getFirstLoc(),
10978 C->getCountLoc(),
C->getEndLoc());
10981template <
typename Derived>
10984 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10987 return getDerived().RebuildOMPCollapseClause(
10988 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10991template <
typename Derived>
10995 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10996 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11000template <
typename Derived>
11007template <
typename Derived>
11010 Expr *Impex =
C->getImpexType();
11011 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11013 if (TransformedImpex.isInvalid())
11016 return getDerived().RebuildOMPTransparentClause(
11017 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11021template <
typename Derived>
11025 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11026 C->getLParenLoc(),
C->getEndLoc());
11029template <
typename Derived>
11032 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11035 return getDerived().RebuildOMPScheduleClause(
11036 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11037 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11038 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11039 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11042template <
typename Derived>
11046 if (
auto *
Num =
C->getNumForLoops()) {
11047 E = getDerived().TransformExpr(
Num);
11051 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11052 C->getLParenLoc(), E.get());
11055template <
typename Derived>
11059 if (
Expr *Evt =
C->getEventHandler()) {
11060 E = getDerived().TransformExpr(Evt);
11064 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11065 C->getLParenLoc(),
C->getEndLoc());
11068template <
typename Derived>
11074 if (
Cond.isInvalid())
11077 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
11078 C->getLParenLoc(),
C->getEndLoc());
11081template <
typename Derived>
11088template <
typename Derived>
11095template <
typename Derived>
11101template <
typename Derived>
11107template <
typename Derived>
11114template <
typename Derived>
11116 OMPUpdateDependObjectsClause *
C) {
11121template <
typename Derived>
11128template <
typename Derived>
11135template <
typename Derived>
11141template <
typename Derived>
11147template <
typename Derived>
11149 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11152 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11153 C->getLParenLoc(),
C->getEndLoc());
11156template <
typename Derived>
11162template <
typename Derived>
11167template <
typename Derived>
11169 OMPNoOpenMPRoutinesClause *
C) {
11172template <
typename Derived>
11174 OMPNoOpenMPConstructsClause *
C) {
11177template <
typename Derived>
11179 OMPNoParallelismClause *
C) {
11183template <
typename Derived>
11190template <
typename Derived>
11197template <
typename Derived>
11204template <
typename Derived>
11211template <
typename Derived>
11218template <
typename Derived>
11224template <
typename Derived>
11231template <
typename Derived>
11237template <
typename Derived>
11244template <
typename Derived>
11246 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11247 if (IVR.isInvalid())
11251 for (OMPInitClause::PrefView P :
C->prefs()) {
11252 Expr *NewFr =
nullptr;
11254 ExprResult ER = getDerived().TransformExpr(P.Fr);
11255 if (ER.isInvalid())
11260 NewAttrs.reserve(P.Attrs.size());
11261 for (
Expr *A : P.Attrs) {
11262 ExprResult ER = getDerived().TransformExpr(A);
11263 if (ER.isInvalid())
11265 NewAttrs.push_back(ER.get());
11267 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11269 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11270 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11271 C->getBeginLoc(),
C->getLParenLoc(),
11272 C->getVarLoc(),
C->getEndLoc());
11275template <
typename Derived>
11277 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11278 if (ER.isInvalid())
11280 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11281 C->getLParenLoc(),
C->getVarLoc(),
11285template <
typename Derived>
11289 if (
Expr *IV =
C->getInteropVar()) {
11290 ER = getDerived().TransformExpr(IV);
11291 if (ER.isInvalid())
11294 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11295 C->getLParenLoc(),
C->getVarLoc(),
11299template <
typename Derived>
11303 if (
Cond.isInvalid())
11305 return getDerived().RebuildOMPNovariantsClause(
11306 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11309template <
typename Derived>
11313 if (
Cond.isInvalid())
11315 return getDerived().RebuildOMPNocontextClause(
11316 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11319template <
typename Derived>
11322 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11323 if (ThreadID.isInvalid())
11325 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11326 C->getLParenLoc(),
C->getEndLoc());
11329template <
typename Derived>
11331 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11334 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11335 C->getLParenLoc(),
C->getEndLoc());
11338template <
typename Derived>
11340 OMPUnifiedAddressClause *
C) {
11341 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11344template <
typename Derived>
11346 OMPUnifiedSharedMemoryClause *
C) {
11348 "unified_shared_memory clause cannot appear in dependent context");
11351template <
typename Derived>
11353 OMPReverseOffloadClause *
C) {
11354 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11357template <
typename Derived>
11359 OMPDynamicAllocatorsClause *
C) {
11361 "dynamic_allocators clause cannot appear in dependent context");
11364template <
typename Derived>
11366 OMPAtomicDefaultMemOrderClause *
C) {
11368 "atomic_default_mem_order clause cannot appear in dependent context");
11371template <
typename Derived>
11374 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11377template <
typename Derived>
11380 C->getBeginLoc(),
C->getLParenLoc(),
11384template <
typename Derived>
11388 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11389 C->getLParenLoc(),
C->getEndLoc());
11392template <
typename Derived>
11395 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11398 return getDerived().RebuildOMPMessageClause(
11399 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11402template <
typename Derived>
11406 Vars.reserve(
C->varlist_size());
11407 for (
auto *
VE :
C->varlist()) {
11409 if (EVar.isInvalid())
11411 Vars.push_back(EVar.get());
11413 return getDerived().RebuildOMPPrivateClause(
11414 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11417template <
typename Derived>
11419 OMPFirstprivateClause *
C) {
11421 Vars.reserve(
C->varlist_size());
11422 for (
auto *
VE :
C->varlist()) {
11424 if (EVar.isInvalid())
11426 Vars.push_back(EVar.get());
11428 return getDerived().RebuildOMPFirstprivateClause(
11429 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11432template <
typename Derived>
11436 Vars.reserve(
C->varlist_size());
11437 for (
auto *
VE :
C->varlist()) {
11439 if (EVar.isInvalid())
11441 Vars.push_back(EVar.get());
11443 return getDerived().RebuildOMPLastprivateClause(
11444 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11445 C->getLParenLoc(),
C->getEndLoc());
11448template <
typename Derived>
11452 Vars.reserve(
C->varlist_size());
11453 for (
auto *
VE :
C->varlist()) {
11455 if (EVar.isInvalid())
11457 Vars.push_back(EVar.get());
11459 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11460 C->getLParenLoc(),
C->getEndLoc());
11463template <
typename Derived>
11467 Vars.reserve(
C->varlist_size());
11468 for (
auto *
VE :
C->varlist()) {
11470 if (EVar.isInvalid())
11472 Vars.push_back(EVar.get());
11475 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11478 if (NameInfo.getName()) {
11479 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11480 if (!NameInfo.getName())
11486 for (
auto *E :
C->reduction_ops()) {
11491 for (
auto *D : ULE->decls()) {
11494 Decls.addDecl(InstD, InstD->getAccess());
11498 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11499 true, Decls.begin(), Decls.end(),
11502 UnresolvedReductions.push_back(
nullptr);
11504 return getDerived().RebuildOMPReductionClause(
11505 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11506 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11507 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11510template <
typename Derived>
11512 OMPTaskReductionClause *
C) {
11514 Vars.reserve(
C->varlist_size());
11515 for (
auto *
VE :
C->varlist()) {
11517 if (EVar.isInvalid())
11519 Vars.push_back(EVar.get());
11522 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11525 if (NameInfo.getName()) {
11526 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11527 if (!NameInfo.getName())
11533 for (
auto *E :
C->reduction_ops()) {
11538 for (
auto *D : ULE->decls()) {
11541 Decls.addDecl(InstD, InstD->getAccess());
11545 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11546 true, Decls.begin(), Decls.end(),
11549 UnresolvedReductions.push_back(
nullptr);
11551 return getDerived().RebuildOMPTaskReductionClause(
11552 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11553 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11556template <
typename Derived>
11560 Vars.reserve(
C->varlist_size());
11561 for (
auto *
VE :
C->varlist()) {
11563 if (EVar.isInvalid())
11565 Vars.push_back(EVar.get());
11568 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11571 if (NameInfo.getName()) {
11572 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11573 if (!NameInfo.getName())
11579 for (
auto *E :
C->reduction_ops()) {
11584 for (
auto *D : ULE->decls()) {
11587 Decls.addDecl(InstD, InstD->getAccess());
11591 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11592 true, Decls.begin(), Decls.end(),
11595 UnresolvedReductions.push_back(
nullptr);
11597 return getDerived().RebuildOMPInReductionClause(
11598 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11599 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11602template <
typename Derived>
11606 Vars.reserve(
C->varlist_size());
11607 for (
auto *
VE :
C->varlist()) {
11609 if (EVar.isInvalid())
11611 Vars.push_back(EVar.get());
11613 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11614 if (Step.isInvalid())
11616 return getDerived().RebuildOMPLinearClause(
11617 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11618 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11622template <
typename Derived>
11626 Vars.reserve(
C->varlist_size());
11627 for (
auto *
VE :
C->varlist()) {
11629 if (EVar.isInvalid())
11631 Vars.push_back(EVar.get());
11633 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11634 if (Alignment.isInvalid())
11636 return getDerived().RebuildOMPAlignedClause(
11637 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11638 C->getColonLoc(),
C->getEndLoc());
11641template <
typename Derived>
11645 Vars.reserve(
C->varlist_size());
11646 for (
auto *
VE :
C->varlist()) {
11648 if (EVar.isInvalid())
11650 Vars.push_back(EVar.get());
11652 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11653 C->getLParenLoc(),
C->getEndLoc());
11656template <
typename Derived>
11660 Vars.reserve(
C->varlist_size());
11661 for (
auto *
VE :
C->varlist()) {
11663 if (EVar.isInvalid())
11665 Vars.push_back(EVar.get());
11667 return getDerived().RebuildOMPCopyprivateClause(
11668 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11671template <
typename Derived>
11674 Vars.reserve(
C->varlist_size());
11675 for (
auto *
VE :
C->varlist()) {
11677 if (EVar.isInvalid())
11679 Vars.push_back(EVar.get());
11681 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11682 C->getLParenLoc(),
C->getEndLoc());
11685template <
typename Derived>
11688 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11691 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11692 C->getLParenLoc(),
C->getEndLoc());
11695template <
typename Derived>
11699 Expr *DepModifier =
C->getModifier();
11701 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11702 if (DepModRes.isInvalid())
11704 DepModifier = DepModRes.get();
11706 Vars.reserve(
C->varlist_size());
11707 for (
auto *
VE :
C->varlist()) {
11709 if (EVar.isInvalid())
11711 Vars.push_back(EVar.get());
11713 return getDerived().RebuildOMPDependClause(
11714 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11715 C->getOmpAllMemoryLoc()},
11716 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11719template <
typename Derived>
11722 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11725 return getDerived().RebuildOMPDeviceClause(
11726 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11727 C->getModifierLoc(),
C->getEndLoc());
11730template <
typename Derived,
class T>
11737 Vars.reserve(
C->varlist_size());
11738 for (
auto *
VE :
C->varlist()) {
11742 Vars.push_back(EVar.
get());
11746 if (
C->getMapperQualifierLoc()) {
11747 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11748 C->getMapperQualifierLoc());
11752 MapperIdScopeSpec.
Adopt(QualifierLoc);
11753 MapperIdInfo =
C->getMapperIdInfo();
11754 if (MapperIdInfo.
getName()) {
11755 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11761 for (
auto *E :
C->mapperlists()) {
11766 for (
auto *D : ULE->decls()) {
11769 Decls.addDecl(InstD, InstD->
getAccess());
11774 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11777 UnresolvedMappers.push_back(
nullptr);
11783template <
typename Derived>
11785 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11787 Expr *IteratorModifier =
C->getIteratorModifier();
11788 if (IteratorModifier) {
11789 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11790 if (MapModRes.isInvalid())
11792 IteratorModifier = MapModRes.
get();
11798 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11800 return getDerived().RebuildOMPMapClause(
11801 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11802 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11803 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11806template <
typename Derived>
11809 Expr *Allocator =
C->getAllocator();
11811 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11812 if (AllocatorRes.isInvalid())
11814 Allocator = AllocatorRes.get();
11816 Expr *Alignment =
C->getAlignment();
11818 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11819 if (AlignmentRes.isInvalid())
11821 Alignment = AlignmentRes.get();
11824 Vars.reserve(
C->varlist_size());
11825 for (
auto *
VE :
C->varlist()) {
11827 if (EVar.isInvalid())
11829 Vars.push_back(EVar.get());
11831 return getDerived().RebuildOMPAllocateClause(
11832 Allocator, Alignment,
C->getFirstAllocateModifier(),
11833 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11834 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11835 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11838template <
typename Derived>
11842 Vars.reserve(
C->varlist_size());
11843 for (
auto *
VE :
C->varlist()) {
11845 if (EVar.isInvalid())
11847 Vars.push_back(EVar.get());
11849 Expr *ModifierExpr =
C->getModifierExpr();
11850 if (ModifierExpr) {
11852 if (EVar.isInvalid())
11854 ModifierExpr = EVar.get();
11856 return getDerived().RebuildOMPNumTeamsClause(
11857 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
11859 C->getLParenLoc(),
C->getEndLoc());
11862template <
typename Derived>
11866 Vars.reserve(
C->varlist_size());
11867 for (
auto *
VE :
C->varlist()) {
11869 if (EVar.isInvalid())
11871 Vars.push_back(EVar.get());
11873 Expr *ModifierExpr =
C->getModifierExpr();
11874 if (ModifierExpr) {
11876 if (EVar.isInvalid())
11878 ModifierExpr = EVar.get();
11880 return getDerived().RebuildOMPThreadLimitClause(
11881 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
11882 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11885template <
typename Derived>
11888 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11891 return getDerived().RebuildOMPPriorityClause(
11892 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11895template <
typename Derived>
11898 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11901 return getDerived().RebuildOMPGrainsizeClause(
11902 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11903 C->getModifierLoc(),
C->getEndLoc());
11906template <
typename Derived>
11909 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11912 return getDerived().RebuildOMPNumTasksClause(
11913 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11914 C->getModifierLoc(),
C->getEndLoc());
11917template <
typename Derived>
11919 ExprResult E = getDerived().TransformExpr(
C->getHint());
11922 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11923 C->getLParenLoc(),
C->getEndLoc());
11926template <
typename Derived>
11928 OMPDistScheduleClause *
C) {
11929 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11932 return getDerived().RebuildOMPDistScheduleClause(
11933 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11934 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11937template <
typename Derived>
11943 C->getDefaultmapKind(),
11946 C->getDefaultmapModifierLoc(),
11947 C->getDefaultmapKindLoc(),
11951template <
typename Derived>
11955 Expr *IteratorModifier =
C->getIteratorModifier();
11956 if (IteratorModifier) {
11957 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11958 if (MapModRes.isInvalid())
11960 IteratorModifier = MapModRes.get();
11966 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11968 return getDerived().RebuildOMPToClause(
11969 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11970 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11971 UnresolvedMappers);
11974template <
typename Derived>
11978 Expr *IteratorModifier =
C->getIteratorModifier();
11979 if (IteratorModifier) {
11980 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11981 if (MapModRes.isInvalid())
11983 IteratorModifier = MapModRes.get();
11989 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11991 return getDerived().RebuildOMPFromClause(
11992 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11993 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11994 UnresolvedMappers);
11997template <
typename Derived>
11999 OMPUseDevicePtrClause *
C) {
12001 Vars.reserve(
C->varlist_size());
12002 for (
auto *
VE :
C->varlist()) {
12004 if (EVar.isInvalid())
12006 Vars.push_back(EVar.get());
12009 return getDerived().RebuildOMPUseDevicePtrClause(
12010 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12013template <
typename Derived>
12015 OMPUseDeviceAddrClause *
C) {
12017 Vars.reserve(
C->varlist_size());
12018 for (
auto *
VE :
C->varlist()) {
12020 if (EVar.isInvalid())
12022 Vars.push_back(EVar.get());
12025 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12028template <
typename Derived>
12032 Vars.reserve(
C->varlist_size());
12033 for (
auto *
VE :
C->varlist()) {
12035 if (EVar.isInvalid())
12037 Vars.push_back(EVar.get());
12040 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12043template <
typename Derived>
12045 OMPHasDeviceAddrClause *
C) {
12047 Vars.reserve(
C->varlist_size());
12048 for (
auto *
VE :
C->varlist()) {
12050 if (EVar.isInvalid())
12052 Vars.push_back(EVar.get());
12055 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12058template <
typename Derived>
12062 Vars.reserve(
C->varlist_size());
12063 for (
auto *
VE :
C->varlist()) {
12065 if (EVar.isInvalid())
12067 Vars.push_back(EVar.get());
12069 return getDerived().RebuildOMPNontemporalClause(
12070 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12073template <
typename Derived>
12077 Vars.reserve(
C->varlist_size());
12078 for (
auto *
VE :
C->varlist()) {
12080 if (EVar.isInvalid())
12082 Vars.push_back(EVar.get());
12084 return getDerived().RebuildOMPInclusiveClause(
12085 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12088template <
typename Derived>
12092 Vars.reserve(
C->varlist_size());
12093 for (
auto *
VE :
C->varlist()) {
12095 if (EVar.isInvalid())
12097 Vars.push_back(EVar.get());
12099 return getDerived().RebuildOMPExclusiveClause(
12100 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12103template <
typename Derived>
12105 OMPUsesAllocatorsClause *
C) {
12107 Data.reserve(
C->getNumberOfAllocators());
12108 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12109 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12111 if (Allocator.isInvalid())
12115 AllocatorTraits = getDerived().TransformExpr(AT);
12116 if (AllocatorTraits.isInvalid())
12120 NewD.Allocator = Allocator.get();
12121 NewD.AllocatorTraits = AllocatorTraits.get();
12125 return getDerived().RebuildOMPUsesAllocatorsClause(
12126 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12129template <
typename Derived>
12133 Locators.reserve(
C->varlist_size());
12135 if (
Expr *Modifier =
C->getModifier()) {
12136 ModifierRes = getDerived().TransformExpr(Modifier);
12137 if (ModifierRes.isInvalid())
12140 for (
Expr *E :
C->varlist()) {
12141 ExprResult Locator = getDerived().TransformExpr(E);
12142 if (Locator.isInvalid())
12144 Locators.push_back(Locator.get());
12146 return getDerived().RebuildOMPAffinityClause(
12147 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12148 ModifierRes.get(), Locators);
12151template <
typename Derived>
12154 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12155 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12158template <
typename Derived>
12161 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12162 C->getLParenLoc(),
C->getEndLoc());
12165template <
typename Derived>
12167 OMPXDynCGroupMemClause *
C) {
12169 if (
Size.isInvalid())
12171 return getDerived().RebuildOMPXDynCGroupMemClause(
12172 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12175template <
typename Derived>
12177 OMPDynGroupprivateClause *
C) {
12179 if (
Size.isInvalid())
12181 return getDerived().RebuildOMPDynGroupprivateClause(
12182 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12183 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12184 C->getDynGroupprivateModifierLoc(),
12185 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12188template <
typename Derived>
12192 Vars.reserve(
C->varlist_size());
12193 for (
auto *
VE :
C->varlist()) {
12195 if (EVar.isInvalid())
12197 Vars.push_back(EVar.get());
12199 return getDerived().RebuildOMPDoacrossClause(
12200 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12201 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12204template <
typename Derived>
12208 for (
auto *A :
C->getAttrs())
12209 NewAttrs.push_back(getDerived().TransformAttr(A));
12210 return getDerived().RebuildOMPXAttributeClause(
12211 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12214template <
typename Derived>
12223template <
typename Derived>
12224class OpenACCClauseTransform final
12226 TreeTransform<Derived> &Self;
12227 ArrayRef<const OpenACCClause *> ExistingClauses;
12228 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12229 OpenACCClause *NewClause =
nullptr;
12232 ExprResult Res = Self.TransformExpr(VarRef);
12234 if (!Res.isUsable())
12237 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12238 ParsedClause.getClauseKind(),
12244 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12245 llvm::SmallVector<Expr *> InstantiatedVarList;
12246 for (Expr *CurVar : VarList) {
12249 if (VarRef.isUsable())
12250 InstantiatedVarList.push_back(VarRef.get());
12253 return InstantiatedVarList;
12257 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12258 ArrayRef<const OpenACCClause *> ExistingClauses,
12259 SemaOpenACC::OpenACCParsedClause &PC)
12260 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12262 OpenACCClause *CreatedClause()
const {
return NewClause; }
12264#define VISIT_CLAUSE(CLAUSE_NAME) \
12265 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12266#include "clang/Basic/OpenACCClauses.def"
12269template <
typename Derived>
12270void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12272 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12275 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12276 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12277 ParsedClause.getEndLoc());
12280template <
typename Derived>
12281void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12283 assert(
Cond &&
"If constructed with invalid Condition");
12287 if (Res.isInvalid() || !Res.get().second)
12290 ParsedClause.setConditionDetails(Res.get().second);
12293 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12294 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12295 ParsedClause.getEndLoc());
12298template <
typename Derived>
12299void OpenACCClauseTransform<Derived>::VisitSelfClause(
12305 for (
Expr *CurVar :
C.getVarList()) {
12308 if (!Res.isUsable())
12311 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12312 ParsedClause.getClauseKind(),
12315 if (Res.isUsable())
12316 InstantiatedVarList.push_back(Res.get());
12319 ParsedClause.setVarListDetails(InstantiatedVarList,
12323 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12324 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12325 ParsedClause.getEndLoc());
12328 if (
C.hasConditionExpr()) {
12331 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12334 if (Res.isInvalid() || !Res.get().second)
12337 ParsedClause.setConditionDetails(Res.get().second);
12341 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12342 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12343 ParsedClause.getEndLoc());
12347template <
typename Derived>
12348void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12352 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12355 if (!Res.isUsable())
12360 C.getBeginLoc(), Res.get());
12361 if (!Res.isUsable())
12364 InstantiatedIntExprs.push_back(Res.get());
12367 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12369 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12370 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12371 ParsedClause.getEndLoc());
12374template <
typename Derived>
12375void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12380 for (
const auto [RefExpr, InitRecipe] :
12381 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12384 if (VarRef.isUsable()) {
12385 InstantiatedVarList.push_back(VarRef.get());
12389 if (InitRecipe.isSet())
12390 InitRecipes.push_back(InitRecipe);
12392 InitRecipes.push_back(
12393 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12396 ParsedClause.setVarListDetails(InstantiatedVarList,
12400 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12401 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12402 ParsedClause.getEndLoc());
12405template <
typename Derived>
12406void OpenACCClauseTransform<Derived>::VisitHostClause(
12408 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12412 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12413 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12414 ParsedClause.getEndLoc());
12417template <
typename Derived>
12418void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12420 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12424 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12425 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12426 ParsedClause.getEndLoc());
12429template <
typename Derived>
12430void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12435 for (
const auto [RefExpr, InitRecipe] :
12436 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12439 if (VarRef.isUsable()) {
12440 InstantiatedVarList.push_back(VarRef.get());
12444 if (InitRecipe.isSet())
12445 InitRecipes.push_back(InitRecipe);
12447 InitRecipes.push_back(
12448 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12452 ParsedClause.setVarListDetails(InstantiatedVarList,
12456 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12457 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12458 ParsedClause.getEndLoc());
12461template <
typename Derived>
12462void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12464 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12468 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12469 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12470 ParsedClause.getEndLoc());
12473template <
typename Derived>
12474void OpenACCClauseTransform<Derived>::VisitPresentClause(
12476 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12480 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12481 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12482 ParsedClause.getEndLoc());
12485template <
typename Derived>
12486void OpenACCClauseTransform<Derived>::VisitCopyClause(
12488 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12489 C.getModifierList());
12492 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12493 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12494 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12495 ParsedClause.getEndLoc());
12498template <
typename Derived>
12499void OpenACCClauseTransform<Derived>::VisitLinkClause(
12501 llvm_unreachable(
"link clause not valid unless a decl transform");
12504template <
typename Derived>
12505void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12507 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12509template <
typename Derived>
12510void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12512 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12514template <
typename Derived>
12515void OpenACCClauseTransform<Derived>::VisitBindClause(
12517 llvm_unreachable(
"bind clause not valid unless a decl transform");
12520template <
typename Derived>
12521void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12523 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12524 C.getModifierList());
12527 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12528 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12529 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12530 ParsedClause.getEndLoc());
12533template <
typename Derived>
12534void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12536 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12537 C.getModifierList());
12540 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12541 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12542 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12543 ParsedClause.getEndLoc());
12546template <
typename Derived>
12547void OpenACCClauseTransform<Derived>::VisitCreateClause(
12549 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12550 C.getModifierList());
12553 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12554 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12555 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12556 ParsedClause.getEndLoc());
12558template <
typename Derived>
12559void OpenACCClauseTransform<Derived>::VisitAttachClause(
12564 llvm::erase_if(VarList, [&](
Expr *E) {
12565 return Self.getSema().OpenACC().CheckVarIsPointerType(
12571 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12572 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12573 ParsedClause.getEndLoc());
12576template <
typename Derived>
12577void OpenACCClauseTransform<Derived>::VisitDetachClause(
12582 llvm::erase_if(VarList, [&](
Expr *E) {
12583 return Self.getSema().OpenACC().CheckVarIsPointerType(
12589 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12590 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12591 ParsedClause.getEndLoc());
12594template <
typename Derived>
12595void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12597 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12600 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12601 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12602 ParsedClause.getEndLoc());
12605template <
typename Derived>
12606void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12608 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12611 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12612 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12613 ParsedClause.getEndLoc());
12616template <
typename Derived>
12617void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12622 llvm::erase_if(VarList, [&](
Expr *E) {
12623 return Self.getSema().OpenACC().CheckVarIsPointerType(
12629 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12630 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12631 ParsedClause.getEndLoc());
12634template <
typename Derived>
12635void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12637 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12638 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12641 if (!Res.isUsable())
12646 C.getBeginLoc(), Res.get());
12647 if (!Res.isUsable())
12650 ParsedClause.setIntExprDetails(Res.get());
12652 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12653 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12654 ParsedClause.getEndLoc());
12657template <
typename Derived>
12658void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12660 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12661 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12664 if (!Res.isUsable())
12669 C.getBeginLoc(), Res.get());
12670 if (!Res.isUsable())
12673 ParsedClause.setIntExprDetails(Res.get());
12675 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12676 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12677 ParsedClause.getEndLoc());
12680template <
typename Derived>
12681void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12683 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12684 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12687 if (!Res.isUsable())
12692 C.getBeginLoc(), Res.get());
12693 if (!Res.isUsable())
12696 ParsedClause.setIntExprDetails(Res.get());
12698 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12699 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12700 ParsedClause.getEndLoc());
12703template <
typename Derived>
12704void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12706 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12707 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12710 if (!Res.isUsable())
12715 C.getBeginLoc(), Res.get());
12716 if (!Res.isUsable())
12719 ParsedClause.setIntExprDetails(Res.get());
12721 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12722 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12723 ParsedClause.getEndLoc());
12726template <
typename Derived>
12727void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12729 if (
C.hasIntExpr()) {
12731 if (!Res.isUsable())
12736 C.getBeginLoc(), Res.get());
12737 if (!Res.isUsable())
12739 ParsedClause.setIntExprDetails(Res.get());
12743 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12744 ParsedClause.getLParenLoc(),
12745 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12747 ParsedClause.getEndLoc());
12750template <
typename Derived>
12751void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12753 if (
C.hasIntExpr()) {
12758 if (!Res.isUsable())
12763 C.getBeginLoc(), Res.get());
12764 if (!Res.isUsable())
12766 ParsedClause.setIntExprDetails(Res.get());
12770 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12771 ParsedClause.getLParenLoc(),
12772 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12774 ParsedClause.getEndLoc());
12777template <
typename Derived>
12778void OpenACCClauseTransform<Derived>::VisitVectorClause(
12780 if (
C.hasIntExpr()) {
12785 if (!Res.isUsable())
12790 C.getBeginLoc(), Res.get());
12791 if (!Res.isUsable())
12793 ParsedClause.setIntExprDetails(Res.get());
12797 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12798 ParsedClause.getLParenLoc(),
12799 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12801 ParsedClause.getEndLoc());
12804template <
typename Derived>
12805void OpenACCClauseTransform<Derived>::VisitWaitClause(
12807 if (
C.hasExprs()) {
12808 Expr *DevNumExpr =
nullptr;
12812 if (
C.getDevNumExpr()) {
12814 if (!Res.isUsable())
12818 C.getBeginLoc(), Res.get());
12819 if (!Res.isUsable())
12822 DevNumExpr = Res.get();
12826 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12828 if (!Res.isUsable())
12832 C.getBeginLoc(), Res.get());
12833 if (!Res.isUsable())
12836 InstantiatedQueueIdExprs.push_back(Res.get());
12839 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12840 std::move(InstantiatedQueueIdExprs));
12844 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12845 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12846 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12847 ParsedClause.getEndLoc());
12850template <
typename Derived>
12851void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12855 Self.getSema().getASTContext(),
C.getClauseKind(),
12856 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12857 C.getArchitectures(), ParsedClause.getEndLoc());
12860template <
typename Derived>
12861void OpenACCClauseTransform<Derived>::VisitAutoClause(
12865 ParsedClause.getBeginLoc(),
12866 ParsedClause.getEndLoc());
12869template <
typename Derived>
12870void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12873 ParsedClause.getBeginLoc(),
12874 ParsedClause.getEndLoc());
12877template <
typename Derived>
12878void OpenACCClauseTransform<Derived>::VisitSeqClause(
12881 ParsedClause.getBeginLoc(),
12882 ParsedClause.getEndLoc());
12884template <
typename Derived>
12885void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12888 ParsedClause.getBeginLoc(),
12889 ParsedClause.getEndLoc());
12892template <
typename Derived>
12893void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12896 ParsedClause.getBeginLoc(),
12897 ParsedClause.getEndLoc());
12900template <
typename Derived>
12901void OpenACCClauseTransform<Derived>::VisitReductionClause(
12907 for (
const auto [Var, OrigRecipe] :
12908 llvm::zip(TransformedVars,
C.getRecipes())) {
12910 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12911 if (Res.isUsable()) {
12912 ValidVars.push_back(Res.get());
12914 if (OrigRecipe.isSet())
12915 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12917 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12918 C.getReductionOp(), Res.get()));
12922 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12923 ExistingClauses, ParsedClause.getDirectiveKind(),
12924 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12925 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12928template <
typename Derived>
12929void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12931 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12932 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12936 if (!NewLoopCount.isUsable())
12939 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12941 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12945 if (!NewLoopCount.isUsable())
12949 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12953 if (!NewLoopCount.isUsable())
12956 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12958 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12959 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12960 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12963template <
typename Derived>
12964void OpenACCClauseTransform<Derived>::VisitTileClause(
12969 for (
Expr *E :
C.getSizeExprs()) {
12972 if (!NewSizeExpr.isUsable())
12975 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12977 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12981 if (!NewSizeExpr.isUsable())
12984 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12986 if (!NewSizeExpr.isUsable())
12988 TransformedExprs.push_back(NewSizeExpr.get());
12991 ParsedClause.setIntExprDetails(TransformedExprs);
12993 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12994 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12995 ParsedClause.getEndLoc());
12997template <
typename Derived>
12998void OpenACCClauseTransform<Derived>::VisitGangClause(
13003 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13005 if (!ER.isUsable())
13008 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13009 ParsedClause.getDirectiveKind(),
13010 C.getExpr(I).first, ER.get());
13011 if (!ER.isUsable())
13013 TransformedGangKinds.push_back(
C.getExpr(I).first);
13014 TransformedIntExprs.push_back(ER.get());
13017 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13018 ParsedClause.getDirectiveKind(), ExistingClauses,
13019 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13020 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13023template <
typename Derived>
13024OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13029 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13030 ParsedClause.setEndLoc(OldClause->getEndLoc());
13032 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13033 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13035 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13037 Transform.Visit(OldClause);
13039 return Transform.CreatedClause();
13042template <
typename Derived>
13044TreeTransform<Derived>::TransformOpenACCClauseList(
13047 for (
const auto *Clause : OldClauses) {
13048 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13049 TransformedClauses, DirKind, Clause))
13050 TransformedClauses.push_back(TransformedClause);
13052 return TransformedClauses;
13055template <
typename Derived>
13058 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13061 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13064 if (getSema().OpenACC().ActOnStartStmtDirective(
13065 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13070 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13071 C->clauses(), TransformedClauses);
13072 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13073 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13074 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13076 return getDerived().RebuildOpenACCComputeConstruct(
13077 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13078 C->getEndLoc(), TransformedClauses, StrBlock);
13081template <
typename Derived>
13085 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13088 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13091 if (getSema().OpenACC().ActOnStartStmtDirective(
13092 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13097 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13098 C->clauses(), TransformedClauses);
13100 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13101 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13103 return getDerived().RebuildOpenACCLoopConstruct(
13104 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13105 TransformedClauses,
Loop);
13108template <
typename Derived>
13110 OpenACCCombinedConstruct *
C) {
13111 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13114 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13117 if (getSema().OpenACC().ActOnStartStmtDirective(
13118 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13123 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13124 C->clauses(), TransformedClauses);
13126 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13127 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13129 return getDerived().RebuildOpenACCCombinedConstruct(
13130 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13131 C->getEndLoc(), TransformedClauses,
Loop);
13134template <
typename Derived>
13137 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13140 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13142 if (getSema().OpenACC().ActOnStartStmtDirective(
13143 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13147 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13148 C->clauses(), TransformedClauses);
13149 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13150 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13151 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13153 return getDerived().RebuildOpenACCDataConstruct(
13154 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13155 TransformedClauses, StrBlock);
13158template <
typename Derived>
13160 OpenACCEnterDataConstruct *
C) {
13161 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13164 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13166 if (getSema().OpenACC().ActOnStartStmtDirective(
13167 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13170 return getDerived().RebuildOpenACCEnterDataConstruct(
13171 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13172 TransformedClauses);
13175template <
typename Derived>
13177 OpenACCExitDataConstruct *
C) {
13178 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13181 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13183 if (getSema().OpenACC().ActOnStartStmtDirective(
13184 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13187 return getDerived().RebuildOpenACCExitDataConstruct(
13188 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13189 TransformedClauses);
13192template <
typename Derived>
13194 OpenACCHostDataConstruct *
C) {
13195 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13198 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13200 if (getSema().OpenACC().ActOnStartStmtDirective(
13201 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13205 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13206 C->clauses(), TransformedClauses);
13207 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13208 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13209 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13211 return getDerived().RebuildOpenACCHostDataConstruct(
13212 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13213 TransformedClauses, StrBlock);
13216template <
typename Derived>
13219 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13222 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13224 if (getSema().OpenACC().ActOnStartStmtDirective(
13225 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13228 return getDerived().RebuildOpenACCInitConstruct(
13229 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13230 TransformedClauses);
13233template <
typename Derived>
13235 OpenACCShutdownConstruct *
C) {
13236 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13239 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13241 if (getSema().OpenACC().ActOnStartStmtDirective(
13242 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13245 return getDerived().RebuildOpenACCShutdownConstruct(
13246 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13247 TransformedClauses);
13249template <
typename Derived>
13252 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13255 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13257 if (getSema().OpenACC().ActOnStartStmtDirective(
13258 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13261 return getDerived().RebuildOpenACCSetConstruct(
13262 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13263 TransformedClauses);
13266template <
typename Derived>
13268 OpenACCUpdateConstruct *
C) {
13269 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13272 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13274 if (getSema().OpenACC().ActOnStartStmtDirective(
13275 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13278 return getDerived().RebuildOpenACCUpdateConstruct(
13279 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13280 TransformedClauses);
13283template <
typename Derived>
13286 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13289 if (
C->hasDevNumExpr()) {
13290 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13292 if (DevNumExpr.isUsable())
13293 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13295 C->getBeginLoc(), DevNumExpr.get());
13300 for (
Expr *QE :
C->getQueueIdExprs()) {
13301 assert(QE &&
"Null queue id expr?");
13302 ExprResult NewEQ = getDerived().TransformExpr(QE);
13304 if (!NewEQ.isUsable())
13308 C->getBeginLoc(), NewEQ.get());
13309 if (NewEQ.isUsable())
13310 QueueIdExprs.push_back(NewEQ.get());
13314 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13317 if (getSema().OpenACC().ActOnStartStmtDirective(
13318 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13321 return getDerived().RebuildOpenACCWaitConstruct(
13322 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13323 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13324 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13326template <
typename Derived>
13328 OpenACCCacheConstruct *
C) {
13329 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13332 for (
Expr *Var :
C->getVarList()) {
13333 assert(Var &&
"Null var listexpr?");
13335 ExprResult NewVar = getDerived().TransformExpr(Var);
13337 if (!NewVar.isUsable())
13340 NewVar = getSema().OpenACC().ActOnVar(
13342 if (!NewVar.isUsable())
13345 TransformedVarList.push_back(NewVar.get());
13348 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13349 C->getBeginLoc(), {}))
13352 return getDerived().RebuildOpenACCCacheConstruct(
13353 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13354 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13358template <
typename Derived>
13360 OpenACCAtomicConstruct *
C) {
13361 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13364 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13367 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13368 C->getBeginLoc(), {}))
13373 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13375 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13376 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13377 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13380 return getDerived().RebuildOpenACCAtomicConstruct(
13381 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13382 C->getEndLoc(), TransformedClauses, AssocStmt);
13385template <
typename Derived>
13388 if (getDerived().AlwaysRebuild())
13397template<
typename Derived>
13400 return TransformExpr(E->getSubExpr());
13403template <
typename Derived>
13406 if (!E->isTypeDependent())
13409 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13414 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13417 return getDerived().RebuildSYCLUniqueStableNameExpr(
13418 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13421template <
typename Derived>
13425 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13426 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13429 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13430 if (IdExpr.isInvalid())
13433 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13434 if (Body.isInvalid())
13440 if (SR.isInvalid())
13446template <
typename Derived>
13449 assert(
false &&
"not implemented yet");
13453template<
typename Derived>
13456 if (!E->isTypeDependent())
13460 E->getIdentKind());
13463template<
typename Derived>
13467 if (E->getQualifierLoc()) {
13469 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13475 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13477 if (!ND || ND->isInvalidDecl())
13481 if (E->getFoundDecl() != E->getDecl()) {
13482 Found = cast_or_null<NamedDecl>(
13483 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13489 if (NameInfo.getName()) {
13490 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13491 if (!NameInfo.getName())
13495 if (!getDerived().AlwaysRebuild() &&
13496 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13497 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13498 Found == E->getFoundDecl() &&
13499 NameInfo.getName() == E->getDecl()->getDeclName() &&
13500 !E->hasExplicitTemplateArgs()) {
13510 if (E->hasExplicitTemplateArgs()) {
13511 TemplateArgs = &TransArgs;
13512 TransArgs.setLAngleLoc(E->getLAngleLoc());
13513 TransArgs.setRAngleLoc(E->getRAngleLoc());
13514 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13515 E->getNumTemplateArgs(),
13520 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13521 Found, TemplateArgs);
13524template<
typename Derived>
13530template <
typename Derived>
13536template<
typename Derived>
13542template<
typename Derived>
13548template<
typename Derived>
13554template<
typename Derived>
13560template<
typename Derived>
13563 return getDerived().TransformCallExpr(E);
13566template<
typename Derived>
13571 if (E->isExprPredicate())
13572 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13574 ControllingType = getDerived().TransformType(E->getControllingType());
13576 if (ControllingExpr.isInvalid() && !ControllingType)
13587 AssocTypes.push_back(AssocType);
13589 AssocTypes.push_back(
nullptr);
13593 getDerived().TransformExpr(Assoc.getAssociationExpr());
13594 if (AssocExpr.isInvalid())
13596 AssocExprs.push_back(AssocExpr.get());
13599 if (!ControllingType)
13600 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13601 E->getDefaultLoc(),
13603 ControllingExpr.get(),
13606 return getDerived().RebuildGenericSelectionExpr(
13607 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13608 ControllingType, AssocTypes, AssocExprs);
13611template<
typename Derived>
13614 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13615 if (SubExpr.isInvalid())
13618 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13621 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13628template<
typename Derived>
13632 return getDerived().TransformDependentScopeDeclRefExpr(
13633 DRE,
true,
nullptr);
13635 return getDerived().TransformUnresolvedLookupExpr(
13641template<
typename Derived>
13646 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13652 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13660template<
typename Derived>
13662TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13664 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13674 bool ExprChanged =
false;
13676 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13677 const OffsetOfNode &ON = E->getComponent(I);
13678 switch (ON.getKind()) {
13680 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13681 ExprResult Index = getDerived().TransformExpr(FromIndex);
13682 if (Index.isInvalid())
13685 ExprChanged = ExprChanged || Index.get() != FromIndex;
13688 AD.setRBracketLoc(ON.getEndLoc());
13689 Desig.AddDesignator(AD);
13701 Desig.AddDesignator(
13713 if (!getDerived().AlwaysRebuild() &&
13714 Type == E->getTypeSourceInfo() &&
13719 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13720 E->getRParenLoc());
13723template<
typename Derived>
13726 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13727 "opaque value expression requires transformation");
13731template <
typename Derived>
13735 for (
Expr *
C : E->subExpressions()) {
13737 if (NewC.isInvalid())
13743 if (!getDerived().AlwaysRebuild() && !Changed)
13745 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13749template<
typename Derived>
13759 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13760 if (result.isInvalid())
return ExprError();
13765 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13771template<
typename Derived>
13775 if (E->isArgumentType()) {
13782 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13785 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13787 E->getSourceRange());
13801 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13803 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13804 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13805 PE, DRE,
false, &RecoveryTSI);
13807 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13810 return getDerived().RebuildUnaryExprOrTypeTrait(
13811 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13812 }
else if (SubExpr.isInvalid())
13815 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13818 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13819 E->getOperatorLoc(),
13821 E->getSourceRange());
13824template<
typename Derived>
13827 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13828 if (LHS.isInvalid())
13831 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13832 if (RHS.isInvalid())
13836 if (!getDerived().AlwaysRebuild() &&
13837 LHS.get() == E->getLHS() &&
13838 RHS.get() == E->getRHS())
13841 return getDerived().RebuildArraySubscriptExpr(
13843 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13846template <
typename Derived>
13850 if (
Base.isInvalid())
13853 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13854 if (RowIdx.isInvalid())
13857 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13858 RowIdx.get() == E->getRowIdx())
13861 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13862 E->getRBracketLoc());
13865template <
typename Derived>
13869 if (
Base.isInvalid())
13872 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13873 if (RowIdx.isInvalid())
13876 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13877 if (ColumnIdx.isInvalid())
13880 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13881 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13884 return getDerived().RebuildMatrixSubscriptExpr(
13885 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13888template <
typename Derived>
13892 if (
Base.isInvalid())
13896 if (E->getLowerBound()) {
13897 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13898 if (LowerBound.isInvalid())
13903 if (E->getLength()) {
13904 Length = getDerived().TransformExpr(E->getLength());
13905 if (Length.isInvalid())
13910 if (E->isOMPArraySection()) {
13911 if (
Expr *Str = E->getStride()) {
13912 Stride = getDerived().TransformExpr(Str);
13913 if (Stride.isInvalid())
13918 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13919 LowerBound.get() == E->getLowerBound() &&
13920 Length.get() == E->getLength() &&
13921 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13924 return getDerived().RebuildArraySectionExpr(
13925 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13926 LowerBound.get(), E->getColonLocFirst(),
13927 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13928 Length.get(), Stride.get(), E->getRBracketLoc());
13931template <
typename Derived>
13935 if (
Base.isInvalid())
13939 bool ErrorFound =
false;
13940 for (
Expr *
Dim : E->getDimensions()) {
13942 if (DimRes.isInvalid()) {
13946 Dims.push_back(DimRes.get());
13951 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13952 E->getRParenLoc(), Dims,
13953 E->getBracketsRanges());
13956template <
typename Derived>
13959 unsigned NumIterators = E->numOfIterators();
13962 bool ErrorFound =
false;
13963 bool NeedToRebuild = getDerived().AlwaysRebuild();
13964 for (
unsigned I = 0; I < NumIterators; ++I) {
13966 Data[I].DeclIdent = D->getIdentifier();
13967 Data[I].DeclIdentLoc = D->getLocation();
13968 if (D->getLocation() == D->getBeginLoc()) {
13970 "Implicit type must be int.");
13972 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13973 QualType DeclTy = getDerived().TransformType(D->getType());
13980 ErrorFound = ErrorFound ||
13981 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13982 !
Data[I].Type.get().isNull())) ||
13983 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13986 Data[I].Range.Begin = Begin.get();
13987 Data[I].Range.End = End.get();
13988 Data[I].Range.Step = Step.get();
13989 Data[I].AssignLoc = E->getAssignLoc(I);
13990 Data[I].ColonLoc = E->getColonLoc(I);
13991 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13994 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13995 D->getType().getTypePtrOrNull()) ||
14001 if (!NeedToRebuild)
14004 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14005 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14006 if (!Res.isUsable())
14009 for (
unsigned I = 0; I < NumIterators; ++I)
14010 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14011 IE->getIteratorDecl(I));
14015template<
typename Derived>
14024 bool ArgChanged =
false;
14026 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14030 if (!getDerived().AlwaysRebuild() &&
14031 Callee.get() == E->getCallee() &&
14037 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14040 if (E->hasStoredFPFeatures()) {
14042 getSema().CurFPFeatures =
14044 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14047 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14049 E->getRParenLoc());
14052template<
typename Derived>
14056 if (
Base.isInvalid())
14060 if (E->hasQualifier()) {
14062 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14070 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14071 E->getMemberDecl()));
14075 NamedDecl *FoundDecl = E->getFoundDecl();
14076 if (FoundDecl == E->getMemberDecl()) {
14079 FoundDecl = cast_or_null<NamedDecl>(
14080 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14085 if (!getDerived().AlwaysRebuild() &&
14086 Base.get() == E->getBase() &&
14087 QualifierLoc == E->getQualifierLoc() &&
14088 Member == E->getMemberDecl() &&
14089 FoundDecl == E->getFoundDecl() &&
14090 !E->hasExplicitTemplateArgs()) {
14095 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14105 if (E->hasExplicitTemplateArgs()) {
14106 TransArgs.setLAngleLoc(E->getLAngleLoc());
14107 TransArgs.setRAngleLoc(E->getRAngleLoc());
14108 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14109 E->getNumTemplateArgs(),
14122 NamedDecl *FirstQualifierInScope =
nullptr;
14124 if (MemberNameInfo.getName()) {
14125 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14126 if (!MemberNameInfo.getName())
14130 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14137 (E->hasExplicitTemplateArgs()
14138 ? &TransArgs :
nullptr),
14139 FirstQualifierInScope);
14142template<
typename Derived>
14145 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14146 if (LHS.isInvalid())
14150 getDerived().TransformInitializer(E->getRHS(),
false);
14151 if (RHS.isInvalid())
14154 if (!getDerived().AlwaysRebuild() &&
14155 LHS.get() == E->getLHS() &&
14156 RHS.get() == E->getRHS())
14159 if (E->isCompoundAssignmentOp())
14161 return getDerived().RebuildBinaryOperator(
14162 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14165 getSema().CurFPFeatures =
14166 NewOverrides.applyOverrides(getSema().getLangOpts());
14167 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14168 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14169 LHS.get(), RHS.get());
14172template <
typename Derived>
14177 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14178 if (LHS.isInvalid())
14181 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14182 if (RHS.isInvalid())
14188 bool ChangedAnyLookups =
false;
14189 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14190 const_cast<Expr *
>(Decomp.InnerBinOp)};
14191 for (
Expr *PossibleBinOp : PossibleBinOps) {
14192 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14195 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14201 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14202 E->getOperatorLoc(),
Callee->getFoundDecl()));
14206 ChangedAnyLookups =
true;
14207 UnqualLookups.addDecl(
Found);
14210 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14211 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14217 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14222 return getDerived().RebuildCXXRewrittenBinaryOperator(
14223 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14226template<
typename Derived>
14232 getSema().CurFPFeatures =
14233 NewOverrides.applyOverrides(getSema().getLangOpts());
14234 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14235 return getDerived().TransformBinaryOperator(E);
14238template<
typename Derived>
14244 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14245 if (commonExpr.isInvalid())
14248 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14249 if (rhs.isInvalid())
14252 if (!getDerived().AlwaysRebuild() &&
14253 commonExpr.get() == e->getCommon() &&
14254 rhs.get() == e->getFalseExpr())
14257 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14258 e->getQuestionLoc(),
14264template<
typename Derived>
14268 if (
Cond.isInvalid())
14271 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14272 if (LHS.isInvalid())
14275 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14276 if (RHS.isInvalid())
14279 if (!getDerived().AlwaysRebuild() &&
14280 Cond.get() == E->getCond() &&
14281 LHS.get() == E->getLHS() &&
14282 RHS.get() == E->getRHS())
14285 return getDerived().RebuildConditionalOperator(
Cond.get(),
14286 E->getQuestionLoc(),
14292template<
typename Derived>
14297 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14300template<
typename Derived>
14308 = getDerived().TransformExpr(E->getSubExprAsWritten());
14309 if (SubExpr.isInvalid())
14312 if (!getDerived().AlwaysRebuild() &&
14313 Type == E->getTypeInfoAsWritten() &&
14314 SubExpr.get() == E->getSubExpr())
14317 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14323template<
typename Derived>
14331 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14332 if (
Init.isInvalid())
14335 if (!getDerived().AlwaysRebuild() &&
14337 Init.get() == E->getInitializer())
14344 return getDerived().RebuildCompoundLiteralExpr(
14345 E->getLParenLoc(), NewT,
14346 E->getInitializer()->getEndLoc(),
Init.get());
14349template<
typename Derived>
14353 if (
Base.isInvalid())
14356 if (!getDerived().AlwaysRebuild() &&
14357 Base.get() == E->getBase())
14363 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14364 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14368template <
typename Derived>
14372 if (
Base.isInvalid())
14375 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14381 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14382 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14386template<
typename Derived>
14392 bool InitChanged =
false;
14398 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14399 Inits, &InitChanged))
14402 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14409 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14410 E->getRBraceLoc(), E->isExplicit());
14413template<
typename Derived>
14420 if (
Init.isInvalid())
14425 bool ExprChanged =
false;
14427 if (D.isFieldDesignator()) {
14428 if (D.getFieldDecl()) {
14430 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14431 if (Field != D.getFieldDecl())
14434 ExprChanged =
true;
14435 if (
Field->isAnonymousStructOrUnion())
14441 ExprChanged =
true;
14444 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14448 if (D.isArrayDesignator()) {
14449 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14450 if (Index.isInvalid())
14453 Desig.AddDesignator(
14456 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14457 ArrayExprs.push_back(Index.get());
14461 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14463 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14464 if (Start.isInvalid())
14467 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14468 if (End.isInvalid())
14472 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14474 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14475 End.get() != E->getArrayRangeEnd(D);
14477 ArrayExprs.push_back(Start.get());
14478 ArrayExprs.push_back(End.get());
14481 if (!getDerived().AlwaysRebuild() &&
14482 Init.get() == E->getInit() &&
14486 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14487 E->getEqualOrColonLoc(),
14488 E->usesGNUSyntax(),
Init.get());
14493template<
typename Derived>
14497 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14502template<
typename Derived>
14506 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14510template<
typename Derived>
14513 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14517template<
typename Derived>
14520 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14524template<
typename Derived>
14532 QualType T = getDerived().TransformType(E->getType());
14536 if (!getDerived().AlwaysRebuild() &&
14540 return getDerived().RebuildImplicitValueInitExpr(
T);
14543template<
typename Derived>
14546 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14550 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14551 if (SubExpr.isInvalid())
14554 if (!getDerived().AlwaysRebuild() &&
14555 TInfo == E->getWrittenTypeInfo() &&
14556 SubExpr.get() == E->getSubExpr())
14559 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14560 TInfo, E->getRParenLoc());
14563template<
typename Derived>
14566 bool ArgumentChanged =
false;
14568 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14572 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14574 E->getRParenLoc());
14582template<
typename Derived>
14585 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14590 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14594template<
typename Derived>
14599 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14600 if (SubStmt.isInvalid()) {
14605 unsigned OldDepth = E->getTemplateDepth();
14606 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14608 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14609 SubStmt.get() == E->getSubStmt()) {
14615 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14616 E->getRParenLoc(), NewDepth);
14619template<
typename Derived>
14623 if (
Cond.isInvalid())
14626 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14627 if (LHS.isInvalid())
14630 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14631 if (RHS.isInvalid())
14634 if (!getDerived().AlwaysRebuild() &&
14635 Cond.get() == E->getCond() &&
14636 LHS.get() == E->getLHS() &&
14637 RHS.get() == E->getRHS())
14640 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14641 Cond.get(), LHS.get(), RHS.get(),
14642 E->getRParenLoc());
14645template<
typename Derived>
14651template<
typename Derived>
14654 switch (E->getOperator()) {
14658 case OO_Array_Delete:
14659 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14664 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14677 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14678 FakeLParenLoc = EndLoc;
14682 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14686 if (E->getOperator() == OO_Subscript)
14687 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14688 Args, E->getEndLoc());
14690 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14694#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14698#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14699#include "clang/Basic/OperatorKinds.def"
14701 case OO_Conditional:
14702 llvm_unreachable(
"conditional operator is not actually overloadable");
14706 llvm_unreachable(
"not an overloaded operator?");
14710 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14711 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14713 First = getDerived().TransformExpr(E->getArg(0));
14714 if (
First.isInvalid())
14718 if (E->getNumArgs() == 2) {
14720 getDerived().TransformInitializer(E->getArg(1),
false);
14721 if (Second.isInvalid())
14727 getSema().CurFPFeatures =
14728 NewOverrides.applyOverrides(getSema().getLangOpts());
14729 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14735 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14738 return getDerived().RebuildCXXOperatorCallExpr(
14739 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14740 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14745 Callee = ICE->getSubExprAsWritten();
14747 ValueDecl *VD = cast_or_null<ValueDecl>(
14748 getDerived().TransformDecl(DR->getLocation(), DR));
14753 Functions.addDecl(VD);
14755 return getDerived().RebuildCXXOperatorCallExpr(
14756 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14757 false, Functions,
First.get(), Second.get());
14760template<
typename Derived>
14763 return getDerived().TransformCallExpr(E);
14766template <
typename Derived>
14769 getSema().CurContext != E->getParentContext();
14771 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14774 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14775 E->getBeginLoc(), E->getEndLoc(),
14776 getSema().CurContext);
14779template <
typename Derived>
14784template<
typename Derived>
14793 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14794 if (EC.isInvalid())
14798 bool ArgChanged =
false;
14800 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14804 if (!getDerived().AlwaysRebuild() &&
14805 Callee.get() == E->getCallee() &&
14811 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14812 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14814 E->getRParenLoc(), EC.get());
14817template<
typename Derived>
14833 return getDerived().RebuildCXXNamedCastExpr(
14840template<
typename Derived>
14849 if (Sub.isInvalid())
14852 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14856template<
typename Derived>
14858TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14859 return getDerived().TransformCXXNamedCastExpr(E);
14862template<
typename Derived>
14868template<
typename Derived>
14875template<
typename Derived>
14881template<
typename Derived>
14887template<
typename Derived>
14892 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14897 = getDerived().TransformExpr(E->getSubExprAsWritten());
14898 if (SubExpr.isInvalid())
14901 if (!getDerived().AlwaysRebuild() &&
14902 Type == E->getTypeInfoAsWritten() &&
14903 SubExpr.get() == E->getSubExpr())
14906 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14910 E->isListInitialization());
14913template<
typename Derived>
14916 if (E->isTypeOperand()) {
14918 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14922 if (!getDerived().AlwaysRebuild() &&
14923 TInfo == E->getTypeOperandSourceInfo())
14926 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14927 TInfo, E->getEndLoc());
14933 Expr *Op = E->getExprOperand();
14935 if (E->isGLValue()) {
14937 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14939 diag::err_incomplete_typeid))
14942 if (RD->isPolymorphic())
14950 ExprResult SubExpr = getDerived().TransformExpr(Op);
14951 if (SubExpr.isInvalid())
14954 if (!getDerived().AlwaysRebuild() &&
14955 SubExpr.get() == E->getExprOperand())
14958 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14959 SubExpr.get(), E->getEndLoc());
14962template<
typename Derived>
14965 if (E->isTypeOperand()) {
14967 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14971 if (!getDerived().AlwaysRebuild() &&
14972 TInfo == E->getTypeOperandSourceInfo())
14975 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14976 TInfo, E->getEndLoc());
14982 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14983 if (SubExpr.isInvalid())
14986 if (!getDerived().AlwaysRebuild() &&
14987 SubExpr.get() == E->getExprOperand())
14990 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14991 SubExpr.get(), E->getEndLoc());
14994template<
typename Derived>
15000template<
typename Derived>
15007template<
typename Derived>
15023 auto &S = getSema();
15024 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15025 return S.getCurrentThisType();
15026 if (S.getCurLambda())
15027 return getDerived().TransformType(E->getType());
15028 return S.getCurrentThisType();
15031 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15032 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15035 getSema().MarkThisReferenced(E);
15039 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15042template<
typename Derived>
15045 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15046 if (SubExpr.isInvalid())
15049 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15051 if (!getDerived().AlwaysRebuild() &&
15052 SubExpr.get() == E->getSubExpr())
15055 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15056 E->isThrownVariableInScope());
15059template<
typename Derived>
15063 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15068 if (E->hasRewrittenInit()) {
15069 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15070 if (InitRes.isInvalid())
15074 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15075 E->getUsedContext() == SemaRef.
CurContext &&
15076 InitRes.get() == E->getRewrittenExpr())
15079 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15083template<
typename Derived>
15087 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15091 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15095 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
15098template<
typename Derived>
15102 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15106 if (!getDerived().AlwaysRebuild() &&
15107 T == E->getTypeSourceInfo())
15110 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15111 T->getTypeLoc().getEndLoc(),
15112 E->getRParenLoc());
15115template<
typename Derived>
15120 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15121 if (!AllocTypeInfo)
15125 std::optional<Expr *> ArraySize;
15126 if (E->isArray()) {
15128 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15129 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15130 if (NewArraySize.isInvalid())
15133 ArraySize = NewArraySize.get();
15137 bool ArgumentChanged =
false;
15139 if (getDerived().TransformExprs(E->getPlacementArgs(),
15140 E->getNumPlacementArgs(),
true,
15141 PlacementArgs, &ArgumentChanged))
15145 Expr *OldInit = E->getInitializer();
15148 NewInit = getDerived().TransformInitializer(OldInit,
true);
15149 if (NewInit.isInvalid())
15154 if (E->getOperatorNew()) {
15155 OperatorNew = cast_or_null<FunctionDecl>(
15156 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15162 if (E->getOperatorDelete()) {
15163 OperatorDelete = cast_or_null<FunctionDecl>(
15164 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15165 if (!OperatorDelete)
15169 if (!getDerived().AlwaysRebuild() &&
15170 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15171 ArraySize == E->getArraySize() &&
15172 NewInit.get() == OldInit &&
15173 OperatorNew == E->getOperatorNew() &&
15174 OperatorDelete == E->getOperatorDelete() &&
15175 !ArgumentChanged) {
15180 if (OperatorDelete)
15183 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15195 QualType AllocType = AllocTypeInfo->getType();
15206 = dyn_cast<ConstantArrayType>(ArrayT)) {
15210 AllocType = ConsArrayT->getElementType();
15212 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15213 if (DepArrayT->getSizeExpr()) {
15214 ArraySize = DepArrayT->getSizeExpr();
15215 AllocType = DepArrayT->getElementType();
15220 return getDerived().RebuildCXXNewExpr(
15221 E->getBeginLoc(), E->isGlobalNew(),
15222 E->getBeginLoc(), PlacementArgs,
15223 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15224 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15227template<
typename Derived>
15236 if (E->getOperatorDelete()) {
15237 OperatorDelete = cast_or_null<FunctionDecl>(
15238 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15239 if (!OperatorDelete)
15243 if (!getDerived().AlwaysRebuild() &&
15244 Operand.get() == E->getArgument() &&
15245 OperatorDelete == E->getOperatorDelete()) {
15248 if (OperatorDelete)
15251 if (!E->getArgument()->isTypeDependent()) {
15253 E->getDestroyedType());
15262 return getDerived().RebuildCXXDeleteExpr(
15263 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15266template<
typename Derived>
15271 if (
Base.isInvalid())
15275 bool MayBePseudoDestructor =
false;
15277 E->getOperatorLoc(),
15278 E->isArrow()? tok::arrow : tok::period,
15280 MayBePseudoDestructor);
15281 if (
Base.isInvalid())
15284 QualType ObjectType = ObjectTypePtr.get();
15286 if (QualifierLoc) {
15288 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15293 SS.
Adopt(QualifierLoc);
15296 if (E->getDestroyedTypeInfo()) {
15297 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15298 E->getDestroyedTypeInfo(), ObjectType,
15300 if (!DestroyedTypeInfo)
15303 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15307 E->getDestroyedTypeLoc());
15311 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15312 nullptr, SS, ObjectTypePtr,
false);
15318 E->getDestroyedTypeLoc());
15322 if (E->getScopeTypeInfo()) {
15323 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15324 E->getScopeTypeInfo(), ObjectType,
nullptr);
15325 if (!ScopeTypeInfo)
15329 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15330 E->getOperatorLoc(),
15334 E->getColonColonLoc(),
15339template <
typename Derived>
15344 bool AllEmptyPacks =
true;
15345 for (
auto *OldD : Old->
decls()) {
15361 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15362 Decls = UPD->expansions();
15365 for (
auto *D : Decls) {
15366 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15367 for (
auto *SD : UD->shadows())
15374 AllEmptyPacks &= Decls.empty();
15383 if (AllEmptyPacks && !RequiresADL) {
15394 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15395 getSema().FilterAcceptableTemplateNames(R,
15401 getSema().Diag(R.getNameLoc(),
15402 diag::err_template_kw_refers_to_non_template)
15406 diag::note_template_kw_refers_to_non_template)
15407 << R.getLookupName();
15415template <
typename Derived>
15421template <
typename Derived>
15424 bool IsAddressOfOperand) {
15429 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15436 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15440 SS.
Adopt(QualifierLoc);
15444 CXXRecordDecl *NamingClass
15445 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15448 if (!NamingClass) {
15453 R.setNamingClass(NamingClass);
15474 SS, TemplateKWLoc, R,
15481 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15484 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15488template<
typename Derived>
15491 bool ArgChanged =
false;
15493 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15495 TypeLoc FromTL = From->getTypeLoc();
15498 TLB.
reserve(FromTL.getFullDataSize());
15499 QualType To = getDerived().TransformType(TLB, FromTL);
15503 if (To == From->getType())
15504 Args.push_back(From);
15506 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15516 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15522 bool Expand =
true;
15523 bool RetainExpansion =
false;
15525 ExpansionTL.getTypePtr()->getNumExpansions();
15527 if (getDerived().TryExpandParameterPacks(
15528 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15529 Unexpanded,
true, Expand,
15530 RetainExpansion, NumExpansions))
15540 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15542 QualType To = getDerived().TransformType(TLB, PatternTL);
15546 To = getDerived().RebuildPackExpansionType(To,
15547 PatternTL.getSourceRange(),
15548 ExpansionTL.getEllipsisLoc(),
15556 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15562 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15565 TLB.
reserve(PatternTL.getFullDataSize());
15566 QualType To = getDerived().TransformType(TLB, PatternTL);
15570 if (To->containsUnexpandedParameterPack()) {
15571 To = getDerived().RebuildPackExpansionType(To,
15572 PatternTL.getSourceRange(),
15573 ExpansionTL.getEllipsisLoc(),
15583 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15586 if (!RetainExpansion)
15591 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15594 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15596 QualType To = getDerived().TransformType(TLB, PatternTL);
15600 To = getDerived().RebuildPackExpansionType(To,
15601 PatternTL.getSourceRange(),
15602 ExpansionTL.getEllipsisLoc(),
15610 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15613 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15616 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15620template<
typename Derived>
15626 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15627 Old->NumTemplateArgs, TransArgs))
15630 return getDerived().RebuildConceptSpecializationExpr(
15631 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15632 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15636template<
typename Derived>
15650 getSema().Context, getSema().CurContext,
15651 E->getBody()->getBeginLoc());
15655 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15656 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15657 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15661 Param->setDeclContext(Body);
15667 if (!TypeParamResult.isUnset())
15668 return TypeParamResult;
15671 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15676 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15677 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15678 ER->getReturnTypeRequirement()
15679 .getTypeConstraintTemplateParameterList()->getParam(0)
15680 ->setDeclContext(Body);
15685 return getDerived().RebuildRequiresExpr(
15686 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15687 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15690template<
typename Derived>
15696 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15697 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15698 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15699 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15701 TransReq =
getDerived().TransformNestedRequirement(
15705 Transformed.push_back(TransReq);
15710template<
typename Derived>
15723 return getDerived().RebuildTypeRequirement(TransType);
15726template<
typename Derived>
15729 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15735 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15738 TransExpr = TransExprRes.
get();
15741 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15743 if (RetReq.isEmpty())
15744 TransRetReq.emplace();
15745 else if (RetReq.isSubstitutionFailure())
15746 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15747 else if (RetReq.isTypeConstraint()) {
15749 RetReq.getTypeConstraintTemplateParameterList();
15751 getDerived().TransformTemplateParameterList(OrigTPL);
15754 TransRetReq.emplace(TPL);
15756 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15757 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15760 std::move(*TransRetReq));
15766template<
typename Derived>
15772 return getDerived().RebuildNestedRequirement(
15780 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15783template<
typename Derived>
15790 if (!getDerived().AlwaysRebuild() &&
15807template<
typename Derived>
15814 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15815 if (SubExpr.isInvalid())
15818 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15822 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15823 SubExpr.get(), E->getEndLoc());
15826template <
typename Derived>
15831 DRE, AddrTaken, RecoveryTSI);
15844template <
typename Derived>
15851template <
typename Derived>
15867 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15872 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15878 return getDerived().RebuildDependentScopeDeclRefExpr(
15879 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15880 IsAddressOfOperand, RecoveryTSI);
15884 if (getDerived().TransformTemplateArguments(
15888 return getDerived().RebuildDependentScopeDeclRefExpr(
15889 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15893template<
typename Derived>
15899 if (getDerived().AllowSkippingCXXConstructExpr() &&
15900 ((E->getNumArgs() == 1 ||
15901 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15902 (!getDerived().DropCallArgument(E->getArg(0))) &&
15903 !E->isListInitialization()))
15909 QualType T = getDerived().TransformType(E->getType());
15914 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15918 bool ArgumentChanged =
false;
15923 E->isListInitialization());
15924 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15929 if (!getDerived().AlwaysRebuild() &&
15930 T == E->getType() &&
15932 !ArgumentChanged) {
15939 return getDerived().RebuildCXXConstructExpr(
15940 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15941 E->hadMultipleCandidates(), E->isListInitialization(),
15942 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15943 E->getConstructionKind(), E->getParenOrBraceRange());
15946template<
typename Derived>
15949 QualType T = getDerived().TransformType(E->getType());
15954 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15958 if (!getDerived().AlwaysRebuild() &&
15959 T == E->getType() &&
15967 return getDerived().RebuildCXXInheritedCtorInitExpr(
15969 E->constructsVBase(), E->inheritedFromVBase());
15976template<
typename Derived>
15979 if (
auto *Dtor = E->getTemporary()->getDestructor())
15982 return getDerived().TransformExpr(E->getSubExpr());
15990template<
typename Derived>
15996template<
typename Derived>
16001 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16006 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16010 bool ArgumentChanged =
false;
16012 Args.reserve(E->getNumArgs());
16016 E->isListInitialization());
16017 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16021 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16022 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16024 if (Res.isInvalid())
16026 Args = {Res.get()};
16030 if (!getDerived().AlwaysRebuild() &&
16031 T == E->getTypeSourceInfo() &&
16033 !ArgumentChanged) {
16040 return getDerived().RebuildCXXTemporaryObjectExpr(
16041 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16044template<
typename Derived>
16049 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16050 struct TransformedInitCapture {
16052 SourceLocation EllipsisLoc;
16054 SmallVector<InitCaptureInfoTy, 4> Expansions;
16057 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16059 CEnd = E->capture_end();
16061 if (!E->isInitCapture(
C))
16064 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16069 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16072 if (NewExprInitResult.isInvalid()) {
16076 Expr *NewExprInit = NewExprInitResult.get();
16079 getSema().buildLambdaInitCaptureInitialization(
16080 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16081 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16085 Result.Expansions.push_back(
16086 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16090 if (OldVD->isParameterPack()) {
16099 bool Expand =
true;
16100 bool RetainExpansion =
false;
16102 ExpansionTL.getTypePtr()->getNumExpansions();
16104 if (getDerived().TryExpandParameterPacks(
16105 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16106 Unexpanded,
true, Expand,
16107 RetainExpansion, NumExpansions))
16109 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16110 "capture since it cannot be extended");
16112 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16117 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16118 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16157 if ((getSema().isUnevaluatedContext() ||
16158 getSema().isConstantEvaluatedContext()) &&
16159 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16161 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16166 E->getIntroducerRange(),
nullptr, DependencyKind,
16167 E->getCaptureDefault());
16168 getDerived().transformedLocalDecl(OldClass, {
Class});
16171 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16174 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16175 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16176 E->hasExplicitParameters(), E->isMutable());
16186 CEnd = E->capture_end();
16190 if (
C->isImplicit())
16194 if (
C->capturesThis()) {
16202 dyn_cast_if_present<CXXRecordDecl>(
16203 getSema().getFunctionLevelDeclContext()),
16205 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16212 if (
C->capturesVLAType())
16216 if (E->isInitCapture(
C)) {
16217 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16222 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16224 QualType InitQualType = Info.second;
16225 if (
Init.isInvalid() || InitQualType.isNull()) {
16229 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16230 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16231 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16232 getSema().CurContext);
16237 NewVDs.push_back(NewVD);
16238 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16243 if (NewC.EllipsisLoc.isInvalid())
16244 LSI->ContainsUnexpandedParameterPack |=
16245 Init.get()->containsUnexpandedParameterPack();
16251 getDerived().transformedLocalDecl(OldVD, NewVDs);
16255 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16263 if (
C->isPackExpansion()) {
16265 bool ShouldExpand =
false;
16266 bool RetainExpansion =
false;
16268 if (getDerived().TryExpandParameterPacks(
16269 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16270 true, ShouldExpand,
16271 RetainExpansion, NumExpansions)) {
16276 if (ShouldExpand) {
16281 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16283 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16284 getDerived().TransformDecl(
C->getLocation(), Pack));
16285 if (!CapturedVar) {
16291 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16299 EllipsisLoc =
C->getEllipsisLoc();
16303 auto *CapturedVar = cast_or_null<ValueDecl>(
16304 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16305 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16312 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16313 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16316 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16319 getSema().finishLambdaExplicitCaptures(LSI);
16323 auto TPL = getDerived().TransformTemplateParameterList(
16324 E->getTemplateParameterList());
16325 LSI->GLTemplateParameterList = TPL;
16327 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16329 LSI->ContainsUnexpandedParameterPack |=
16330 TPL->containsUnexpandedParameterPack();
16335 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16337 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16338 if (NewCallOpType.isNull())
16340 LSI->ContainsUnexpandedParameterPack |=
16341 NewCallOpType->containsUnexpandedParameterPack();
16343 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16348 assert(FPTL &&
"Not a FunctionProtoType?");
16352 ExprResult E = getDerived().TransformLambdaConstraint(
16353 const_cast<Expr *
>(TRC.ConstraintExpr));
16356 TRC.ConstraintExpr = E.get();
16359 LSI->BeforeCompoundStatement =
false;
16360 getSema().CompleteLambdaCallOperator(
16361 NewCallOperator, E->getCallOperator()->getLocation(),
16362 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16363 E->getCallOperator()->getConstexprKind(),
16364 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16365 E->hasExplicitResultType());
16367 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16368 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16374 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16375 if (getDerived().ReplacingOriginal()) {
16376 Numbering = OldClass->getLambdaNumbering();
16379 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16384 getSema().PushExpressionEvaluationContextForFunction(
16386 E->getCallOperator());
16393 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16394 getSema().pushCodeSynthesisContext(
C);
16398 : getDerived().TransformLambdaBody(E, E->getBody());
16400 getSema().popCodeSynthesisContext();
16404 FuncScopeCleanup.disable();
16406 if (Body.isInvalid()) {
16407 SavedContext.pop();
16408 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16413 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16416 SavedContext.pop();
16451 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16452 Class->setLambdaDependencyKind(DependencyKind);
16454 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16455 Body.get()->getEndLoc(), LSI);
16458template<
typename Derived>
16464template<
typename Derived>
16473 if (!
C->isImplicit())
16477 if (
C->capturesThis()) {
16478 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16485 if (
C->capturesVLAType())
16488 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16492 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16498 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16504template<
typename Derived>
16513 bool ArgumentChanged =
false;
16525 if (!getDerived().AlwaysRebuild() &&
16531 return getDerived().RebuildCXXUnresolvedConstructExpr(
16535template<
typename Derived>
16544 if (!E->isImplicitAccess()) {
16545 OldBase = E->getBase();
16546 Base = getDerived().TransformExpr(OldBase);
16547 if (
Base.isInvalid())
16552 bool MayBePseudoDestructor =
false;
16554 E->getOperatorLoc(),
16555 E->isArrow()? tok::arrow : tok::period,
16557 MayBePseudoDestructor);
16558 if (
Base.isInvalid())
16561 ObjectType = ObjectTy.get();
16562 BaseType = ((
Expr*)
Base.get())->getType();
16565 BaseType = getDerived().TransformType(E->getBaseType());
16572 = getDerived().TransformFirstQualifierInScope(
16573 E->getFirstQualifierFoundInScope(),
16574 E->getQualifierLoc().getBeginLoc());
16577 if (E->getQualifier()) {
16579 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16581 FirstQualifierInScope);
16593 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16594 if (!NameInfo.getName())
16597 if (!E->hasExplicitTemplateArgs()) {
16600 if (!getDerived().AlwaysRebuild() &&
16601 Base.get() == OldBase &&
16602 BaseType == E->getBaseType() &&
16603 QualifierLoc == E->getQualifierLoc() &&
16604 NameInfo.getName() == E->getMember() &&
16605 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16608 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16611 E->getOperatorLoc(),
16614 FirstQualifierInScope,
16620 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16621 E->getNumTemplateArgs(),
16625 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16628 E->getOperatorLoc(),
16631 FirstQualifierInScope,
16636template <
typename Derived>
16642 if (!Old->isImplicitAccess()) {
16643 Base = getDerived().TransformExpr(Old->getBase());
16644 if (
Base.isInvalid())
16647 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16648 if (
Base.isInvalid())
16650 BaseType =
Base.get()->getType();
16652 BaseType = getDerived().TransformType(Old->getBaseType());
16656 if (Old->getQualifierLoc()) {
16658 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16668 if (TransformOverloadExprDecls(Old,
false, R))
16672 if (Old->getNamingClass()) {
16674 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16678 R.setNamingClass(NamingClass);
16682 if (Old->hasExplicitTemplateArgs()) {
16683 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16684 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16685 if (getDerived().TransformTemplateArguments(
16686 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16694 NamedDecl *FirstQualifierInScope =
nullptr;
16696 return getDerived().RebuildUnresolvedMemberExpr(
16697 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16698 TemplateKWLoc, FirstQualifierInScope, R,
16699 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16702template<
typename Derived>
16707 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16708 if (SubExpr.isInvalid())
16711 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16714 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16717template<
typename Derived>
16720 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16721 if (Pattern.isInvalid())
16724 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16727 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16728 E->getNumExpansions());
16731template <
typename Derived>
16736 if (!Arg.isPackExpansion()) {
16748 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16749 OrigNumExpansions);
16761 if (!NumExpansions) {
16773template<
typename Derived>
16792 bool ShouldExpand =
false;
16793 bool RetainExpansion =
false;
16795 if (getDerived().TryExpandParameterPacks(
16797 true, ShouldExpand,
16798 RetainExpansion, NumExpansions))
16803 if (ShouldExpand) {
16805 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16806 ArgStorage = getSema().Context.getPackExpansionType(
16807 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16808 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16812 ExprResult DRE = getSema().BuildDeclRefExpr(
16813 VD, VD->getType().getNonLValueExprType(getSema().Context),
16816 if (DRE.isInvalid())
16819 new (getSema().Context)
16823 PackArgs = ArgStorage;
16828 if (!PackArgs.size()) {
16829 auto *Pack = cast_or_null<NamedDecl>(
16833 return getDerived().RebuildSizeOfPackExpr(
16840 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16852 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16855 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16856 PackLocIterator(*
this, PackArgs.end()),
16857 TransformedPackArgs,
true))
16864 bool PartialSubstitution =
false;
16865 for (
auto &Loc : TransformedPackArgs.arguments()) {
16866 Args.push_back(Loc.getArgument());
16867 if (Loc.getArgument().isPackExpansion())
16868 PartialSubstitution =
true;
16871 if (PartialSubstitution)
16872 return getDerived().RebuildSizeOfPackExpr(
16874 std::nullopt, Args);
16876 return getDerived().RebuildSizeOfPackExpr(
16878 static_cast<unsigned>(Args.size()),
16882template <
typename Derived>
16885 if (!E->isValueDependent())
16893 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16894 if (IndexExpr.isInvalid())
16899 bool FullySubstituted =
true;
16900 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16901 Expr *Pattern = E->getPackIdExpression();
16903 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16905 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16909 bool ShouldExpand =
true;
16910 bool RetainExpansion =
false;
16912 NumExpansions = std::nullopt;
16913 if (getDerived().TryExpandParameterPacks(
16914 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16915 true, ShouldExpand,
16916 RetainExpansion, NumExpansions))
16918 if (!ShouldExpand) {
16920 ExprResult Pack = getDerived().TransformExpr(Pattern);
16921 if (Pack.isInvalid())
16923 return getDerived().RebuildPackIndexingExpr(
16924 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16927 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16930 if (
Out.isInvalid())
16932 if (
Out.get()->containsUnexpandedParameterPack()) {
16933 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16934 OrigNumExpansions);
16935 if (
Out.isInvalid())
16937 FullySubstituted =
false;
16939 ExpandedExprs.push_back(
Out.get());
16943 if (RetainExpansion) {
16944 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16947 if (
Out.isInvalid())
16950 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16951 OrigNumExpansions);
16952 if (
Out.isInvalid())
16954 FullySubstituted =
false;
16955 ExpandedExprs.push_back(
Out.get());
16957 }
else if (!E->expandsToEmptyPack()) {
16958 if (getDerived().TransformExprs(E->getExpressions().data(),
16959 E->getExpressions().size(),
false,
16964 return getDerived().RebuildPackIndexingExpr(
16965 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16966 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16969template <
typename Derived>
16972 if (!getSema().ArgPackSubstIndex)
16978 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16979 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
16980 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
16984template <
typename Derived>
17001 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17002 if (Replacement.isInvalid())
17005 Decl *AssociatedDecl =
17006 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17007 if (!AssociatedDecl)
17010 QualType ParamType = TransformType(E->getParameterType());
17011 if (ParamType.isNull())
17014 if (Replacement.get() == OrigReplacement &&
17015 AssociatedDecl == E->getAssociatedDecl() &&
17016 ParamType == E->getParameterType())
17019 if (Replacement.get() != OrigReplacement ||
17020 ParamType != E->getParameterType()) {
17029 Param, ParamType, Replacement.get(), SugaredConverted,
17030 CanonicalConverted,
17032 if (Replacement.isInvalid())
17036 Replacement = E->getReplacement();
17039 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17040 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17042 E->getPackIndex(), E->getFinal());
17045template<
typename Derived>
17052template<
typename Derived>
17059template<
typename Derived>
17063 if (
Expr *OldCallee = E->getCallee()) {
17064 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17065 if (CalleeResult.isInvalid())
17070 Expr *Pattern = E->getPattern();
17073 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17074 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17078 bool Expand =
true;
17079 bool RetainExpansion =
false;
17081 NumExpansions = OrigNumExpansions;
17082 if (getDerived().TryExpandParameterPacks(
17083 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17084 true, Expand, RetainExpansion,
17094 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17095 if (LHS.isInvalid())
17099 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17100 if (RHS.isInvalid())
17103 if (!getDerived().AlwaysRebuild() &&
17104 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17107 return getDerived().RebuildCXXFoldExpr(
17108 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17109 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17115 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17116 SemaRef.
Diag(E->getEllipsisLoc(),
17117 clang::diag::err_fold_expression_limit_exceeded)
17118 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17119 << E->getSourceRange();
17120 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17129 bool LeftFold = E->isLeftFold();
17133 if (!LeftFold && RetainExpansion) {
17134 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17137 if (
Out.isInvalid())
17140 Result = getDerived().RebuildCXXFoldExpr(
17141 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17142 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17147 bool WarnedOnComparison =
false;
17148 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17150 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17152 if (
Out.isInvalid())
17155 if (
Out.get()->containsUnexpandedParameterPack()) {
17157 Result = getDerived().RebuildCXXFoldExpr(
17158 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17159 E->getOperator(), E->getEllipsisLoc(),
17160 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17161 OrigNumExpansions);
17162 }
else if (
Result.isUsable()) {
17169 Result = getDerived().RebuildCXXOperatorCallExpr(
17171 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17172 Functions, LHS, RHS);
17174 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17175 E->getOperator(), LHS, RHS,
17177 if (!WarnedOnComparison &&
Result.isUsable()) {
17178 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17179 BO && BO->isComparisonOp()) {
17180 WarnedOnComparison =
true;
17181 SemaRef.
Diag(BO->getBeginLoc(),
17182 diag::warn_comparison_in_fold_expression)
17183 << BO->getOpcodeStr();
17196 if (LeftFold && RetainExpansion) {
17197 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17200 if (
Out.isInvalid())
17203 Result = getDerived().RebuildCXXFoldExpr(
17204 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17205 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17211 PE->setIsProducedByFoldExpansion();
17216 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17221template <
typename Derived>
17227 QualType T = getDerived().TransformType(E->getType());
17229 bool ArgChanged =
false;
17231 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17232 TransformedInits, &ArgChanged))
17235 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17238 return getDerived().RebuildCXXParenListInitExpr(
17239 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17240 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17243template<
typename Derived>
17250template<
typename Derived>
17256template<
typename Derived>
17262template<
typename Derived>
17265 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17266 if (SubExpr.isInvalid())
17269 if (!getDerived().AlwaysRebuild() &&
17270 SubExpr.get() == E->getSubExpr())
17273 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17276template<
typename Derived>
17281 bool ArgChanged =
false;
17282 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17283 false, Elements, &ArgChanged))
17286 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17289 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17294template<
typename Derived>
17300 bool ArgChanged =
false;
17301 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17304 if (OrigElement.isPackExpansion()) {
17307 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17308 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17309 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17313 bool Expand =
true;
17314 bool RetainExpansion =
false;
17317 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17318 OrigElement.Value->getEndLoc());
17319 if (getDerived().TryExpandParameterPacks(
17320 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17321 true, Expand, RetainExpansion,
17330 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17331 if (Key.isInvalid())
17334 if (Key.get() != OrigElement.Key)
17338 if (
Value.isInvalid())
17345 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17347 Elements.push_back(Expansion);
17357 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17359 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17360 if (Key.isInvalid())
17364 if (
Value.isInvalid())
17374 if (Key.get()->containsUnexpandedParameterPack() ||
17375 Value.get()->containsUnexpandedParameterPack())
17376 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17378 Elements.push_back(Element);
17388 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17389 if (Key.isInvalid())
17392 if (Key.get() != OrigElement.Key)
17397 = getDerived().TransformExpr(OrigElement.Value);
17398 if (
Value.isInvalid())
17406 Elements.push_back(Element);
17409 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17412 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17416template<
typename Derived>
17420 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17421 if (!EncodedTypeInfo)
17424 if (!getDerived().AlwaysRebuild() &&
17425 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17428 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17430 E->getRParenLoc());
17433template<
typename Derived>
17443template<
typename Derived>
17447 = getDerived().TransformType(E->getTypeInfoAsWritten());
17455 if (!getDerived().AlwaysRebuild() &&
17456 TSInfo == E->getTypeInfoAsWritten() &&
17457 Result.get() == E->getSubExpr())
17461 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17465template <
typename Derived>
17471template<
typename Derived>
17475 bool ArgChanged =
false;
17477 Args.reserve(E->getNumArgs());
17478 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17485 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17486 if (!ReceiverTypeInfo)
17490 if (!getDerived().AlwaysRebuild() &&
17491 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17496 E->getSelectorLocs(SelLocs);
17497 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17500 E->getMethodDecl(),
17507 if (!E->getMethodDecl())
17512 E->getSelectorLocs(SelLocs);
17513 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17516 E->getReceiverType(),
17517 E->getMethodDecl(),
17525 "Only class and instance messages may be instantiated");
17527 = getDerived().TransformExpr(E->getInstanceReceiver());
17528 if (Receiver.isInvalid())
17532 if (!getDerived().AlwaysRebuild() &&
17533 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17538 E->getSelectorLocs(SelLocs);
17539 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17542 E->getMethodDecl(),
17548template<
typename Derived>
17554template<
typename Derived>
17560template<
typename Derived>
17565 if (
Base.isInvalid())
17571 if (!getDerived().AlwaysRebuild() &&
17572 Base.get() == E->getBase())
17575 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17577 E->isArrow(), E->isFreeIvar());
17580template<
typename Derived>
17585 if (!E->isObjectReceiver())
17590 if (
Base.isInvalid())
17596 if (!getDerived().AlwaysRebuild() &&
17597 Base.get() == E->getBase())
17600 if (E->isExplicitProperty())
17601 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17602 E->getExplicitProperty(),
17605 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17607 E->getImplicitPropertyGetter(),
17608 E->getImplicitPropertySetter(),
17612template<
typename Derived>
17617 if (
Base.isInvalid())
17621 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17622 if (Key.isInvalid())
17626 if (!getDerived().AlwaysRebuild() &&
17627 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17630 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17631 Base.get(), Key.get(),
17632 E->getAtIndexMethodDecl(),
17633 E->setAtIndexMethodDecl());
17636template<
typename Derived>
17641 if (
Base.isInvalid())
17645 if (!getDerived().AlwaysRebuild() &&
17646 Base.get() == E->getBase())
17649 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17654template<
typename Derived>
17657 bool ArgumentChanged =
false;
17659 SubExprs.reserve(E->getNumSubExprs());
17660 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17661 SubExprs, &ArgumentChanged))
17664 if (!getDerived().AlwaysRebuild() &&
17668 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17670 E->getRParenLoc());
17673template<
typename Derived>
17676 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17677 if (SrcExpr.isInvalid())
17684 if (!getDerived().AlwaysRebuild() &&
17685 Type == E->getTypeSourceInfo() &&
17686 SrcExpr.get() == E->getSrcExpr())
17689 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17690 SrcExpr.get(),
Type,
17691 E->getRParenLoc());
17694template<
typename Derived>
17697 BlockDecl *oldBlock = E->getBlockDecl();
17703 blockScope->TheDecl->setBlockMissingReturnType(
17704 oldBlock->blockMissingReturnType());
17713 if (getDerived().TransformFunctionTypeParams(
17714 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17715 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17717 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17722 getDerived().TransformType(exprFunctionType->getReturnType());
17724 auto epi = exprFunctionType->getExtProtoInfo();
17725 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17728 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17732 if (!params.empty())
17733 blockScope->TheDecl->setParams(params);
17735 if (!oldBlock->blockMissingReturnType()) {
17736 blockScope->HasImplicitReturnType =
false;
17737 blockScope->ReturnType = exprResultType;
17741 StmtResult body = getDerived().TransformStmt(E->getBody());
17742 if (body.isInvalid()) {
17743 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17751 for (
const auto &I : oldBlock->captures()) {
17752 VarDecl *oldCapture = I.getVariable();
17755 if (oldCapture->isParameterPack())
17759 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17761 assert(blockScope->CaptureMap.count(newCapture));
17767 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17768 "this pointer isn't captured in the old block");
17776template<
typename Derived>
17779 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17780 if (SrcExpr.isInvalid())
17783 QualType Type = getDerived().TransformType(E->getType());
17786 E->getRParenLoc());
17789template<
typename Derived>
17792 bool ArgumentChanged =
false;
17794 SubExprs.reserve(E->getNumSubExprs());
17795 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17796 SubExprs, &ArgumentChanged))
17799 if (!getDerived().AlwaysRebuild() &&
17803 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17804 E->getOp(), E->getRParenLoc());
17811template<
typename Derived>
17814 return SemaRef.BuildPointerType(PointeeType,
Star,
17818template<
typename Derived>
17821 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17825template<
typename Derived>
17828 bool WrittenAsLValue,
17830 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17834template <
typename Derived>
17838 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17842template<
typename Derived>
17849 return SemaRef.ObjC().BuildObjCTypeParamType(
17850 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17854template<
typename Derived>
17865 return SemaRef.ObjC().BuildObjCObjectType(
17866 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17867 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17872template<
typename Derived>
17876 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17879template <
typename Derived>
17882 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17883 if (SizeExpr || !Size)
17884 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17885 IndexTypeQuals, BracketsRange,
17889 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17891 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17894 for (
const auto &
T : Types)
17895 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17905 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17906 IndexTypeQuals, BracketsRange,
17910template <
typename Derived>
17913 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17914 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17915 IndexTypeQuals, BracketsRange);
17918template <
typename Derived>
17922 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17923 IndexTypeQuals, BracketsRange);
17926template <
typename Derived>
17929 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17930 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17932 IndexTypeQuals, BracketsRange);
17935template <
typename Derived>
17938 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17939 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17941 IndexTypeQuals, BracketsRange);
17944template <
typename Derived>
17947 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17951template <
typename Derived>
17953 unsigned NumElements,
17956 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17959template <
typename Derived>
17963 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17966template<
typename Derived>
17968 unsigned NumElements,
17970 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17971 NumElements,
true);
17975 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17978template<
typename Derived>
17983 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17986template <
typename Derived>
17988 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17989 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17993template <
typename Derived>
17997 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18001template <
typename Derived>
18005 return SemaRef.BuildFunctionType(
T, ParamTypes,
18011template<
typename Derived>
18013 return SemaRef.Context.getFunctionNoProtoType(
T);
18016template <
typename Derived>
18020 assert(D &&
"no decl found");
18024 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18028 if (UPD->expansions().empty()) {
18029 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18030 << UPD->isCXXClassMember() << UPD;
18039 for (
auto *E : UPD->expansions()) {
18046 else if (
T.isNull())
18049 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18050 "mismatched resolved types in using pack expansion");
18052 return T.isNull() ? FallbackT :
T;
18054 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18055 assert(Using->hasTypename() &&
18056 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18059 assert(++Using->shadow_begin() == Using->shadow_end());
18064 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18067 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18068 return SemaRef.Context.getUnresolvedUsingType(
18072template <
typename Derived>
18075 return SemaRef.BuildTypeofExprType(E, Kind);
18078template<
typename Derived>
18081 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18084template <
typename Derived>
18086 return SemaRef.BuildDecltypeType(E);
18089template <
typename Derived>
18094 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
18095 FullySubstituted, Expansions);
18098template<
typename Derived>
18100 UnaryTransformType::UTTKind UKind,
18102 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18105template <
typename Derived>
18109 return SemaRef.CheckTemplateIdType(
18114template<
typename Derived>
18117 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18120template<
typename Derived>
18124 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18125 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18128template <
typename Derived>
18132 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18136 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18139template <
typename Derived>
18142 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18145template <
typename Derived>
18153template <
typename Derived>
18160 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18163 AllowInjectedClassName);
18167template<
typename Derived>
18174 bool AllowInjectedClassName) {
18177 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18182 false,
Template, AllowInjectedClassName);
18186template <
typename Derived>
18191 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18196 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18197 Opc,
First, Second);
18212 if (Op == OO_Subscript) {
18213 if (!
First->getType()->isOverloadableType() &&
18215 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18217 }
else if (Op == OO_Arrow) {
18220 if (
First->getType()->isDependentType())
18223 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18224 }
else if (Second ==
nullptr || isPostIncDec) {
18225 if (!
First->getType()->isOverloadableType() ||
18226 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18233 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18237 !
First->getType()->isOverloadableType() &&
18243 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18252 if (!Second || isPostIncDec) {
18255 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18262 First, Second, RequiresADL);
18269template<
typename Derived>
18279 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18280 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18285 ->getAsCanonical<RecordType>())) {
18287 return SemaRef.BuildPseudoDestructorExpr(
18288 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18289 CCLoc, TildeLoc, Destroyed);
18301 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18302 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18303 diag::err_expected_class_or_namespace)
18304 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18308 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18312 return getSema().BuildMemberReferenceExpr(
18313 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18319template<
typename Derived>
18327 for (
unsigned I = 0; I < NumParams; ++I) {
18328 if (I != ContextParamPos) {
18334 Params.push_back(std::make_pair(StringRef(), QualType()));
18337 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18345 if (Body.isInvalid()) {
18346 getSema().ActOnCapturedRegionError();
18350 return getSema().ActOnCapturedRegionEnd(Body.get());
18353template <
typename Derived>
18359 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18363template <
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.
Result
Implement __builtin_bit_cast and related operations.
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 HLSL constructs.
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)
This represents clause 'map' in the 'pragma omp ...' directives.
This represents clauses with a list of expressions that are mappable. Examples of these clauses are '...
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.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getLateParsedAttrType(QualType Wrapped, LateParsedTypeAttribute *LateParsedAttr) const
Return a placeholder type for a late-parsed type attribute.
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.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
QualType getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, QualType Wrapped) const
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.
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]).
Helper that selects an expression from an InitListExpr depending on the current expansion index.
Represents a C++26 expansion statement declaration.
Represents the code generated for an expanded expansion statement.
static CXXExpansionStmtInstantiation * Create(ASTContext &C, CXXExpansionStmtDecl *Parent, ArrayRef< Stmt * > Instantiations, ArrayRef< Stmt * > PreambleStmts, bool ShouldApplyLifetimeExtensionToPreamble)
CXXExpansionStmtPattern - Represents an unexpanded C++ expansion statement.
static CXXExpansionStmtPattern * CreateIterating(ASTContext &Context, CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVar, DeclStmt *Range, DeclStmt *Begin, DeclStmt *Iter, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc)
Create an iterating expansion statement pattern.
static CXXExpansionStmtPattern * CreateEnumerating(ASTContext &Context, CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVar, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc)
Create an enumerating expansion statement pattern.
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
Represents a C++26 reflect expression [expr.reflect].
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
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.
bool isExpansionStmt() const
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)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
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.
void setSourceRange(const SourceRange &R)
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.
void setAttrNameLoc(SourceLocation Loc)
Represents a placeholder type for late-parsed type attributes.
Represents the results of name lookup.
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.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
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.
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 'align' clause in the 'pragma omp allocate' directive.
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 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 the 'counts' clause in the 'pragma omp split' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents 'num_threads' 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 'safelen' clause in the 'pragma omp ...' directive.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents 'threadset' clause in the 'pragma omp task ...' 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)
void initializeLocal(ASTContext &Context, SourceLocation loc)
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.
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 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)
Emit a diagnostic.
bool diagnoseMatrixLayoutInstantiation(attr::Kind K, QualType T, SourceLocation Loc)
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 * 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 * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
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 * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' 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 * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' 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 * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' 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 * 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 * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr, SourceLocation ModifierExtraLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' 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.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' 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 * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' 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)
StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body, Expr *LaunchIdExpr)
Builds a SYCLKernelCallStmt to wrap 'Body' and to be used as the body of 'FD'.
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 CreateBuiltinMatrixSingleSubscriptExpr(Expr *Base, Expr *RowIdx, SourceLocation RBLoc)
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'.
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
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)
StmtResult BuildNonEnumeratingCXXExpansionStmtPattern(CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVarStmt, Expr *ExpansionInitializer, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation RParenLoc, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
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 CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, bool DoCheckConstraintSatisfaction=true)
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)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, const Designation &Desig, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
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 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.
void ApplyForRangeOrExpansionStatementLifetimeExtension(VarDecl *RangeVar, ArrayRef< MaterializeTemporaryExpr * > Temporaries)
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 BuildSubstNonTypeTemplateParmExpr(Decl *AssociatedDecl, unsigned Index, QualType ParamType, SourceLocation loc, TemplateArgument Replacement, UnsignedOrNone PackIndex, bool Final)
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.
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)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
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 BuildCXXExpansionSelectExpr(InitListExpr *Range, Expr *Idx)
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
StmtResult FinishCXXExpansionStmt(Stmt *Expansion, Stmt *Body)
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.
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 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
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 ...
Top level wrappers for InstallAPI frontend operations.
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)
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.
OpenMPNumTeamsClauseModifier
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...
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
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.
OptionalUnsigned< unsigned > UnsignedOrNone
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)
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ 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.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ 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.
OpenMPThreadLimitClauseModifier
@ 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)
@ PackIndex
Index of a pack indexing expression or specifier.
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.
@ 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.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
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)
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
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].
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.
bool InLifetimeExtendingContext
Whether we are currently in a context in which all temporaries must be lifetime-extended,...
SmallVector< MaterializeTemporaryExpr *, 8 > ForRangeLifetimeExtendTemps
P2718R0 - Lifetime extension in range-based for loops.
bool RebuildDefaultArgOrDefaultInit
Whether we should rebuild CXXDefaultArgExpr and CXXDefaultInitExpr.
ExpressionEvaluationContext Context
The expression evaluation context.
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