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>
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10287 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10288 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10293template <
typename Derived>
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_atomic, 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_target, DirName,
nullptr, D->getBeginLoc());
10310 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10315template <
typename Derived>
10317 OMPTargetDataDirective *D) {
10319 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10320 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10321 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10322 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10326template <
typename Derived>
10328 OMPTargetEnterDataDirective *D) {
10330 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10331 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10332 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10333 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10337template <
typename Derived>
10339 OMPTargetExitDataDirective *D) {
10341 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10342 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10343 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10344 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10348template <
typename Derived>
10350 OMPTargetParallelDirective *D) {
10352 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10353 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10354 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10355 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10359template <
typename Derived>
10361 OMPTargetParallelForDirective *D) {
10363 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10364 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10365 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10366 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10370template <
typename Derived>
10372 OMPTargetUpdateDirective *D) {
10374 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10375 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10376 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10377 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10381template <
typename Derived>
10385 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10386 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10387 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10388 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10392template <
typename Derived>
10394 OMPCancellationPointDirective *D) {
10396 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10397 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10398 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10399 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10403template <
typename Derived>
10407 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10408 OMPD_cancel, 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_taskloop, DirName,
nullptr, D->getBeginLoc());
10420 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10421 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10425template <
typename Derived>
10427 OMPTaskLoopSimdDirective *D) {
10429 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10430 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10431 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10432 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10436template <
typename Derived>
10438 OMPMasterTaskLoopDirective *D) {
10440 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10441 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10442 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10443 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10447template <
typename Derived>
10449 OMPMaskedTaskLoopDirective *D) {
10451 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10452 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10453 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10454 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10458template <
typename Derived>
10460 OMPMasterTaskLoopSimdDirective *D) {
10462 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10463 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10464 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10465 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10469template <
typename Derived>
10471 OMPMaskedTaskLoopSimdDirective *D) {
10473 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10474 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10475 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10476 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10480template <
typename Derived>
10482 OMPParallelMasterTaskLoopDirective *D) {
10484 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10485 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10486 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10487 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10491template <
typename Derived>
10493 OMPParallelMaskedTaskLoopDirective *D) {
10495 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10496 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10497 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10498 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10502template <
typename Derived>
10505 OMPParallelMasterTaskLoopSimdDirective *D) {
10507 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10508 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10509 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10510 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10514template <
typename Derived>
10517 OMPParallelMaskedTaskLoopSimdDirective *D) {
10519 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10520 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10521 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10522 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10526template <
typename Derived>
10528 OMPDistributeDirective *D) {
10530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10531 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10532 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10537template <
typename Derived>
10539 OMPDistributeParallelForDirective *D) {
10541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10542 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10543 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10548template <
typename Derived>
10551 OMPDistributeParallelForSimdDirective *D) {
10553 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10554 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10555 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10556 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10560template <
typename Derived>
10562 OMPDistributeSimdDirective *D) {
10564 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10565 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10566 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10567 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10571template <
typename Derived>
10573 OMPTargetParallelForSimdDirective *D) {
10575 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10576 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10577 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10578 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10582template <
typename Derived>
10584 OMPTargetSimdDirective *D) {
10586 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10587 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10588 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10589 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10593template <
typename Derived>
10595 OMPTeamsDistributeDirective *D) {
10597 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10598 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10599 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10600 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10604template <
typename Derived>
10606 OMPTeamsDistributeSimdDirective *D) {
10608 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10609 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10610 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10611 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10615template <
typename Derived>
10617 OMPTeamsDistributeParallelForSimdDirective *D) {
10619 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10620 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10622 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10623 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10627template <
typename Derived>
10629 OMPTeamsDistributeParallelForDirective *D) {
10631 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10632 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10633 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10634 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10638template <
typename Derived>
10640 OMPTargetTeamsDirective *D) {
10642 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10643 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10644 auto Res = getDerived().TransformOMPExecutableDirective(D);
10645 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10649template <
typename Derived>
10651 OMPTargetTeamsDistributeDirective *D) {
10653 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10654 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10655 auto Res = getDerived().TransformOMPExecutableDirective(D);
10656 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10660template <
typename Derived>
10663 OMPTargetTeamsDistributeParallelForDirective *D) {
10665 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10666 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10668 auto Res = getDerived().TransformOMPExecutableDirective(D);
10669 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10673template <
typename Derived>
10676 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10678 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10679 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10681 auto Res = getDerived().TransformOMPExecutableDirective(D);
10682 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10686template <
typename Derived>
10689 OMPTargetTeamsDistributeSimdDirective *D) {
10691 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10692 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10693 auto Res = getDerived().TransformOMPExecutableDirective(D);
10694 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10698template <
typename Derived>
10702 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10703 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10704 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10705 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10709template <
typename Derived>
10713 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10714 OMPD_dispatch, 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_masked, DirName,
nullptr, D->getBeginLoc());
10726 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10727 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10731template <
typename Derived>
10733 OMPGenericLoopDirective *D) {
10735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10736 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10742template <
typename Derived>
10744 OMPTeamsGenericLoopDirective *D) {
10746 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10747 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10748 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10749 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10753template <
typename Derived>
10755 OMPTargetTeamsGenericLoopDirective *D) {
10757 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10758 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10759 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10760 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10764template <
typename Derived>
10766 OMPParallelGenericLoopDirective *D) {
10768 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10769 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10770 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10771 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10775template <
typename Derived>
10778 OMPTargetParallelGenericLoopDirective *D) {
10780 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10781 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10782 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10783 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10790template <
typename Derived>
10793 if (
Cond.isInvalid())
10795 return getDerived().RebuildOMPIfClause(
10796 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10797 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10800template <
typename Derived>
10803 if (
Cond.isInvalid())
10805 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10806 C->getLParenLoc(),
C->getEndLoc());
10809template <
typename Derived>
10812 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10813 if (NumThreads.isInvalid())
10815 return getDerived().RebuildOMPNumThreadsClause(
10816 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10817 C->getModifierLoc(),
C->getEndLoc());
10820template <
typename Derived>
10823 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10826 return getDerived().RebuildOMPSafelenClause(
10827 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10830template <
typename Derived>
10833 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10836 return getDerived().RebuildOMPAllocatorClause(
10837 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10840template <
typename Derived>
10843 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10846 return getDerived().RebuildOMPSimdlenClause(
10847 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10850template <
typename Derived>
10853 TransformedSizes.reserve(
C->getNumSizes());
10855 for (
Expr *E :
C->getSizesRefs()) {
10857 TransformedSizes.push_back(
nullptr);
10866 TransformedSizes.push_back(
T.get());
10869 if (!Changed && !getDerived().AlwaysRebuild())
10871 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10872 C->getLParenLoc(),
C->getEndLoc());
10875template <
typename Derived>
10879 TransformedCounts.reserve(
C->getNumCounts());
10880 for (
Expr *E :
C->getCountsRefs()) {
10882 TransformedCounts.push_back(
nullptr);
10889 TransformedCounts.push_back(
T.get());
10892 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
10893 C->getLParenLoc(),
C->getEndLoc(),
10894 C->getOmpFillIndex(),
C->getOmpFillLoc());
10897template <
typename Derived>
10901 TransformedArgs.reserve(
C->getNumLoops());
10903 for (
Expr *E :
C->getArgsRefs()) {
10905 TransformedArgs.push_back(
nullptr);
10914 TransformedArgs.push_back(
T.get());
10917 if (!Changed && !getDerived().AlwaysRebuild())
10919 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10920 C->getLParenLoc(),
C->getEndLoc());
10923template <
typename Derived>
10925 if (!getDerived().AlwaysRebuild())
10927 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10930template <
typename Derived>
10933 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10936 Expr *Factor =
T.get();
10937 bool Changed = Factor !=
C->getFactor();
10939 if (!Changed && !getDerived().AlwaysRebuild())
10941 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10945template <
typename Derived>
10948 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10952 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10953 if (Cn.isInvalid())
10957 Expr *Count = Cn.get();
10959 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10962 if (!Changed && !getDerived().AlwaysRebuild())
10965 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10966 C->getLParenLoc(),
C->getFirstLoc(),
10967 C->getCountLoc(),
C->getEndLoc());
10970template <
typename Derived>
10973 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10976 return getDerived().RebuildOMPCollapseClause(
10977 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10980template <
typename Derived>
10984 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10985 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10989template <
typename Derived>
10996template <
typename Derived>
10999 Expr *Impex =
C->getImpexType();
11000 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11002 if (TransformedImpex.isInvalid())
11005 return getDerived().RebuildOMPTransparentClause(
11006 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11010template <
typename Derived>
11014 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11015 C->getLParenLoc(),
C->getEndLoc());
11018template <
typename Derived>
11021 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11024 return getDerived().RebuildOMPScheduleClause(
11025 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11026 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11027 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11028 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11031template <
typename Derived>
11035 if (
auto *
Num =
C->getNumForLoops()) {
11036 E = getDerived().TransformExpr(
Num);
11040 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11041 C->getLParenLoc(), E.get());
11044template <
typename Derived>
11048 if (
Expr *Evt =
C->getEventHandler()) {
11049 E = getDerived().TransformExpr(Evt);
11053 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11054 C->getLParenLoc(),
C->getEndLoc());
11057template <
typename Derived>
11063 if (
Cond.isInvalid())
11066 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
11067 C->getLParenLoc(),
C->getEndLoc());
11070template <
typename Derived>
11077template <
typename Derived>
11084template <
typename Derived>
11090template <
typename Derived>
11096template <
typename Derived>
11103template <
typename Derived>
11105 OMPUpdateDependObjectsClause *
C) {
11110template <
typename Derived>
11117template <
typename Derived>
11124template <
typename Derived>
11130template <
typename Derived>
11136template <
typename Derived>
11138 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11141 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11142 C->getLParenLoc(),
C->getEndLoc());
11145template <
typename Derived>
11151template <
typename Derived>
11156template <
typename Derived>
11158 OMPNoOpenMPRoutinesClause *
C) {
11161template <
typename Derived>
11163 OMPNoOpenMPConstructsClause *
C) {
11166template <
typename Derived>
11168 OMPNoParallelismClause *
C) {
11172template <
typename Derived>
11179template <
typename Derived>
11186template <
typename Derived>
11193template <
typename Derived>
11200template <
typename Derived>
11207template <
typename Derived>
11213template <
typename Derived>
11220template <
typename Derived>
11226template <
typename Derived>
11233template <
typename Derived>
11235 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11236 if (IVR.isInvalid())
11240 for (OMPInitClause::PrefView P :
C->prefs()) {
11241 Expr *NewFr =
nullptr;
11243 ExprResult ER = getDerived().TransformExpr(P.Fr);
11244 if (ER.isInvalid())
11249 NewAttrs.reserve(P.Attrs.size());
11250 for (
Expr *A : P.Attrs) {
11251 ExprResult ER = getDerived().TransformExpr(A);
11252 if (ER.isInvalid())
11254 NewAttrs.push_back(ER.get());
11256 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11258 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11259 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11260 C->getBeginLoc(),
C->getLParenLoc(),
11261 C->getVarLoc(),
C->getEndLoc());
11264template <
typename Derived>
11266 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11267 if (ER.isInvalid())
11269 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11270 C->getLParenLoc(),
C->getVarLoc(),
11274template <
typename Derived>
11278 if (
Expr *IV =
C->getInteropVar()) {
11279 ER = getDerived().TransformExpr(IV);
11280 if (ER.isInvalid())
11283 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11284 C->getLParenLoc(),
C->getVarLoc(),
11288template <
typename Derived>
11292 if (
Cond.isInvalid())
11294 return getDerived().RebuildOMPNovariantsClause(
11295 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11298template <
typename Derived>
11302 if (
Cond.isInvalid())
11304 return getDerived().RebuildOMPNocontextClause(
11305 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11308template <
typename Derived>
11311 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11312 if (ThreadID.isInvalid())
11314 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11315 C->getLParenLoc(),
C->getEndLoc());
11318template <
typename Derived>
11320 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11323 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11324 C->getLParenLoc(),
C->getEndLoc());
11327template <
typename Derived>
11329 OMPUnifiedAddressClause *
C) {
11330 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11333template <
typename Derived>
11335 OMPUnifiedSharedMemoryClause *
C) {
11337 "unified_shared_memory clause cannot appear in dependent context");
11340template <
typename Derived>
11342 OMPReverseOffloadClause *
C) {
11343 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11346template <
typename Derived>
11348 OMPDynamicAllocatorsClause *
C) {
11350 "dynamic_allocators clause cannot appear in dependent context");
11353template <
typename Derived>
11355 OMPAtomicDefaultMemOrderClause *
C) {
11357 "atomic_default_mem_order clause cannot appear in dependent context");
11360template <
typename Derived>
11363 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11366template <
typename Derived>
11369 C->getBeginLoc(),
C->getLParenLoc(),
11373template <
typename Derived>
11377 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11378 C->getLParenLoc(),
C->getEndLoc());
11381template <
typename Derived>
11384 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11387 return getDerived().RebuildOMPMessageClause(
11388 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11391template <
typename Derived>
11395 Vars.reserve(
C->varlist_size());
11396 for (
auto *
VE :
C->varlist()) {
11398 if (EVar.isInvalid())
11400 Vars.push_back(EVar.get());
11402 return getDerived().RebuildOMPPrivateClause(
11403 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11406template <
typename Derived>
11408 OMPFirstprivateClause *
C) {
11410 Vars.reserve(
C->varlist_size());
11411 for (
auto *
VE :
C->varlist()) {
11413 if (EVar.isInvalid())
11415 Vars.push_back(EVar.get());
11417 return getDerived().RebuildOMPFirstprivateClause(
11418 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11421template <
typename Derived>
11425 Vars.reserve(
C->varlist_size());
11426 for (
auto *
VE :
C->varlist()) {
11428 if (EVar.isInvalid())
11430 Vars.push_back(EVar.get());
11432 return getDerived().RebuildOMPLastprivateClause(
11433 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11434 C->getLParenLoc(),
C->getEndLoc());
11437template <
typename Derived>
11441 Vars.reserve(
C->varlist_size());
11442 for (
auto *
VE :
C->varlist()) {
11444 if (EVar.isInvalid())
11446 Vars.push_back(EVar.get());
11448 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11449 C->getLParenLoc(),
C->getEndLoc());
11452template <
typename Derived>
11456 Vars.reserve(
C->varlist_size());
11457 for (
auto *
VE :
C->varlist()) {
11459 if (EVar.isInvalid())
11461 Vars.push_back(EVar.get());
11464 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11467 if (NameInfo.getName()) {
11468 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11469 if (!NameInfo.getName())
11475 for (
auto *E :
C->reduction_ops()) {
11480 for (
auto *D : ULE->decls()) {
11483 Decls.addDecl(InstD, InstD->getAccess());
11487 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11488 true, Decls.begin(), Decls.end(),
11491 UnresolvedReductions.push_back(
nullptr);
11493 return getDerived().RebuildOMPReductionClause(
11494 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11495 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11496 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11499template <
typename Derived>
11501 OMPTaskReductionClause *
C) {
11503 Vars.reserve(
C->varlist_size());
11504 for (
auto *
VE :
C->varlist()) {
11506 if (EVar.isInvalid())
11508 Vars.push_back(EVar.get());
11511 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11514 if (NameInfo.getName()) {
11515 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11516 if (!NameInfo.getName())
11522 for (
auto *E :
C->reduction_ops()) {
11527 for (
auto *D : ULE->decls()) {
11530 Decls.addDecl(InstD, InstD->getAccess());
11534 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11535 true, Decls.begin(), Decls.end(),
11538 UnresolvedReductions.push_back(
nullptr);
11540 return getDerived().RebuildOMPTaskReductionClause(
11541 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11542 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11545template <
typename Derived>
11549 Vars.reserve(
C->varlist_size());
11550 for (
auto *
VE :
C->varlist()) {
11552 if (EVar.isInvalid())
11554 Vars.push_back(EVar.get());
11557 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11560 if (NameInfo.getName()) {
11561 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11562 if (!NameInfo.getName())
11568 for (
auto *E :
C->reduction_ops()) {
11573 for (
auto *D : ULE->decls()) {
11576 Decls.addDecl(InstD, InstD->getAccess());
11580 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11581 true, Decls.begin(), Decls.end(),
11584 UnresolvedReductions.push_back(
nullptr);
11586 return getDerived().RebuildOMPInReductionClause(
11587 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11588 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11591template <
typename Derived>
11595 Vars.reserve(
C->varlist_size());
11596 for (
auto *
VE :
C->varlist()) {
11598 if (EVar.isInvalid())
11600 Vars.push_back(EVar.get());
11602 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11603 if (Step.isInvalid())
11605 return getDerived().RebuildOMPLinearClause(
11606 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11607 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11611template <
typename Derived>
11615 Vars.reserve(
C->varlist_size());
11616 for (
auto *
VE :
C->varlist()) {
11618 if (EVar.isInvalid())
11620 Vars.push_back(EVar.get());
11622 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11623 if (Alignment.isInvalid())
11625 return getDerived().RebuildOMPAlignedClause(
11626 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11627 C->getColonLoc(),
C->getEndLoc());
11630template <
typename Derived>
11634 Vars.reserve(
C->varlist_size());
11635 for (
auto *
VE :
C->varlist()) {
11637 if (EVar.isInvalid())
11639 Vars.push_back(EVar.get());
11641 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11642 C->getLParenLoc(),
C->getEndLoc());
11645template <
typename Derived>
11649 Vars.reserve(
C->varlist_size());
11650 for (
auto *
VE :
C->varlist()) {
11652 if (EVar.isInvalid())
11654 Vars.push_back(EVar.get());
11656 return getDerived().RebuildOMPCopyprivateClause(
11657 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11660template <
typename Derived>
11663 Vars.reserve(
C->varlist_size());
11664 for (
auto *
VE :
C->varlist()) {
11666 if (EVar.isInvalid())
11668 Vars.push_back(EVar.get());
11670 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11671 C->getLParenLoc(),
C->getEndLoc());
11674template <
typename Derived>
11677 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11680 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11681 C->getLParenLoc(),
C->getEndLoc());
11684template <
typename Derived>
11688 Expr *DepModifier =
C->getModifier();
11690 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11691 if (DepModRes.isInvalid())
11693 DepModifier = DepModRes.get();
11695 Vars.reserve(
C->varlist_size());
11696 for (
auto *
VE :
C->varlist()) {
11698 if (EVar.isInvalid())
11700 Vars.push_back(EVar.get());
11702 return getDerived().RebuildOMPDependClause(
11703 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11704 C->getOmpAllMemoryLoc()},
11705 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11708template <
typename Derived>
11711 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11714 return getDerived().RebuildOMPDeviceClause(
11715 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11716 C->getModifierLoc(),
C->getEndLoc());
11719template <
typename Derived,
class T>
11726 Vars.reserve(
C->varlist_size());
11727 for (
auto *
VE :
C->varlist()) {
11731 Vars.push_back(EVar.
get());
11735 if (
C->getMapperQualifierLoc()) {
11736 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11737 C->getMapperQualifierLoc());
11741 MapperIdScopeSpec.
Adopt(QualifierLoc);
11742 MapperIdInfo =
C->getMapperIdInfo();
11743 if (MapperIdInfo.
getName()) {
11744 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11750 for (
auto *E :
C->mapperlists()) {
11755 for (
auto *D : ULE->decls()) {
11758 Decls.addDecl(InstD, InstD->
getAccess());
11763 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11766 UnresolvedMappers.push_back(
nullptr);
11772template <
typename Derived>
11774 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11776 Expr *IteratorModifier =
C->getIteratorModifier();
11777 if (IteratorModifier) {
11778 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11779 if (MapModRes.isInvalid())
11781 IteratorModifier = MapModRes.
get();
11787 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11789 return getDerived().RebuildOMPMapClause(
11790 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11791 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11792 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11795template <
typename Derived>
11798 Expr *Allocator =
C->getAllocator();
11800 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11801 if (AllocatorRes.isInvalid())
11803 Allocator = AllocatorRes.get();
11805 Expr *Alignment =
C->getAlignment();
11807 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11808 if (AlignmentRes.isInvalid())
11810 Alignment = AlignmentRes.get();
11813 Vars.reserve(
C->varlist_size());
11814 for (
auto *
VE :
C->varlist()) {
11816 if (EVar.isInvalid())
11818 Vars.push_back(EVar.get());
11820 return getDerived().RebuildOMPAllocateClause(
11821 Allocator, Alignment,
C->getFirstAllocateModifier(),
11822 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11823 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11824 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11827template <
typename Derived>
11831 Vars.reserve(
C->varlist_size());
11832 for (
auto *
VE :
C->varlist()) {
11834 if (EVar.isInvalid())
11836 Vars.push_back(EVar.get());
11838 Expr *ModifierExpr =
C->getModifierExpr();
11839 if (ModifierExpr) {
11841 if (EVar.isInvalid())
11843 ModifierExpr = EVar.get();
11845 return getDerived().RebuildOMPNumTeamsClause(
11846 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
11848 C->getLParenLoc(),
C->getEndLoc());
11851template <
typename Derived>
11855 Vars.reserve(
C->varlist_size());
11856 for (
auto *
VE :
C->varlist()) {
11858 if (EVar.isInvalid())
11860 Vars.push_back(EVar.get());
11862 Expr *ModifierExpr =
C->getModifierExpr();
11863 if (ModifierExpr) {
11865 if (EVar.isInvalid())
11867 ModifierExpr = EVar.get();
11869 return getDerived().RebuildOMPThreadLimitClause(
11870 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
11871 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11874template <
typename Derived>
11877 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11880 return getDerived().RebuildOMPPriorityClause(
11881 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11884template <
typename Derived>
11887 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11890 return getDerived().RebuildOMPGrainsizeClause(
11891 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11892 C->getModifierLoc(),
C->getEndLoc());
11895template <
typename Derived>
11898 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11901 return getDerived().RebuildOMPNumTasksClause(
11902 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11903 C->getModifierLoc(),
C->getEndLoc());
11906template <
typename Derived>
11908 ExprResult E = getDerived().TransformExpr(
C->getHint());
11911 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11912 C->getLParenLoc(),
C->getEndLoc());
11915template <
typename Derived>
11917 OMPDistScheduleClause *
C) {
11918 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11921 return getDerived().RebuildOMPDistScheduleClause(
11922 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11923 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11926template <
typename Derived>
11932 C->getDefaultmapKind(),
11935 C->getDefaultmapModifierLoc(),
11936 C->getDefaultmapKindLoc(),
11940template <
typename Derived>
11944 Expr *IteratorModifier =
C->getIteratorModifier();
11945 if (IteratorModifier) {
11946 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11947 if (MapModRes.isInvalid())
11949 IteratorModifier = MapModRes.get();
11955 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11957 return getDerived().RebuildOMPToClause(
11958 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11959 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11960 UnresolvedMappers);
11963template <
typename Derived>
11967 Expr *IteratorModifier =
C->getIteratorModifier();
11968 if (IteratorModifier) {
11969 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11970 if (MapModRes.isInvalid())
11972 IteratorModifier = MapModRes.get();
11978 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11980 return getDerived().RebuildOMPFromClause(
11981 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11982 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11983 UnresolvedMappers);
11986template <
typename Derived>
11988 OMPUseDevicePtrClause *
C) {
11990 Vars.reserve(
C->varlist_size());
11991 for (
auto *
VE :
C->varlist()) {
11993 if (EVar.isInvalid())
11995 Vars.push_back(EVar.get());
11998 return getDerived().RebuildOMPUseDevicePtrClause(
11999 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12002template <
typename Derived>
12004 OMPUseDeviceAddrClause *
C) {
12006 Vars.reserve(
C->varlist_size());
12007 for (
auto *
VE :
C->varlist()) {
12009 if (EVar.isInvalid())
12011 Vars.push_back(EVar.get());
12014 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12017template <
typename Derived>
12021 Vars.reserve(
C->varlist_size());
12022 for (
auto *
VE :
C->varlist()) {
12024 if (EVar.isInvalid())
12026 Vars.push_back(EVar.get());
12029 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12032template <
typename Derived>
12034 OMPHasDeviceAddrClause *
C) {
12036 Vars.reserve(
C->varlist_size());
12037 for (
auto *
VE :
C->varlist()) {
12039 if (EVar.isInvalid())
12041 Vars.push_back(EVar.get());
12044 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12047template <
typename Derived>
12051 Vars.reserve(
C->varlist_size());
12052 for (
auto *
VE :
C->varlist()) {
12054 if (EVar.isInvalid())
12056 Vars.push_back(EVar.get());
12058 return getDerived().RebuildOMPNontemporalClause(
12059 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12062template <
typename Derived>
12066 Vars.reserve(
C->varlist_size());
12067 for (
auto *
VE :
C->varlist()) {
12069 if (EVar.isInvalid())
12071 Vars.push_back(EVar.get());
12073 return getDerived().RebuildOMPInclusiveClause(
12074 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12077template <
typename Derived>
12081 Vars.reserve(
C->varlist_size());
12082 for (
auto *
VE :
C->varlist()) {
12084 if (EVar.isInvalid())
12086 Vars.push_back(EVar.get());
12088 return getDerived().RebuildOMPExclusiveClause(
12089 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12092template <
typename Derived>
12094 OMPUsesAllocatorsClause *
C) {
12096 Data.reserve(
C->getNumberOfAllocators());
12097 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12098 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12100 if (Allocator.isInvalid())
12104 AllocatorTraits = getDerived().TransformExpr(AT);
12105 if (AllocatorTraits.isInvalid())
12109 NewD.Allocator = Allocator.get();
12110 NewD.AllocatorTraits = AllocatorTraits.get();
12114 return getDerived().RebuildOMPUsesAllocatorsClause(
12115 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12118template <
typename Derived>
12122 Locators.reserve(
C->varlist_size());
12124 if (
Expr *Modifier =
C->getModifier()) {
12125 ModifierRes = getDerived().TransformExpr(Modifier);
12126 if (ModifierRes.isInvalid())
12129 for (
Expr *E :
C->varlist()) {
12130 ExprResult Locator = getDerived().TransformExpr(E);
12131 if (Locator.isInvalid())
12133 Locators.push_back(Locator.get());
12135 return getDerived().RebuildOMPAffinityClause(
12136 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12137 ModifierRes.get(), Locators);
12140template <
typename Derived>
12143 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12144 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12147template <
typename Derived>
12150 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12151 C->getLParenLoc(),
C->getEndLoc());
12154template <
typename Derived>
12156 OMPXDynCGroupMemClause *
C) {
12158 if (
Size.isInvalid())
12160 return getDerived().RebuildOMPXDynCGroupMemClause(
12161 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12164template <
typename Derived>
12166 OMPDynGroupprivateClause *
C) {
12168 if (
Size.isInvalid())
12170 return getDerived().RebuildOMPDynGroupprivateClause(
12171 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12172 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12173 C->getDynGroupprivateModifierLoc(),
12174 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12177template <
typename Derived>
12181 Vars.reserve(
C->varlist_size());
12182 for (
auto *
VE :
C->varlist()) {
12184 if (EVar.isInvalid())
12186 Vars.push_back(EVar.get());
12188 return getDerived().RebuildOMPDoacrossClause(
12189 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12190 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12193template <
typename Derived>
12197 for (
auto *A :
C->getAttrs())
12198 NewAttrs.push_back(getDerived().TransformAttr(A));
12199 return getDerived().RebuildOMPXAttributeClause(
12200 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12203template <
typename Derived>
12212template <
typename Derived>
12213class OpenACCClauseTransform final
12215 TreeTransform<Derived> &Self;
12216 ArrayRef<const OpenACCClause *> ExistingClauses;
12217 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12218 OpenACCClause *NewClause =
nullptr;
12221 ExprResult Res = Self.TransformExpr(VarRef);
12223 if (!Res.isUsable())
12226 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12227 ParsedClause.getClauseKind(),
12233 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12234 llvm::SmallVector<Expr *> InstantiatedVarList;
12235 for (Expr *CurVar : VarList) {
12238 if (VarRef.isUsable())
12239 InstantiatedVarList.push_back(VarRef.get());
12242 return InstantiatedVarList;
12246 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12247 ArrayRef<const OpenACCClause *> ExistingClauses,
12248 SemaOpenACC::OpenACCParsedClause &PC)
12249 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12251 OpenACCClause *CreatedClause()
const {
return NewClause; }
12253#define VISIT_CLAUSE(CLAUSE_NAME) \
12254 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12255#include "clang/Basic/OpenACCClauses.def"
12258template <
typename Derived>
12259void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12261 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12264 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12265 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12266 ParsedClause.getEndLoc());
12269template <
typename Derived>
12270void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12272 assert(
Cond &&
"If constructed with invalid Condition");
12276 if (Res.isInvalid() || !Res.get().second)
12279 ParsedClause.setConditionDetails(Res.get().second);
12282 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12283 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12284 ParsedClause.getEndLoc());
12287template <
typename Derived>
12288void OpenACCClauseTransform<Derived>::VisitSelfClause(
12294 for (
Expr *CurVar :
C.getVarList()) {
12297 if (!Res.isUsable())
12300 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12301 ParsedClause.getClauseKind(),
12304 if (Res.isUsable())
12305 InstantiatedVarList.push_back(Res.get());
12308 ParsedClause.setVarListDetails(InstantiatedVarList,
12312 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12313 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12314 ParsedClause.getEndLoc());
12317 if (
C.hasConditionExpr()) {
12320 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12323 if (Res.isInvalid() || !Res.get().second)
12326 ParsedClause.setConditionDetails(Res.get().second);
12330 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12331 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12332 ParsedClause.getEndLoc());
12336template <
typename Derived>
12337void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12341 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12344 if (!Res.isUsable())
12349 C.getBeginLoc(), Res.get());
12350 if (!Res.isUsable())
12353 InstantiatedIntExprs.push_back(Res.get());
12356 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12358 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12359 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12360 ParsedClause.getEndLoc());
12363template <
typename Derived>
12364void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12369 for (
const auto [RefExpr, InitRecipe] :
12370 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12373 if (VarRef.isUsable()) {
12374 InstantiatedVarList.push_back(VarRef.get());
12378 if (InitRecipe.isSet())
12379 InitRecipes.push_back(InitRecipe);
12381 InitRecipes.push_back(
12382 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12385 ParsedClause.setVarListDetails(InstantiatedVarList,
12389 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12390 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12391 ParsedClause.getEndLoc());
12394template <
typename Derived>
12395void OpenACCClauseTransform<Derived>::VisitHostClause(
12397 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12401 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12402 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12403 ParsedClause.getEndLoc());
12406template <
typename Derived>
12407void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12409 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12413 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12414 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12415 ParsedClause.getEndLoc());
12418template <
typename Derived>
12419void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12424 for (
const auto [RefExpr, InitRecipe] :
12425 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12428 if (VarRef.isUsable()) {
12429 InstantiatedVarList.push_back(VarRef.get());
12433 if (InitRecipe.isSet())
12434 InitRecipes.push_back(InitRecipe);
12436 InitRecipes.push_back(
12437 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12441 ParsedClause.setVarListDetails(InstantiatedVarList,
12445 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12446 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12447 ParsedClause.getEndLoc());
12450template <
typename Derived>
12451void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12453 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12457 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12458 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12459 ParsedClause.getEndLoc());
12462template <
typename Derived>
12463void OpenACCClauseTransform<Derived>::VisitPresentClause(
12465 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12469 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12470 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12471 ParsedClause.getEndLoc());
12474template <
typename Derived>
12475void OpenACCClauseTransform<Derived>::VisitCopyClause(
12477 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12478 C.getModifierList());
12481 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12482 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12483 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12484 ParsedClause.getEndLoc());
12487template <
typename Derived>
12488void OpenACCClauseTransform<Derived>::VisitLinkClause(
12490 llvm_unreachable(
"link clause not valid unless a decl transform");
12493template <
typename Derived>
12494void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12496 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12498template <
typename Derived>
12499void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12501 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12503template <
typename Derived>
12504void OpenACCClauseTransform<Derived>::VisitBindClause(
12506 llvm_unreachable(
"bind clause not valid unless a decl transform");
12509template <
typename Derived>
12510void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12512 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12513 C.getModifierList());
12516 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12517 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12518 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12519 ParsedClause.getEndLoc());
12522template <
typename Derived>
12523void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12525 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12526 C.getModifierList());
12529 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12530 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12531 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12532 ParsedClause.getEndLoc());
12535template <
typename Derived>
12536void OpenACCClauseTransform<Derived>::VisitCreateClause(
12538 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12539 C.getModifierList());
12542 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12543 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12544 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12545 ParsedClause.getEndLoc());
12547template <
typename Derived>
12548void OpenACCClauseTransform<Derived>::VisitAttachClause(
12553 llvm::erase_if(VarList, [&](
Expr *E) {
12554 return Self.getSema().OpenACC().CheckVarIsPointerType(
12560 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12561 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12562 ParsedClause.getEndLoc());
12565template <
typename Derived>
12566void OpenACCClauseTransform<Derived>::VisitDetachClause(
12571 llvm::erase_if(VarList, [&](
Expr *E) {
12572 return Self.getSema().OpenACC().CheckVarIsPointerType(
12578 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12579 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12580 ParsedClause.getEndLoc());
12583template <
typename Derived>
12584void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12586 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12589 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12590 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12591 ParsedClause.getEndLoc());
12594template <
typename Derived>
12595void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
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>::VisitDevicePtrClause(
12611 llvm::erase_if(VarList, [&](
Expr *E) {
12612 return Self.getSema().OpenACC().CheckVarIsPointerType(
12618 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12619 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12620 ParsedClause.getEndLoc());
12623template <
typename Derived>
12624void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12626 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12627 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12630 if (!Res.isUsable())
12635 C.getBeginLoc(), Res.get());
12636 if (!Res.isUsable())
12639 ParsedClause.setIntExprDetails(Res.get());
12641 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12642 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12643 ParsedClause.getEndLoc());
12646template <
typename Derived>
12647void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12649 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12650 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12653 if (!Res.isUsable())
12658 C.getBeginLoc(), Res.get());
12659 if (!Res.isUsable())
12662 ParsedClause.setIntExprDetails(Res.get());
12664 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12665 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12666 ParsedClause.getEndLoc());
12669template <
typename Derived>
12670void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12672 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12673 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12676 if (!Res.isUsable())
12681 C.getBeginLoc(), Res.get());
12682 if (!Res.isUsable())
12685 ParsedClause.setIntExprDetails(Res.get());
12687 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12688 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12689 ParsedClause.getEndLoc());
12692template <
typename Derived>
12693void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12695 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12696 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12699 if (!Res.isUsable())
12704 C.getBeginLoc(), Res.get());
12705 if (!Res.isUsable())
12708 ParsedClause.setIntExprDetails(Res.get());
12710 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12711 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12712 ParsedClause.getEndLoc());
12715template <
typename Derived>
12716void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12718 if (
C.hasIntExpr()) {
12720 if (!Res.isUsable())
12725 C.getBeginLoc(), Res.get());
12726 if (!Res.isUsable())
12728 ParsedClause.setIntExprDetails(Res.get());
12732 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12733 ParsedClause.getLParenLoc(),
12734 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12736 ParsedClause.getEndLoc());
12739template <
typename Derived>
12740void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12742 if (
C.hasIntExpr()) {
12747 if (!Res.isUsable())
12752 C.getBeginLoc(), Res.get());
12753 if (!Res.isUsable())
12755 ParsedClause.setIntExprDetails(Res.get());
12759 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12760 ParsedClause.getLParenLoc(),
12761 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12763 ParsedClause.getEndLoc());
12766template <
typename Derived>
12767void OpenACCClauseTransform<Derived>::VisitVectorClause(
12769 if (
C.hasIntExpr()) {
12774 if (!Res.isUsable())
12779 C.getBeginLoc(), Res.get());
12780 if (!Res.isUsable())
12782 ParsedClause.setIntExprDetails(Res.get());
12786 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12787 ParsedClause.getLParenLoc(),
12788 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12790 ParsedClause.getEndLoc());
12793template <
typename Derived>
12794void OpenACCClauseTransform<Derived>::VisitWaitClause(
12796 if (
C.hasExprs()) {
12797 Expr *DevNumExpr =
nullptr;
12801 if (
C.getDevNumExpr()) {
12803 if (!Res.isUsable())
12807 C.getBeginLoc(), Res.get());
12808 if (!Res.isUsable())
12811 DevNumExpr = Res.get();
12815 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12817 if (!Res.isUsable())
12821 C.getBeginLoc(), Res.get());
12822 if (!Res.isUsable())
12825 InstantiatedQueueIdExprs.push_back(Res.get());
12828 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12829 std::move(InstantiatedQueueIdExprs));
12833 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12834 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12835 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12836 ParsedClause.getEndLoc());
12839template <
typename Derived>
12840void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12844 Self.getSema().getASTContext(),
C.getClauseKind(),
12845 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12846 C.getArchitectures(), ParsedClause.getEndLoc());
12849template <
typename Derived>
12850void OpenACCClauseTransform<Derived>::VisitAutoClause(
12854 ParsedClause.getBeginLoc(),
12855 ParsedClause.getEndLoc());
12858template <
typename Derived>
12859void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12862 ParsedClause.getBeginLoc(),
12863 ParsedClause.getEndLoc());
12866template <
typename Derived>
12867void OpenACCClauseTransform<Derived>::VisitSeqClause(
12870 ParsedClause.getBeginLoc(),
12871 ParsedClause.getEndLoc());
12873template <
typename Derived>
12874void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12877 ParsedClause.getBeginLoc(),
12878 ParsedClause.getEndLoc());
12881template <
typename Derived>
12882void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12885 ParsedClause.getBeginLoc(),
12886 ParsedClause.getEndLoc());
12889template <
typename Derived>
12890void OpenACCClauseTransform<Derived>::VisitReductionClause(
12896 for (
const auto [Var, OrigRecipe] :
12897 llvm::zip(TransformedVars,
C.getRecipes())) {
12899 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12900 if (Res.isUsable()) {
12901 ValidVars.push_back(Res.get());
12903 if (OrigRecipe.isSet())
12904 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12906 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12907 C.getReductionOp(), Res.get()));
12911 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12912 ExistingClauses, ParsedClause.getDirectiveKind(),
12913 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12914 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12917template <
typename Derived>
12918void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12920 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12921 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12925 if (!NewLoopCount.isUsable())
12928 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12930 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12934 if (!NewLoopCount.isUsable())
12938 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12942 if (!NewLoopCount.isUsable())
12945 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12947 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12948 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12949 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12952template <
typename Derived>
12953void OpenACCClauseTransform<Derived>::VisitTileClause(
12958 for (
Expr *E :
C.getSizeExprs()) {
12961 if (!NewSizeExpr.isUsable())
12964 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12966 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12970 if (!NewSizeExpr.isUsable())
12973 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12975 if (!NewSizeExpr.isUsable())
12977 TransformedExprs.push_back(NewSizeExpr.get());
12980 ParsedClause.setIntExprDetails(TransformedExprs);
12982 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12983 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12984 ParsedClause.getEndLoc());
12986template <
typename Derived>
12987void OpenACCClauseTransform<Derived>::VisitGangClause(
12992 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12994 if (!ER.isUsable())
12997 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12998 ParsedClause.getDirectiveKind(),
12999 C.getExpr(I).first, ER.get());
13000 if (!ER.isUsable())
13002 TransformedGangKinds.push_back(
C.getExpr(I).first);
13003 TransformedIntExprs.push_back(ER.get());
13006 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13007 ParsedClause.getDirectiveKind(), ExistingClauses,
13008 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13009 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13012template <
typename Derived>
13013OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13018 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13019 ParsedClause.setEndLoc(OldClause->getEndLoc());
13021 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13022 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13024 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13026 Transform.Visit(OldClause);
13028 return Transform.CreatedClause();
13031template <
typename Derived>
13033TreeTransform<Derived>::TransformOpenACCClauseList(
13036 for (
const auto *Clause : OldClauses) {
13037 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13038 TransformedClauses, DirKind, Clause))
13039 TransformedClauses.push_back(TransformedClause);
13041 return TransformedClauses;
13044template <
typename Derived>
13047 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13050 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13053 if (getSema().OpenACC().ActOnStartStmtDirective(
13054 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13059 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13060 C->clauses(), TransformedClauses);
13061 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13062 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13063 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13065 return getDerived().RebuildOpenACCComputeConstruct(
13066 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13067 C->getEndLoc(), TransformedClauses, StrBlock);
13070template <
typename Derived>
13074 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13077 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13080 if (getSema().OpenACC().ActOnStartStmtDirective(
13081 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13086 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13087 C->clauses(), TransformedClauses);
13089 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13090 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13092 return getDerived().RebuildOpenACCLoopConstruct(
13093 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13094 TransformedClauses,
Loop);
13097template <
typename Derived>
13099 OpenACCCombinedConstruct *
C) {
13100 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13103 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13106 if (getSema().OpenACC().ActOnStartStmtDirective(
13107 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13112 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13113 C->clauses(), TransformedClauses);
13115 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13116 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13118 return getDerived().RebuildOpenACCCombinedConstruct(
13119 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13120 C->getEndLoc(), TransformedClauses,
Loop);
13123template <
typename Derived>
13126 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13129 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13131 if (getSema().OpenACC().ActOnStartStmtDirective(
13132 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13136 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13137 C->clauses(), TransformedClauses);
13138 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13139 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13140 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13142 return getDerived().RebuildOpenACCDataConstruct(
13143 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13144 TransformedClauses, StrBlock);
13147template <
typename Derived>
13149 OpenACCEnterDataConstruct *
C) {
13150 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13153 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13155 if (getSema().OpenACC().ActOnStartStmtDirective(
13156 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13159 return getDerived().RebuildOpenACCEnterDataConstruct(
13160 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13161 TransformedClauses);
13164template <
typename Derived>
13166 OpenACCExitDataConstruct *
C) {
13167 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13170 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13172 if (getSema().OpenACC().ActOnStartStmtDirective(
13173 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13176 return getDerived().RebuildOpenACCExitDataConstruct(
13177 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13178 TransformedClauses);
13181template <
typename Derived>
13183 OpenACCHostDataConstruct *
C) {
13184 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13187 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13189 if (getSema().OpenACC().ActOnStartStmtDirective(
13190 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13194 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13195 C->clauses(), TransformedClauses);
13196 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13197 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13198 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13200 return getDerived().RebuildOpenACCHostDataConstruct(
13201 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13202 TransformedClauses, StrBlock);
13205template <
typename Derived>
13208 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13211 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13213 if (getSema().OpenACC().ActOnStartStmtDirective(
13214 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13217 return getDerived().RebuildOpenACCInitConstruct(
13218 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13219 TransformedClauses);
13222template <
typename Derived>
13224 OpenACCShutdownConstruct *
C) {
13225 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13228 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13230 if (getSema().OpenACC().ActOnStartStmtDirective(
13231 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13234 return getDerived().RebuildOpenACCShutdownConstruct(
13235 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13236 TransformedClauses);
13238template <
typename Derived>
13241 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13244 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13246 if (getSema().OpenACC().ActOnStartStmtDirective(
13247 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13250 return getDerived().RebuildOpenACCSetConstruct(
13251 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13252 TransformedClauses);
13255template <
typename Derived>
13257 OpenACCUpdateConstruct *
C) {
13258 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13261 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13263 if (getSema().OpenACC().ActOnStartStmtDirective(
13264 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13267 return getDerived().RebuildOpenACCUpdateConstruct(
13268 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13269 TransformedClauses);
13272template <
typename Derived>
13275 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13278 if (
C->hasDevNumExpr()) {
13279 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13281 if (DevNumExpr.isUsable())
13282 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13284 C->getBeginLoc(), DevNumExpr.get());
13289 for (
Expr *QE :
C->getQueueIdExprs()) {
13290 assert(QE &&
"Null queue id expr?");
13291 ExprResult NewEQ = getDerived().TransformExpr(QE);
13293 if (!NewEQ.isUsable())
13297 C->getBeginLoc(), NewEQ.get());
13298 if (NewEQ.isUsable())
13299 QueueIdExprs.push_back(NewEQ.get());
13303 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13306 if (getSema().OpenACC().ActOnStartStmtDirective(
13307 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13310 return getDerived().RebuildOpenACCWaitConstruct(
13311 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13312 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13313 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13315template <
typename Derived>
13317 OpenACCCacheConstruct *
C) {
13318 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13321 for (
Expr *Var :
C->getVarList()) {
13322 assert(Var &&
"Null var listexpr?");
13324 ExprResult NewVar = getDerived().TransformExpr(Var);
13326 if (!NewVar.isUsable())
13329 NewVar = getSema().OpenACC().ActOnVar(
13331 if (!NewVar.isUsable())
13334 TransformedVarList.push_back(NewVar.get());
13337 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13338 C->getBeginLoc(), {}))
13341 return getDerived().RebuildOpenACCCacheConstruct(
13342 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13343 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13347template <
typename Derived>
13349 OpenACCAtomicConstruct *
C) {
13350 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13353 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13356 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13357 C->getBeginLoc(), {}))
13362 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13364 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13365 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13366 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13369 return getDerived().RebuildOpenACCAtomicConstruct(
13370 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13371 C->getEndLoc(), TransformedClauses, AssocStmt);
13374template <
typename Derived>
13377 if (getDerived().AlwaysRebuild())
13386template<
typename Derived>
13389 return TransformExpr(E->getSubExpr());
13392template <
typename Derived>
13395 if (!E->isTypeDependent())
13398 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13403 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13406 return getDerived().RebuildSYCLUniqueStableNameExpr(
13407 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13410template <
typename Derived>
13414 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13415 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13418 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13419 if (IdExpr.isInvalid())
13422 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13423 if (Body.isInvalid())
13429 if (SR.isInvalid())
13435template <
typename Derived>
13438 assert(
false &&
"not implemented yet");
13442template<
typename Derived>
13445 if (!E->isTypeDependent())
13449 E->getIdentKind());
13452template<
typename Derived>
13456 if (E->getQualifierLoc()) {
13458 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13464 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13466 if (!ND || ND->isInvalidDecl())
13470 if (E->getFoundDecl() != E->getDecl()) {
13471 Found = cast_or_null<NamedDecl>(
13472 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13478 if (NameInfo.getName()) {
13479 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13480 if (!NameInfo.getName())
13484 if (!getDerived().AlwaysRebuild() &&
13485 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13486 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13487 Found == E->getFoundDecl() &&
13488 NameInfo.getName() == E->getDecl()->getDeclName() &&
13489 !E->hasExplicitTemplateArgs()) {
13499 if (E->hasExplicitTemplateArgs()) {
13500 TemplateArgs = &TransArgs;
13501 TransArgs.setLAngleLoc(E->getLAngleLoc());
13502 TransArgs.setRAngleLoc(E->getRAngleLoc());
13503 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13504 E->getNumTemplateArgs(),
13509 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13510 Found, TemplateArgs);
13513template<
typename Derived>
13519template <
typename Derived>
13525template<
typename Derived>
13531template<
typename Derived>
13537template<
typename Derived>
13543template<
typename Derived>
13549template<
typename Derived>
13552 return getDerived().TransformCallExpr(E);
13555template<
typename Derived>
13560 if (E->isExprPredicate())
13561 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13563 ControllingType = getDerived().TransformType(E->getControllingType());
13565 if (ControllingExpr.isInvalid() && !ControllingType)
13576 AssocTypes.push_back(AssocType);
13578 AssocTypes.push_back(
nullptr);
13582 getDerived().TransformExpr(Assoc.getAssociationExpr());
13583 if (AssocExpr.isInvalid())
13585 AssocExprs.push_back(AssocExpr.get());
13588 if (!ControllingType)
13589 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13590 E->getDefaultLoc(),
13592 ControllingExpr.get(),
13595 return getDerived().RebuildGenericSelectionExpr(
13596 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13597 ControllingType, AssocTypes, AssocExprs);
13600template<
typename Derived>
13603 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13604 if (SubExpr.isInvalid())
13607 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13610 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13617template<
typename Derived>
13621 return getDerived().TransformDependentScopeDeclRefExpr(
13622 DRE,
true,
nullptr);
13624 return getDerived().TransformUnresolvedLookupExpr(
13630template<
typename Derived>
13635 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13641 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13649template<
typename Derived>
13651TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13653 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13663 bool ExprChanged =
false;
13665 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13666 const OffsetOfNode &ON = E->getComponent(I);
13667 switch (ON.getKind()) {
13669 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13670 ExprResult Index = getDerived().TransformExpr(FromIndex);
13671 if (Index.isInvalid())
13674 ExprChanged = ExprChanged || Index.get() != FromIndex;
13677 AD.setRBracketLoc(ON.getEndLoc());
13678 Desig.AddDesignator(AD);
13690 Desig.AddDesignator(
13702 if (!getDerived().AlwaysRebuild() &&
13703 Type == E->getTypeSourceInfo() &&
13708 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13709 E->getRParenLoc());
13712template<
typename Derived>
13715 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13716 "opaque value expression requires transformation");
13720template <
typename Derived>
13724 for (
Expr *
C : E->subExpressions()) {
13726 if (NewC.isInvalid())
13732 if (!getDerived().AlwaysRebuild() && !Changed)
13734 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13738template<
typename Derived>
13748 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13749 if (result.isInvalid())
return ExprError();
13754 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13760template<
typename Derived>
13764 if (E->isArgumentType()) {
13771 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13774 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13776 E->getSourceRange());
13790 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13792 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13793 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13794 PE, DRE,
false, &RecoveryTSI);
13796 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13799 return getDerived().RebuildUnaryExprOrTypeTrait(
13800 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13801 }
else if (SubExpr.isInvalid())
13804 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13807 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13808 E->getOperatorLoc(),
13810 E->getSourceRange());
13813template<
typename Derived>
13816 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13817 if (LHS.isInvalid())
13820 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13821 if (RHS.isInvalid())
13825 if (!getDerived().AlwaysRebuild() &&
13826 LHS.get() == E->getLHS() &&
13827 RHS.get() == E->getRHS())
13830 return getDerived().RebuildArraySubscriptExpr(
13832 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13835template <
typename Derived>
13839 if (
Base.isInvalid())
13842 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13843 if (RowIdx.isInvalid())
13846 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13847 RowIdx.get() == E->getRowIdx())
13850 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13851 E->getRBracketLoc());
13854template <
typename Derived>
13858 if (
Base.isInvalid())
13861 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13862 if (RowIdx.isInvalid())
13865 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13866 if (ColumnIdx.isInvalid())
13869 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13870 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13873 return getDerived().RebuildMatrixSubscriptExpr(
13874 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13877template <
typename Derived>
13881 if (
Base.isInvalid())
13885 if (E->getLowerBound()) {
13886 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13887 if (LowerBound.isInvalid())
13892 if (E->getLength()) {
13893 Length = getDerived().TransformExpr(E->getLength());
13894 if (Length.isInvalid())
13899 if (E->isOMPArraySection()) {
13900 if (
Expr *Str = E->getStride()) {
13901 Stride = getDerived().TransformExpr(Str);
13902 if (Stride.isInvalid())
13907 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13908 LowerBound.get() == E->getLowerBound() &&
13909 Length.get() == E->getLength() &&
13910 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13913 return getDerived().RebuildArraySectionExpr(
13914 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13915 LowerBound.get(), E->getColonLocFirst(),
13916 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13917 Length.get(), Stride.get(), E->getRBracketLoc());
13920template <
typename Derived>
13924 if (
Base.isInvalid())
13928 bool ErrorFound =
false;
13929 for (
Expr *
Dim : E->getDimensions()) {
13931 if (DimRes.isInvalid()) {
13935 Dims.push_back(DimRes.get());
13940 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13941 E->getRParenLoc(), Dims,
13942 E->getBracketsRanges());
13945template <
typename Derived>
13948 unsigned NumIterators = E->numOfIterators();
13951 bool ErrorFound =
false;
13952 bool NeedToRebuild = getDerived().AlwaysRebuild();
13953 for (
unsigned I = 0; I < NumIterators; ++I) {
13955 Data[I].DeclIdent = D->getIdentifier();
13956 Data[I].DeclIdentLoc = D->getLocation();
13957 if (D->getLocation() == D->getBeginLoc()) {
13959 "Implicit type must be int.");
13961 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13962 QualType DeclTy = getDerived().TransformType(D->getType());
13969 ErrorFound = ErrorFound ||
13970 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13971 !
Data[I].Type.get().isNull())) ||
13972 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13975 Data[I].Range.Begin = Begin.get();
13976 Data[I].Range.End = End.get();
13977 Data[I].Range.Step = Step.get();
13978 Data[I].AssignLoc = E->getAssignLoc(I);
13979 Data[I].ColonLoc = E->getColonLoc(I);
13980 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13983 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13984 D->getType().getTypePtrOrNull()) ||
13990 if (!NeedToRebuild)
13993 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13994 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13995 if (!Res.isUsable())
13998 for (
unsigned I = 0; I < NumIterators; ++I)
13999 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14000 IE->getIteratorDecl(I));
14004template<
typename Derived>
14013 bool ArgChanged =
false;
14015 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14019 if (!getDerived().AlwaysRebuild() &&
14020 Callee.get() == E->getCallee() &&
14026 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14029 if (E->hasStoredFPFeatures()) {
14031 getSema().CurFPFeatures =
14033 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14036 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14038 E->getRParenLoc());
14041template<
typename Derived>
14045 if (
Base.isInvalid())
14049 if (E->hasQualifier()) {
14051 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14059 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14060 E->getMemberDecl()));
14064 NamedDecl *FoundDecl = E->getFoundDecl();
14065 if (FoundDecl == E->getMemberDecl()) {
14068 FoundDecl = cast_or_null<NamedDecl>(
14069 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14074 if (!getDerived().AlwaysRebuild() &&
14075 Base.get() == E->getBase() &&
14076 QualifierLoc == E->getQualifierLoc() &&
14077 Member == E->getMemberDecl() &&
14078 FoundDecl == E->getFoundDecl() &&
14079 !E->hasExplicitTemplateArgs()) {
14084 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14094 if (E->hasExplicitTemplateArgs()) {
14095 TransArgs.setLAngleLoc(E->getLAngleLoc());
14096 TransArgs.setRAngleLoc(E->getRAngleLoc());
14097 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14098 E->getNumTemplateArgs(),
14111 NamedDecl *FirstQualifierInScope =
nullptr;
14113 if (MemberNameInfo.getName()) {
14114 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14115 if (!MemberNameInfo.getName())
14119 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14126 (E->hasExplicitTemplateArgs()
14127 ? &TransArgs :
nullptr),
14128 FirstQualifierInScope);
14131template<
typename Derived>
14134 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14135 if (LHS.isInvalid())
14139 getDerived().TransformInitializer(E->getRHS(),
false);
14140 if (RHS.isInvalid())
14143 if (!getDerived().AlwaysRebuild() &&
14144 LHS.get() == E->getLHS() &&
14145 RHS.get() == E->getRHS())
14148 if (E->isCompoundAssignmentOp())
14150 return getDerived().RebuildBinaryOperator(
14151 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14154 getSema().CurFPFeatures =
14155 NewOverrides.applyOverrides(getSema().getLangOpts());
14156 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14157 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14158 LHS.get(), RHS.get());
14161template <
typename Derived>
14166 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14167 if (LHS.isInvalid())
14170 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14171 if (RHS.isInvalid())
14177 bool ChangedAnyLookups =
false;
14178 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14179 const_cast<Expr *
>(Decomp.InnerBinOp)};
14180 for (
Expr *PossibleBinOp : PossibleBinOps) {
14181 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14184 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14190 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14191 E->getOperatorLoc(),
Callee->getFoundDecl()));
14195 ChangedAnyLookups =
true;
14196 UnqualLookups.addDecl(
Found);
14199 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14200 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14206 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14211 return getDerived().RebuildCXXRewrittenBinaryOperator(
14212 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14215template<
typename Derived>
14221 getSema().CurFPFeatures =
14222 NewOverrides.applyOverrides(getSema().getLangOpts());
14223 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14224 return getDerived().TransformBinaryOperator(E);
14227template<
typename Derived>
14233 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14234 if (commonExpr.isInvalid())
14237 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14238 if (rhs.isInvalid())
14241 if (!getDerived().AlwaysRebuild() &&
14242 commonExpr.get() == e->getCommon() &&
14243 rhs.get() == e->getFalseExpr())
14246 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14247 e->getQuestionLoc(),
14253template<
typename Derived>
14257 if (
Cond.isInvalid())
14260 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14261 if (LHS.isInvalid())
14264 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14265 if (RHS.isInvalid())
14268 if (!getDerived().AlwaysRebuild() &&
14269 Cond.get() == E->getCond() &&
14270 LHS.get() == E->getLHS() &&
14271 RHS.get() == E->getRHS())
14274 return getDerived().RebuildConditionalOperator(
Cond.get(),
14275 E->getQuestionLoc(),
14281template<
typename Derived>
14286 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14289template<
typename Derived>
14297 = getDerived().TransformExpr(E->getSubExprAsWritten());
14298 if (SubExpr.isInvalid())
14301 if (!getDerived().AlwaysRebuild() &&
14302 Type == E->getTypeInfoAsWritten() &&
14303 SubExpr.get() == E->getSubExpr())
14306 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14312template<
typename Derived>
14320 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14321 if (
Init.isInvalid())
14324 if (!getDerived().AlwaysRebuild() &&
14326 Init.get() == E->getInitializer())
14333 return getDerived().RebuildCompoundLiteralExpr(
14334 E->getLParenLoc(), NewT,
14335 E->getInitializer()->getEndLoc(),
Init.get());
14338template<
typename Derived>
14342 if (
Base.isInvalid())
14345 if (!getDerived().AlwaysRebuild() &&
14346 Base.get() == E->getBase())
14352 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14353 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14357template <
typename Derived>
14361 if (
Base.isInvalid())
14364 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14370 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14371 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14375template<
typename Derived>
14381 bool InitChanged =
false;
14387 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14388 Inits, &InitChanged))
14391 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14398 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14399 E->getRBraceLoc(), E->isExplicit());
14402template<
typename Derived>
14409 if (
Init.isInvalid())
14414 bool ExprChanged =
false;
14416 if (D.isFieldDesignator()) {
14417 if (D.getFieldDecl()) {
14419 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14420 if (Field != D.getFieldDecl())
14423 ExprChanged =
true;
14424 if (
Field->isAnonymousStructOrUnion())
14430 ExprChanged =
true;
14433 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14437 if (D.isArrayDesignator()) {
14438 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14439 if (Index.isInvalid())
14442 Desig.AddDesignator(
14445 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14446 ArrayExprs.push_back(Index.get());
14450 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14452 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14453 if (Start.isInvalid())
14456 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14457 if (End.isInvalid())
14461 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14463 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14464 End.get() != E->getArrayRangeEnd(D);
14466 ArrayExprs.push_back(Start.get());
14467 ArrayExprs.push_back(End.get());
14470 if (!getDerived().AlwaysRebuild() &&
14471 Init.get() == E->getInit() &&
14475 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14476 E->getEqualOrColonLoc(),
14477 E->usesGNUSyntax(),
Init.get());
14482template<
typename Derived>
14486 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14491template<
typename Derived>
14495 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14499template<
typename Derived>
14502 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14506template<
typename Derived>
14509 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14513template<
typename Derived>
14521 QualType T = getDerived().TransformType(E->getType());
14525 if (!getDerived().AlwaysRebuild() &&
14529 return getDerived().RebuildImplicitValueInitExpr(
T);
14532template<
typename Derived>
14535 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14539 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14540 if (SubExpr.isInvalid())
14543 if (!getDerived().AlwaysRebuild() &&
14544 TInfo == E->getWrittenTypeInfo() &&
14545 SubExpr.get() == E->getSubExpr())
14548 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14549 TInfo, E->getRParenLoc());
14552template<
typename Derived>
14555 bool ArgumentChanged =
false;
14557 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14561 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14563 E->getRParenLoc());
14571template<
typename Derived>
14574 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14579 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14583template<
typename Derived>
14588 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14589 if (SubStmt.isInvalid()) {
14594 unsigned OldDepth = E->getTemplateDepth();
14595 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14597 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14598 SubStmt.get() == E->getSubStmt()) {
14604 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14605 E->getRParenLoc(), NewDepth);
14608template<
typename Derived>
14612 if (
Cond.isInvalid())
14615 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14616 if (LHS.isInvalid())
14619 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14620 if (RHS.isInvalid())
14623 if (!getDerived().AlwaysRebuild() &&
14624 Cond.get() == E->getCond() &&
14625 LHS.get() == E->getLHS() &&
14626 RHS.get() == E->getRHS())
14629 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14630 Cond.get(), LHS.get(), RHS.get(),
14631 E->getRParenLoc());
14634template<
typename Derived>
14640template<
typename Derived>
14643 switch (E->getOperator()) {
14647 case OO_Array_Delete:
14648 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14653 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14666 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14667 FakeLParenLoc = EndLoc;
14671 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14675 if (E->getOperator() == OO_Subscript)
14676 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14677 Args, E->getEndLoc());
14679 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14683#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14687#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14688#include "clang/Basic/OperatorKinds.def"
14690 case OO_Conditional:
14691 llvm_unreachable(
"conditional operator is not actually overloadable");
14695 llvm_unreachable(
"not an overloaded operator?");
14699 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14700 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14702 First = getDerived().TransformExpr(E->getArg(0));
14703 if (
First.isInvalid())
14707 if (E->getNumArgs() == 2) {
14709 getDerived().TransformInitializer(E->getArg(1),
false);
14710 if (Second.isInvalid())
14716 getSema().CurFPFeatures =
14717 NewOverrides.applyOverrides(getSema().getLangOpts());
14718 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14724 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14727 return getDerived().RebuildCXXOperatorCallExpr(
14728 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14729 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14734 Callee = ICE->getSubExprAsWritten();
14736 ValueDecl *VD = cast_or_null<ValueDecl>(
14737 getDerived().TransformDecl(DR->getLocation(), DR));
14742 Functions.addDecl(VD);
14744 return getDerived().RebuildCXXOperatorCallExpr(
14745 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14746 false, Functions,
First.get(), Second.get());
14749template<
typename Derived>
14752 return getDerived().TransformCallExpr(E);
14755template <
typename Derived>
14758 getSema().CurContext != E->getParentContext();
14760 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14763 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14764 E->getBeginLoc(), E->getEndLoc(),
14765 getSema().CurContext);
14768template <
typename Derived>
14773template<
typename Derived>
14782 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14783 if (EC.isInvalid())
14787 bool ArgChanged =
false;
14789 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14793 if (!getDerived().AlwaysRebuild() &&
14794 Callee.get() == E->getCallee() &&
14800 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14801 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14803 E->getRParenLoc(), EC.get());
14806template<
typename Derived>
14822 return getDerived().RebuildCXXNamedCastExpr(
14829template<
typename Derived>
14838 if (Sub.isInvalid())
14841 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14845template<
typename Derived>
14847TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14848 return getDerived().TransformCXXNamedCastExpr(E);
14851template<
typename Derived>
14857template<
typename Derived>
14864template<
typename Derived>
14870template<
typename Derived>
14876template<
typename Derived>
14881 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14886 = getDerived().TransformExpr(E->getSubExprAsWritten());
14887 if (SubExpr.isInvalid())
14890 if (!getDerived().AlwaysRebuild() &&
14891 Type == E->getTypeInfoAsWritten() &&
14892 SubExpr.get() == E->getSubExpr())
14895 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14899 E->isListInitialization());
14902template<
typename Derived>
14905 if (E->isTypeOperand()) {
14907 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14911 if (!getDerived().AlwaysRebuild() &&
14912 TInfo == E->getTypeOperandSourceInfo())
14915 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14916 TInfo, E->getEndLoc());
14922 Expr *Op = E->getExprOperand();
14924 if (E->isGLValue()) {
14926 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14928 diag::err_incomplete_typeid))
14931 if (RD->isPolymorphic())
14939 ExprResult SubExpr = getDerived().TransformExpr(Op);
14940 if (SubExpr.isInvalid())
14943 if (!getDerived().AlwaysRebuild() &&
14944 SubExpr.get() == E->getExprOperand())
14947 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14948 SubExpr.get(), E->getEndLoc());
14951template<
typename Derived>
14954 if (E->isTypeOperand()) {
14956 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14960 if (!getDerived().AlwaysRebuild() &&
14961 TInfo == E->getTypeOperandSourceInfo())
14964 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14965 TInfo, E->getEndLoc());
14971 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14972 if (SubExpr.isInvalid())
14975 if (!getDerived().AlwaysRebuild() &&
14976 SubExpr.get() == E->getExprOperand())
14979 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14980 SubExpr.get(), E->getEndLoc());
14983template<
typename Derived>
14989template<
typename Derived>
14996template<
typename Derived>
15012 auto &S = getSema();
15013 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15014 return S.getCurrentThisType();
15015 if (S.getCurLambda())
15016 return getDerived().TransformType(E->getType());
15017 return S.getCurrentThisType();
15020 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15021 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15024 getSema().MarkThisReferenced(E);
15028 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15031template<
typename Derived>
15034 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15035 if (SubExpr.isInvalid())
15038 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15040 if (!getDerived().AlwaysRebuild() &&
15041 SubExpr.get() == E->getSubExpr())
15044 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15045 E->isThrownVariableInScope());
15048template<
typename Derived>
15052 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15057 if (E->hasRewrittenInit()) {
15058 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15059 if (InitRes.isInvalid())
15063 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15064 E->getUsedContext() == SemaRef.
CurContext &&
15065 InitRes.get() == E->getRewrittenExpr())
15068 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15072template<
typename Derived>
15076 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15080 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15084 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
15087template<
typename Derived>
15091 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15095 if (!getDerived().AlwaysRebuild() &&
15096 T == E->getTypeSourceInfo())
15099 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15100 T->getTypeLoc().getEndLoc(),
15101 E->getRParenLoc());
15104template<
typename Derived>
15109 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15110 if (!AllocTypeInfo)
15114 std::optional<Expr *> ArraySize;
15115 if (E->isArray()) {
15117 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15118 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15119 if (NewArraySize.isInvalid())
15122 ArraySize = NewArraySize.get();
15126 bool ArgumentChanged =
false;
15128 if (getDerived().TransformExprs(E->getPlacementArgs(),
15129 E->getNumPlacementArgs(),
true,
15130 PlacementArgs, &ArgumentChanged))
15134 Expr *OldInit = E->getInitializer();
15137 NewInit = getDerived().TransformInitializer(OldInit,
true);
15138 if (NewInit.isInvalid())
15143 if (E->getOperatorNew()) {
15144 OperatorNew = cast_or_null<FunctionDecl>(
15145 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15151 if (E->getOperatorDelete()) {
15152 OperatorDelete = cast_or_null<FunctionDecl>(
15153 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15154 if (!OperatorDelete)
15158 if (!getDerived().AlwaysRebuild() &&
15159 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15160 ArraySize == E->getArraySize() &&
15161 NewInit.get() == OldInit &&
15162 OperatorNew == E->getOperatorNew() &&
15163 OperatorDelete == E->getOperatorDelete() &&
15164 !ArgumentChanged) {
15169 if (OperatorDelete)
15172 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15184 QualType AllocType = AllocTypeInfo->getType();
15195 = dyn_cast<ConstantArrayType>(ArrayT)) {
15199 AllocType = ConsArrayT->getElementType();
15201 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15202 if (DepArrayT->getSizeExpr()) {
15203 ArraySize = DepArrayT->getSizeExpr();
15204 AllocType = DepArrayT->getElementType();
15209 return getDerived().RebuildCXXNewExpr(
15210 E->getBeginLoc(), E->isGlobalNew(),
15211 E->getBeginLoc(), PlacementArgs,
15212 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15213 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15216template<
typename Derived>
15225 if (E->getOperatorDelete()) {
15226 OperatorDelete = cast_or_null<FunctionDecl>(
15227 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15228 if (!OperatorDelete)
15232 if (!getDerived().AlwaysRebuild() &&
15233 Operand.get() == E->getArgument() &&
15234 OperatorDelete == E->getOperatorDelete()) {
15237 if (OperatorDelete)
15240 if (!E->getArgument()->isTypeDependent()) {
15242 E->getDestroyedType());
15251 return getDerived().RebuildCXXDeleteExpr(
15252 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15255template<
typename Derived>
15260 if (
Base.isInvalid())
15264 bool MayBePseudoDestructor =
false;
15266 E->getOperatorLoc(),
15267 E->isArrow()? tok::arrow : tok::period,
15269 MayBePseudoDestructor);
15270 if (
Base.isInvalid())
15273 QualType ObjectType = ObjectTypePtr.get();
15275 if (QualifierLoc) {
15277 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15282 SS.
Adopt(QualifierLoc);
15285 if (E->getDestroyedTypeInfo()) {
15286 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15287 E->getDestroyedTypeInfo(), ObjectType,
15289 if (!DestroyedTypeInfo)
15292 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15296 E->getDestroyedTypeLoc());
15300 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15301 nullptr, SS, ObjectTypePtr,
false);
15307 E->getDestroyedTypeLoc());
15311 if (E->getScopeTypeInfo()) {
15312 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15313 E->getScopeTypeInfo(), ObjectType,
nullptr);
15314 if (!ScopeTypeInfo)
15318 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15319 E->getOperatorLoc(),
15323 E->getColonColonLoc(),
15328template <
typename Derived>
15333 bool AllEmptyPacks =
true;
15334 for (
auto *OldD : Old->
decls()) {
15350 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15351 Decls = UPD->expansions();
15354 for (
auto *D : Decls) {
15355 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15356 for (
auto *SD : UD->shadows())
15363 AllEmptyPacks &= Decls.empty();
15372 if (AllEmptyPacks && !RequiresADL) {
15383 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15384 getSema().FilterAcceptableTemplateNames(R,
15390 getSema().Diag(R.getNameLoc(),
15391 diag::err_template_kw_refers_to_non_template)
15395 diag::note_template_kw_refers_to_non_template)
15396 << R.getLookupName();
15404template <
typename Derived>
15410template <
typename Derived>
15413 bool IsAddressOfOperand) {
15418 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15425 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15429 SS.
Adopt(QualifierLoc);
15433 CXXRecordDecl *NamingClass
15434 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15437 if (!NamingClass) {
15442 R.setNamingClass(NamingClass);
15463 SS, TemplateKWLoc, R,
15470 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15473 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15477template<
typename Derived>
15480 bool ArgChanged =
false;
15482 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15484 TypeLoc FromTL = From->getTypeLoc();
15487 TLB.
reserve(FromTL.getFullDataSize());
15488 QualType To = getDerived().TransformType(TLB, FromTL);
15492 if (To == From->getType())
15493 Args.push_back(From);
15495 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15505 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15511 bool Expand =
true;
15512 bool RetainExpansion =
false;
15514 ExpansionTL.getTypePtr()->getNumExpansions();
15516 if (getDerived().TryExpandParameterPacks(
15517 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15518 Unexpanded,
true, Expand,
15519 RetainExpansion, NumExpansions))
15529 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15531 QualType To = getDerived().TransformType(TLB, PatternTL);
15535 To = getDerived().RebuildPackExpansionType(To,
15536 PatternTL.getSourceRange(),
15537 ExpansionTL.getEllipsisLoc(),
15545 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15551 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15554 TLB.
reserve(PatternTL.getFullDataSize());
15555 QualType To = getDerived().TransformType(TLB, PatternTL);
15559 if (To->containsUnexpandedParameterPack()) {
15560 To = getDerived().RebuildPackExpansionType(To,
15561 PatternTL.getSourceRange(),
15562 ExpansionTL.getEllipsisLoc(),
15572 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15575 if (!RetainExpansion)
15580 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15583 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15585 QualType To = getDerived().TransformType(TLB, PatternTL);
15589 To = getDerived().RebuildPackExpansionType(To,
15590 PatternTL.getSourceRange(),
15591 ExpansionTL.getEllipsisLoc(),
15599 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15602 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15605 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15609template<
typename Derived>
15615 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15616 Old->NumTemplateArgs, TransArgs))
15619 return getDerived().RebuildConceptSpecializationExpr(
15620 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15621 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15625template<
typename Derived>
15639 getSema().Context, getSema().CurContext,
15640 E->getBody()->getBeginLoc());
15644 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15645 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15646 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15650 Param->setDeclContext(Body);
15656 if (!TypeParamResult.isUnset())
15657 return TypeParamResult;
15660 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15665 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15666 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15667 ER->getReturnTypeRequirement()
15668 .getTypeConstraintTemplateParameterList()->getParam(0)
15669 ->setDeclContext(Body);
15674 return getDerived().RebuildRequiresExpr(
15675 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15676 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15679template<
typename Derived>
15685 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15686 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15687 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15688 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15690 TransReq =
getDerived().TransformNestedRequirement(
15694 Transformed.push_back(TransReq);
15699template<
typename Derived>
15712 return getDerived().RebuildTypeRequirement(TransType);
15715template<
typename Derived>
15718 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15724 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15727 TransExpr = TransExprRes.
get();
15730 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15732 if (RetReq.isEmpty())
15733 TransRetReq.emplace();
15734 else if (RetReq.isSubstitutionFailure())
15735 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15736 else if (RetReq.isTypeConstraint()) {
15738 RetReq.getTypeConstraintTemplateParameterList();
15740 getDerived().TransformTemplateParameterList(OrigTPL);
15743 TransRetReq.emplace(TPL);
15745 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15746 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15749 std::move(*TransRetReq));
15755template<
typename Derived>
15761 return getDerived().RebuildNestedRequirement(
15769 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15772template<
typename Derived>
15779 if (!getDerived().AlwaysRebuild() &&
15796template<
typename Derived>
15803 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15804 if (SubExpr.isInvalid())
15807 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15811 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15812 SubExpr.get(), E->getEndLoc());
15815template <
typename Derived>
15820 DRE, AddrTaken, RecoveryTSI);
15833template <
typename Derived>
15840template <
typename Derived>
15856 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15861 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15867 return getDerived().RebuildDependentScopeDeclRefExpr(
15868 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15869 IsAddressOfOperand, RecoveryTSI);
15873 if (getDerived().TransformTemplateArguments(
15877 return getDerived().RebuildDependentScopeDeclRefExpr(
15878 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15882template<
typename Derived>
15888 if (getDerived().AllowSkippingCXXConstructExpr() &&
15889 ((E->getNumArgs() == 1 ||
15890 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15891 (!getDerived().DropCallArgument(E->getArg(0))) &&
15892 !E->isListInitialization()))
15898 QualType T = getDerived().TransformType(E->getType());
15903 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15907 bool ArgumentChanged =
false;
15912 E->isListInitialization());
15913 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15918 if (!getDerived().AlwaysRebuild() &&
15919 T == E->getType() &&
15921 !ArgumentChanged) {
15928 return getDerived().RebuildCXXConstructExpr(
15929 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15930 E->hadMultipleCandidates(), E->isListInitialization(),
15931 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15932 E->getConstructionKind(), E->getParenOrBraceRange());
15935template<
typename Derived>
15938 QualType T = getDerived().TransformType(E->getType());
15943 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15947 if (!getDerived().AlwaysRebuild() &&
15948 T == E->getType() &&
15956 return getDerived().RebuildCXXInheritedCtorInitExpr(
15958 E->constructsVBase(), E->inheritedFromVBase());
15965template<
typename Derived>
15968 if (
auto *Dtor = E->getTemporary()->getDestructor())
15971 return getDerived().TransformExpr(E->getSubExpr());
15979template<
typename Derived>
15985template<
typename Derived>
15990 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15995 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15999 bool ArgumentChanged =
false;
16001 Args.reserve(E->getNumArgs());
16005 E->isListInitialization());
16006 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16010 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16011 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16013 if (Res.isInvalid())
16015 Args = {Res.get()};
16019 if (!getDerived().AlwaysRebuild() &&
16020 T == E->getTypeSourceInfo() &&
16022 !ArgumentChanged) {
16029 return getDerived().RebuildCXXTemporaryObjectExpr(
16030 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16033template<
typename Derived>
16038 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16039 struct TransformedInitCapture {
16041 SourceLocation EllipsisLoc;
16043 SmallVector<InitCaptureInfoTy, 4> Expansions;
16046 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16048 CEnd = E->capture_end();
16050 if (!E->isInitCapture(
C))
16053 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16058 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16061 if (NewExprInitResult.isInvalid()) {
16065 Expr *NewExprInit = NewExprInitResult.get();
16068 getSema().buildLambdaInitCaptureInitialization(
16069 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16070 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16074 Result.Expansions.push_back(
16075 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16079 if (OldVD->isParameterPack()) {
16088 bool Expand =
true;
16089 bool RetainExpansion =
false;
16091 ExpansionTL.getTypePtr()->getNumExpansions();
16093 if (getDerived().TryExpandParameterPacks(
16094 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16095 Unexpanded,
true, Expand,
16096 RetainExpansion, NumExpansions))
16098 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16099 "capture since it cannot be extended");
16101 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16106 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16107 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16146 if ((getSema().isUnevaluatedContext() ||
16147 getSema().isConstantEvaluatedContext()) &&
16148 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16150 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16155 E->getIntroducerRange(),
nullptr, DependencyKind,
16156 E->getCaptureDefault());
16157 getDerived().transformedLocalDecl(OldClass, {
Class});
16160 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16163 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16164 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16165 E->hasExplicitParameters(), E->isMutable());
16175 CEnd = E->capture_end();
16179 if (
C->isImplicit())
16183 if (
C->capturesThis()) {
16191 dyn_cast_if_present<CXXRecordDecl>(
16192 getSema().getFunctionLevelDeclContext()),
16194 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16201 if (
C->capturesVLAType())
16205 if (E->isInitCapture(
C)) {
16206 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16211 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16213 QualType InitQualType = Info.second;
16214 if (
Init.isInvalid() || InitQualType.isNull()) {
16218 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16219 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16220 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16221 getSema().CurContext);
16226 NewVDs.push_back(NewVD);
16227 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16232 if (NewC.EllipsisLoc.isInvalid())
16233 LSI->ContainsUnexpandedParameterPack |=
16234 Init.get()->containsUnexpandedParameterPack();
16240 getDerived().transformedLocalDecl(OldVD, NewVDs);
16244 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16252 if (
C->isPackExpansion()) {
16254 bool ShouldExpand =
false;
16255 bool RetainExpansion =
false;
16257 if (getDerived().TryExpandParameterPacks(
16258 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16259 true, ShouldExpand,
16260 RetainExpansion, NumExpansions)) {
16265 if (ShouldExpand) {
16270 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16272 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16273 getDerived().TransformDecl(
C->getLocation(), Pack));
16274 if (!CapturedVar) {
16280 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16288 EllipsisLoc =
C->getEllipsisLoc();
16292 auto *CapturedVar = cast_or_null<ValueDecl>(
16293 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16294 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16301 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16302 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16305 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16308 getSema().finishLambdaExplicitCaptures(LSI);
16312 auto TPL = getDerived().TransformTemplateParameterList(
16313 E->getTemplateParameterList());
16314 LSI->GLTemplateParameterList = TPL;
16316 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16318 LSI->ContainsUnexpandedParameterPack |=
16319 TPL->containsUnexpandedParameterPack();
16324 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16326 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16327 if (NewCallOpType.isNull())
16329 LSI->ContainsUnexpandedParameterPack |=
16330 NewCallOpType->containsUnexpandedParameterPack();
16332 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16337 assert(FPTL &&
"Not a FunctionProtoType?");
16341 ExprResult E = getDerived().TransformLambdaConstraint(
16342 const_cast<Expr *
>(TRC.ConstraintExpr));
16345 TRC.ConstraintExpr = E.get();
16348 LSI->BeforeCompoundStatement =
false;
16349 getSema().CompleteLambdaCallOperator(
16350 NewCallOperator, E->getCallOperator()->getLocation(),
16351 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16352 E->getCallOperator()->getConstexprKind(),
16353 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16354 E->hasExplicitResultType());
16356 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16357 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16363 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16364 if (getDerived().ReplacingOriginal()) {
16365 Numbering = OldClass->getLambdaNumbering();
16368 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16373 getSema().PushExpressionEvaluationContextForFunction(
16375 E->getCallOperator());
16382 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16383 getSema().pushCodeSynthesisContext(
C);
16387 : getDerived().TransformLambdaBody(E, E->getBody());
16389 getSema().popCodeSynthesisContext();
16393 FuncScopeCleanup.disable();
16395 if (Body.isInvalid()) {
16396 SavedContext.pop();
16397 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16402 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16405 SavedContext.pop();
16440 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16441 Class->setLambdaDependencyKind(DependencyKind);
16443 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16444 Body.get()->getEndLoc(), LSI);
16447template<
typename Derived>
16453template<
typename Derived>
16462 if (!
C->isImplicit())
16466 if (
C->capturesThis()) {
16467 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16474 if (
C->capturesVLAType())
16477 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16481 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16487 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16493template<
typename Derived>
16502 bool ArgumentChanged =
false;
16514 if (!getDerived().AlwaysRebuild() &&
16520 return getDerived().RebuildCXXUnresolvedConstructExpr(
16524template<
typename Derived>
16533 if (!E->isImplicitAccess()) {
16534 OldBase = E->getBase();
16535 Base = getDerived().TransformExpr(OldBase);
16536 if (
Base.isInvalid())
16541 bool MayBePseudoDestructor =
false;
16543 E->getOperatorLoc(),
16544 E->isArrow()? tok::arrow : tok::period,
16546 MayBePseudoDestructor);
16547 if (
Base.isInvalid())
16550 ObjectType = ObjectTy.get();
16551 BaseType = ((
Expr*)
Base.get())->getType();
16554 BaseType = getDerived().TransformType(E->getBaseType());
16561 = getDerived().TransformFirstQualifierInScope(
16562 E->getFirstQualifierFoundInScope(),
16563 E->getQualifierLoc().getBeginLoc());
16566 if (E->getQualifier()) {
16568 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16570 FirstQualifierInScope);
16582 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16583 if (!NameInfo.getName())
16586 if (!E->hasExplicitTemplateArgs()) {
16589 if (!getDerived().AlwaysRebuild() &&
16590 Base.get() == OldBase &&
16591 BaseType == E->getBaseType() &&
16592 QualifierLoc == E->getQualifierLoc() &&
16593 NameInfo.getName() == E->getMember() &&
16594 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16597 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16600 E->getOperatorLoc(),
16603 FirstQualifierInScope,
16609 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16610 E->getNumTemplateArgs(),
16614 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16617 E->getOperatorLoc(),
16620 FirstQualifierInScope,
16625template <
typename Derived>
16631 if (!Old->isImplicitAccess()) {
16632 Base = getDerived().TransformExpr(Old->getBase());
16633 if (
Base.isInvalid())
16636 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16637 if (
Base.isInvalid())
16639 BaseType =
Base.get()->getType();
16641 BaseType = getDerived().TransformType(Old->getBaseType());
16645 if (Old->getQualifierLoc()) {
16647 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16657 if (TransformOverloadExprDecls(Old,
false, R))
16661 if (Old->getNamingClass()) {
16663 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16667 R.setNamingClass(NamingClass);
16671 if (Old->hasExplicitTemplateArgs()) {
16672 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16673 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16674 if (getDerived().TransformTemplateArguments(
16675 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16683 NamedDecl *FirstQualifierInScope =
nullptr;
16685 return getDerived().RebuildUnresolvedMemberExpr(
16686 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16687 TemplateKWLoc, FirstQualifierInScope, R,
16688 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16691template<
typename Derived>
16696 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16697 if (SubExpr.isInvalid())
16700 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16703 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16706template<
typename Derived>
16709 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16710 if (Pattern.isInvalid())
16713 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16716 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16717 E->getNumExpansions());
16720template <
typename Derived>
16725 if (!Arg.isPackExpansion()) {
16737 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16738 OrigNumExpansions);
16750 if (!NumExpansions) {
16762template<
typename Derived>
16781 bool ShouldExpand =
false;
16782 bool RetainExpansion =
false;
16784 if (getDerived().TryExpandParameterPacks(
16786 true, ShouldExpand,
16787 RetainExpansion, NumExpansions))
16792 if (ShouldExpand) {
16794 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16795 ArgStorage = getSema().Context.getPackExpansionType(
16796 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16797 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16801 ExprResult DRE = getSema().BuildDeclRefExpr(
16802 VD, VD->getType().getNonLValueExprType(getSema().Context),
16805 if (DRE.isInvalid())
16808 new (getSema().Context)
16812 PackArgs = ArgStorage;
16817 if (!PackArgs.size()) {
16818 auto *Pack = cast_or_null<NamedDecl>(
16822 return getDerived().RebuildSizeOfPackExpr(
16829 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16841 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16844 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16845 PackLocIterator(*
this, PackArgs.end()),
16846 TransformedPackArgs,
true))
16853 bool PartialSubstitution =
false;
16854 for (
auto &Loc : TransformedPackArgs.arguments()) {
16855 Args.push_back(Loc.getArgument());
16856 if (Loc.getArgument().isPackExpansion())
16857 PartialSubstitution =
true;
16860 if (PartialSubstitution)
16861 return getDerived().RebuildSizeOfPackExpr(
16863 std::nullopt, Args);
16865 return getDerived().RebuildSizeOfPackExpr(
16867 static_cast<unsigned>(Args.size()),
16871template <
typename Derived>
16874 if (!E->isValueDependent())
16882 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16883 if (IndexExpr.isInvalid())
16888 bool FullySubstituted =
true;
16889 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16890 Expr *Pattern = E->getPackIdExpression();
16892 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16894 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16898 bool ShouldExpand =
true;
16899 bool RetainExpansion =
false;
16901 NumExpansions = std::nullopt;
16902 if (getDerived().TryExpandParameterPacks(
16903 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16904 true, ShouldExpand,
16905 RetainExpansion, NumExpansions))
16907 if (!ShouldExpand) {
16909 ExprResult Pack = getDerived().TransformExpr(Pattern);
16910 if (Pack.isInvalid())
16912 return getDerived().RebuildPackIndexingExpr(
16913 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16916 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16919 if (
Out.isInvalid())
16921 if (
Out.get()->containsUnexpandedParameterPack()) {
16922 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16923 OrigNumExpansions);
16924 if (
Out.isInvalid())
16926 FullySubstituted =
false;
16928 ExpandedExprs.push_back(
Out.get());
16932 if (RetainExpansion) {
16933 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16936 if (
Out.isInvalid())
16939 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16940 OrigNumExpansions);
16941 if (
Out.isInvalid())
16943 FullySubstituted =
false;
16944 ExpandedExprs.push_back(
Out.get());
16946 }
else if (!E->expandsToEmptyPack()) {
16947 if (getDerived().TransformExprs(E->getExpressions().data(),
16948 E->getExpressions().size(),
false,
16953 return getDerived().RebuildPackIndexingExpr(
16954 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16955 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16958template <
typename Derived>
16961 if (!getSema().ArgPackSubstIndex)
16967 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16968 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
16969 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
16973template <
typename Derived>
16990 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16991 if (Replacement.isInvalid())
16994 Decl *AssociatedDecl =
16995 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16996 if (!AssociatedDecl)
16999 QualType ParamType = TransformType(E->getParameterType());
17000 if (ParamType.isNull())
17003 if (Replacement.get() == OrigReplacement &&
17004 AssociatedDecl == E->getAssociatedDecl() &&
17005 ParamType == E->getParameterType())
17008 if (Replacement.get() != OrigReplacement ||
17009 ParamType != E->getParameterType()) {
17018 Param, ParamType, Replacement.get(), SugaredConverted,
17019 CanonicalConverted,
17021 if (Replacement.isInvalid())
17025 Replacement = E->getReplacement();
17028 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17029 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17031 E->getPackIndex(), E->getFinal());
17034template<
typename Derived>
17041template<
typename Derived>
17048template<
typename Derived>
17052 if (
Expr *OldCallee = E->getCallee()) {
17053 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17054 if (CalleeResult.isInvalid())
17059 Expr *Pattern = E->getPattern();
17062 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17063 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17067 bool Expand =
true;
17068 bool RetainExpansion =
false;
17070 NumExpansions = OrigNumExpansions;
17071 if (getDerived().TryExpandParameterPacks(
17072 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17073 true, Expand, RetainExpansion,
17083 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17084 if (LHS.isInvalid())
17088 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17089 if (RHS.isInvalid())
17092 if (!getDerived().AlwaysRebuild() &&
17093 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17096 return getDerived().RebuildCXXFoldExpr(
17097 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17098 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17104 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17105 SemaRef.
Diag(E->getEllipsisLoc(),
17106 clang::diag::err_fold_expression_limit_exceeded)
17107 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17108 << E->getSourceRange();
17109 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17118 bool LeftFold = E->isLeftFold();
17122 if (!LeftFold && RetainExpansion) {
17123 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17126 if (
Out.isInvalid())
17129 Result = getDerived().RebuildCXXFoldExpr(
17130 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17131 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17136 bool WarnedOnComparison =
false;
17137 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17139 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17141 if (
Out.isInvalid())
17144 if (
Out.get()->containsUnexpandedParameterPack()) {
17146 Result = getDerived().RebuildCXXFoldExpr(
17147 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17148 E->getOperator(), E->getEllipsisLoc(),
17149 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17150 OrigNumExpansions);
17151 }
else if (
Result.isUsable()) {
17158 Result = getDerived().RebuildCXXOperatorCallExpr(
17160 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17161 Functions, LHS, RHS);
17163 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17164 E->getOperator(), LHS, RHS,
17166 if (!WarnedOnComparison &&
Result.isUsable()) {
17167 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17168 BO && BO->isComparisonOp()) {
17169 WarnedOnComparison =
true;
17170 SemaRef.
Diag(BO->getBeginLoc(),
17171 diag::warn_comparison_in_fold_expression)
17172 << BO->getOpcodeStr();
17185 if (LeftFold && RetainExpansion) {
17186 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17189 if (
Out.isInvalid())
17192 Result = getDerived().RebuildCXXFoldExpr(
17193 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17194 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17200 PE->setIsProducedByFoldExpansion();
17205 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17210template <
typename Derived>
17216 QualType T = getDerived().TransformType(E->getType());
17218 bool ArgChanged =
false;
17220 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17221 TransformedInits, &ArgChanged))
17224 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17227 return getDerived().RebuildCXXParenListInitExpr(
17228 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17229 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17232template<
typename Derived>
17239template<
typename Derived>
17245template<
typename Derived>
17251template<
typename Derived>
17254 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17255 if (SubExpr.isInvalid())
17258 if (!getDerived().AlwaysRebuild() &&
17259 SubExpr.get() == E->getSubExpr())
17262 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17265template<
typename Derived>
17270 bool ArgChanged =
false;
17271 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17272 false, Elements, &ArgChanged))
17275 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17278 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17283template<
typename Derived>
17289 bool ArgChanged =
false;
17290 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17293 if (OrigElement.isPackExpansion()) {
17296 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17297 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17298 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17302 bool Expand =
true;
17303 bool RetainExpansion =
false;
17306 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17307 OrigElement.Value->getEndLoc());
17308 if (getDerived().TryExpandParameterPacks(
17309 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17310 true, Expand, RetainExpansion,
17319 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17320 if (Key.isInvalid())
17323 if (Key.get() != OrigElement.Key)
17327 if (
Value.isInvalid())
17334 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17336 Elements.push_back(Expansion);
17346 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17348 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17349 if (Key.isInvalid())
17353 if (
Value.isInvalid())
17363 if (Key.get()->containsUnexpandedParameterPack() ||
17364 Value.get()->containsUnexpandedParameterPack())
17365 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17367 Elements.push_back(Element);
17377 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17378 if (Key.isInvalid())
17381 if (Key.get() != OrigElement.Key)
17386 = getDerived().TransformExpr(OrigElement.Value);
17387 if (
Value.isInvalid())
17395 Elements.push_back(Element);
17398 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17401 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17405template<
typename Derived>
17409 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17410 if (!EncodedTypeInfo)
17413 if (!getDerived().AlwaysRebuild() &&
17414 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17417 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17419 E->getRParenLoc());
17422template<
typename Derived>
17432template<
typename Derived>
17436 = getDerived().TransformType(E->getTypeInfoAsWritten());
17444 if (!getDerived().AlwaysRebuild() &&
17445 TSInfo == E->getTypeInfoAsWritten() &&
17446 Result.get() == E->getSubExpr())
17450 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17454template <
typename Derived>
17460template<
typename Derived>
17464 bool ArgChanged =
false;
17466 Args.reserve(E->getNumArgs());
17467 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17474 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17475 if (!ReceiverTypeInfo)
17479 if (!getDerived().AlwaysRebuild() &&
17480 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17485 E->getSelectorLocs(SelLocs);
17486 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17489 E->getMethodDecl(),
17496 if (!E->getMethodDecl())
17501 E->getSelectorLocs(SelLocs);
17502 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17505 E->getReceiverType(),
17506 E->getMethodDecl(),
17514 "Only class and instance messages may be instantiated");
17516 = getDerived().TransformExpr(E->getInstanceReceiver());
17517 if (Receiver.isInvalid())
17521 if (!getDerived().AlwaysRebuild() &&
17522 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17527 E->getSelectorLocs(SelLocs);
17528 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17531 E->getMethodDecl(),
17537template<
typename Derived>
17543template<
typename Derived>
17549template<
typename Derived>
17554 if (
Base.isInvalid())
17560 if (!getDerived().AlwaysRebuild() &&
17561 Base.get() == E->getBase())
17564 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17566 E->isArrow(), E->isFreeIvar());
17569template<
typename Derived>
17574 if (!E->isObjectReceiver())
17579 if (
Base.isInvalid())
17585 if (!getDerived().AlwaysRebuild() &&
17586 Base.get() == E->getBase())
17589 if (E->isExplicitProperty())
17590 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17591 E->getExplicitProperty(),
17594 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17596 E->getImplicitPropertyGetter(),
17597 E->getImplicitPropertySetter(),
17601template<
typename Derived>
17606 if (
Base.isInvalid())
17610 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17611 if (Key.isInvalid())
17615 if (!getDerived().AlwaysRebuild() &&
17616 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17619 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17620 Base.get(), Key.get(),
17621 E->getAtIndexMethodDecl(),
17622 E->setAtIndexMethodDecl());
17625template<
typename Derived>
17630 if (
Base.isInvalid())
17634 if (!getDerived().AlwaysRebuild() &&
17635 Base.get() == E->getBase())
17638 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17643template<
typename Derived>
17646 bool ArgumentChanged =
false;
17648 SubExprs.reserve(E->getNumSubExprs());
17649 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17650 SubExprs, &ArgumentChanged))
17653 if (!getDerived().AlwaysRebuild() &&
17657 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17659 E->getRParenLoc());
17662template<
typename Derived>
17665 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17666 if (SrcExpr.isInvalid())
17673 if (!getDerived().AlwaysRebuild() &&
17674 Type == E->getTypeSourceInfo() &&
17675 SrcExpr.get() == E->getSrcExpr())
17678 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17679 SrcExpr.get(),
Type,
17680 E->getRParenLoc());
17683template<
typename Derived>
17686 BlockDecl *oldBlock = E->getBlockDecl();
17692 blockScope->TheDecl->setBlockMissingReturnType(
17693 oldBlock->blockMissingReturnType());
17702 if (getDerived().TransformFunctionTypeParams(
17703 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17704 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17706 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17711 getDerived().TransformType(exprFunctionType->getReturnType());
17713 auto epi = exprFunctionType->getExtProtoInfo();
17714 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17717 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17721 if (!params.empty())
17722 blockScope->TheDecl->setParams(params);
17724 if (!oldBlock->blockMissingReturnType()) {
17725 blockScope->HasImplicitReturnType =
false;
17726 blockScope->ReturnType = exprResultType;
17730 StmtResult body = getDerived().TransformStmt(E->getBody());
17731 if (body.isInvalid()) {
17732 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17740 for (
const auto &I : oldBlock->captures()) {
17741 VarDecl *oldCapture = I.getVariable();
17744 if (oldCapture->isParameterPack())
17748 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17750 assert(blockScope->CaptureMap.count(newCapture));
17756 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17757 "this pointer isn't captured in the old block");
17765template<
typename Derived>
17768 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17769 if (SrcExpr.isInvalid())
17772 QualType Type = getDerived().TransformType(E->getType());
17775 E->getRParenLoc());
17778template<
typename Derived>
17781 bool ArgumentChanged =
false;
17783 SubExprs.reserve(E->getNumSubExprs());
17784 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17785 SubExprs, &ArgumentChanged))
17788 if (!getDerived().AlwaysRebuild() &&
17792 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17793 E->getOp(), E->getRParenLoc());
17800template<
typename Derived>
17803 return SemaRef.BuildPointerType(PointeeType,
Star,
17807template<
typename Derived>
17810 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17814template<
typename Derived>
17817 bool WrittenAsLValue,
17819 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17823template <
typename Derived>
17827 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17831template<
typename Derived>
17838 return SemaRef.ObjC().BuildObjCTypeParamType(
17839 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17843template<
typename Derived>
17854 return SemaRef.ObjC().BuildObjCObjectType(
17855 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17856 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17861template<
typename Derived>
17865 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17868template <
typename Derived>
17871 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17872 if (SizeExpr || !Size)
17873 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17874 IndexTypeQuals, BracketsRange,
17878 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17880 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17883 for (
const auto &
T : Types)
17884 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17894 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17895 IndexTypeQuals, BracketsRange,
17899template <
typename Derived>
17902 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17903 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17904 IndexTypeQuals, BracketsRange);
17907template <
typename Derived>
17911 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17912 IndexTypeQuals, BracketsRange);
17915template <
typename Derived>
17918 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17919 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17921 IndexTypeQuals, BracketsRange);
17924template <
typename Derived>
17927 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17928 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17930 IndexTypeQuals, BracketsRange);
17933template <
typename Derived>
17936 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17940template <
typename Derived>
17942 unsigned NumElements,
17945 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17948template <
typename Derived>
17952 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17955template<
typename Derived>
17957 unsigned NumElements,
17959 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17960 NumElements,
true);
17964 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17967template<
typename Derived>
17972 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17975template <
typename Derived>
17977 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17978 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17982template <
typename Derived>
17986 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17990template <
typename Derived>
17994 return SemaRef.BuildFunctionType(
T, ParamTypes,
18000template<
typename Derived>
18002 return SemaRef.Context.getFunctionNoProtoType(
T);
18005template <
typename Derived>
18009 assert(D &&
"no decl found");
18013 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18017 if (UPD->expansions().empty()) {
18018 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18019 << UPD->isCXXClassMember() << UPD;
18028 for (
auto *E : UPD->expansions()) {
18035 else if (
T.isNull())
18038 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18039 "mismatched resolved types in using pack expansion");
18041 return T.isNull() ? FallbackT :
T;
18043 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18044 assert(Using->hasTypename() &&
18045 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18048 assert(++Using->shadow_begin() == Using->shadow_end());
18053 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18056 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18057 return SemaRef.Context.getUnresolvedUsingType(
18061template <
typename Derived>
18064 return SemaRef.BuildTypeofExprType(E, Kind);
18067template<
typename Derived>
18070 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18073template <
typename Derived>
18075 return SemaRef.BuildDecltypeType(E);
18078template <
typename Derived>
18083 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
18084 FullySubstituted, Expansions);
18087template<
typename Derived>
18089 UnaryTransformType::UTTKind UKind,
18091 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18094template <
typename Derived>
18098 return SemaRef.CheckTemplateIdType(
18103template<
typename Derived>
18106 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18109template<
typename Derived>
18113 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18114 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18117template <
typename Derived>
18121 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18125 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18128template <
typename Derived>
18131 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18134template <
typename Derived>
18142template <
typename Derived>
18149 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18152 AllowInjectedClassName);
18156template<
typename Derived>
18163 bool AllowInjectedClassName) {
18166 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18171 false,
Template, AllowInjectedClassName);
18175template <
typename Derived>
18180 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18185 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18186 Opc,
First, Second);
18201 if (Op == OO_Subscript) {
18202 if (!
First->getType()->isOverloadableType() &&
18204 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18206 }
else if (Op == OO_Arrow) {
18209 if (
First->getType()->isDependentType())
18212 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18213 }
else if (Second ==
nullptr || isPostIncDec) {
18214 if (!
First->getType()->isOverloadableType() ||
18215 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18222 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18226 !
First->getType()->isOverloadableType() &&
18232 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18241 if (!Second || isPostIncDec) {
18244 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18251 First, Second, RequiresADL);
18258template<
typename Derived>
18268 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18269 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18274 ->getAsCanonical<RecordType>())) {
18276 return SemaRef.BuildPseudoDestructorExpr(
18277 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18278 CCLoc, TildeLoc, Destroyed);
18290 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18291 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18292 diag::err_expected_class_or_namespace)
18293 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18297 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18301 return getSema().BuildMemberReferenceExpr(
18302 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18308template<
typename Derived>
18316 for (
unsigned I = 0; I < NumParams; ++I) {
18317 if (I != ContextParamPos) {
18323 Params.push_back(std::make_pair(StringRef(), QualType()));
18326 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18334 if (Body.isInvalid()) {
18335 getSema().ActOnCapturedRegionError();
18339 return getSema().ActOnCapturedRegionEnd(Body.get());
18342template <
typename Derived>
18348 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18352template <
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 ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
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