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);
2154 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2191 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2204 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2239 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2254 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2255 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2271 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2272 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2285 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2327 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2374 StartLoc, LParenLoc, EndLoc,
Data);
2387 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2399 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2412 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2423 LParenLoc, VarLoc, EndLoc);
2435 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2506 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2587 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2635 ForLoc, Element, Collection, RParenLoc);
2653 StartLoc, IdLoc, Id);
2690 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2691 if (RangeStmt->isSingleDecl()) {
2692 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2693 if (RangeVar->isInvalidDecl())
2696 Expr *RangeExpr = RangeVar->getInit();
2703 diag::err_objc_for_range_init_stmt)
2704 <<
Init->getSourceRange();
2707 ForLoc, LoopVar, RangeExpr, RParenLoc);
2714 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2728 QualifierLoc, NameInfo, Nested);
2790 SS.
Adopt(QualifierLoc);
2910 if (IsOMPArraySection)
2912 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2913 Stride, RBracketLoc);
2915 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2916 "Stride/second colon not allowed for OpenACC");
2919 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2931 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2943 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2953 Expr *ExecConfig =
nullptr) {
2955 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2962 nullptr, Callee, LParenLoc, Args, RParenLoc);
2980 if (!
Member->getDeclName()) {
2984 assert(
Member->getType()->isRecordType() &&
2985 "unnamed member not of record type?");
2998 if (!isArrow &&
Base->isPRValue()) {
3013 SS.
Adopt(QualifierLoc);
3016 if (
Base->containsErrors())
3021 if (isArrow && !BaseType->isPointerType())
3027 R.addDecl(FoundDecl);
3030 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3035 ->getAsCXXRecordDecl()) {
3039 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3047 FirstQualifierInScope,
3048 R, ExplicitTemplateArgs,
3058 bool ForFoldExpression =
false) {
3136 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3149 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3189 unsigned NumUserSpecifiedExprs,
3194 InitLoc, LParenLoc, RParenLoc);
3224 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3236 Expr *ControllingExpr,
3241 ControllingExpr, Types, Exprs);
3256 ControllingType, Types, Exprs);
3289 case Stmt::CXXStaticCastExprClass:
3290 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3291 RAngleLoc, LParenLoc,
3292 SubExpr, RParenLoc);
3294 case Stmt::CXXDynamicCastExprClass:
3295 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3296 RAngleLoc, LParenLoc,
3297 SubExpr, RParenLoc);
3299 case Stmt::CXXReinterpretCastExprClass:
3300 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3301 RAngleLoc, LParenLoc,
3305 case Stmt::CXXConstCastExprClass:
3306 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3307 RAngleLoc, LParenLoc,
3308 SubExpr, RParenLoc);
3310 case Stmt::CXXAddrspaceCastExprClass:
3311 return getDerived().RebuildCXXAddrspaceCastExpr(
3312 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3315 llvm_unreachable(
"Invalid C++ named cast");
3393 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3405 bool ListInitialization) {
3409 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3411 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3412 RParenLoc, ListInitialization);
3414 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3416 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3420 ListInitialization);
3484 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3494 bool IsThrownVariableInScope) {
3504 Expr *RewrittenExpr) {
3506 RewrittenExpr,
getSema().CurContext);
3540 std::optional<Expr *> ArraySize,
3559 bool IsGlobalDelete,
3610 bool IsAddressOfOperand,
3613 SS.
Adopt(QualifierLoc);
3615 if (TemplateArgs || TemplateKWLoc.
isValid())
3617 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3620 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3642 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3643 bool ListInitialization,
bool StdInitListInitialization,
3650 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3653 if (
getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc,
3660 HadMultipleCandidates,
3662 StdInitListInitialization,
3663 RequiresZeroInit, ConstructKind,
3671 bool ConstructsVBase,
3672 bool InheritedFromVBase) {
3674 Loc, T,
Constructor, ConstructsVBase, InheritedFromVBase);
3685 bool ListInitialization) {
3687 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3698 bool ListInitialization) {
3700 RParenLoc, ListInitialization);
3717 SS.
Adopt(QualifierLoc);
3719 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3720 OperatorLoc, IsArrow,
3722 FirstQualifierInScope,
3724 TemplateArgs,
nullptr);
3740 SS.
Adopt(QualifierLoc);
3742 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3743 OperatorLoc, IsArrow,
3745 FirstQualifierInScope,
3746 R, TemplateArgs,
nullptr);
3754 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3767 RParenLoc, Length, PartialArgs);
3772 Expr *PackIdExpression,
Expr *IndexExpr,
3774 bool FullySubstituted =
false) {
3776 IndexExpr, RSquareLoc, ExpandedExprs,
3802 NamedConcept, TALI);
3820 LocalParameters, RParenLoc, Requirements,
3827 return SemaRef.BuildTypeRequirement(SubstDiag);
3831 return SemaRef.BuildTypeRequirement(T);
3839 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3846 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3853 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3858 return SemaRef.BuildNestedRequirement(Constraint);
3874 Expr **Elements,
unsigned NumElements) {
3884 RB,
Base, Key, getterMethod, setterMethod);
3903 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3915 return SemaRef.ObjC().BuildClassMessage(
3916 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3929 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3932 SelectorLocs, RBracLoc, Args);
3944 return Method->isInstanceMethod()
3945 ?
SemaRef.ObjC().BuildInstanceMessage(
3946 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3947 SelectorLocs, RBracLoc, Args)
3948 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3950 SelectorLocs, RBracLoc, Args);
3959 bool IsArrow,
bool IsFreeIvar) {
3968 if (IsFreeIvar &&
Result.isUsable())
4005 PropertyLoc,
Base));
4034 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4037 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4045 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4046 CK_BuiltinFnToFnPtr).get();
4062 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4077 EllipsisLoc, NumExpansions);
4101 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4137 EllipsisLoc, RHS, RParenLoc,
4146 Init->containsUnexpandedParameterPack();
4147 else if (PVD->hasUninstantiatedDefaultArg())
4149 PVD->getUninstantiatedDefaultArg()
4150 ->containsUnexpandedParameterPack();
4304 Exprs.push_back(DevNumExpr);
4305 llvm::append_range(Exprs, QueueIdExprs);
4342 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4366 ObjectType, FirstQualifierInScope);
4372 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4373 DependentNameTypeLoc TL,
4374 bool DeducibleTSTContext,
4375 QualType ObjectType = QualType(),
4376 NamedDecl *UnqualLookup =
nullptr);
4379 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4384 OpenACCDirectiveKind DirKind,
4385 const OpenACCClause *OldClause);
4388template <
typename Derived>
4398#define STMT(Node, Parent) \
4399 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4400#define VALUESTMT(Node, Parent) \
4401 case Stmt::Node##Class: \
4402 return getDerived().Transform##Node(cast<Node>(S), SDK);
4403#define ABSTRACT_STMT(Node)
4404#define EXPR(Node, Parent)
4405#include "clang/AST/StmtNodes.inc"
4408#define STMT(Node, Parent)
4409#define ABSTRACT_STMT(Stmt)
4410#define EXPR(Node, Parent) case Stmt::Node##Class:
4411#include "clang/AST/StmtNodes.inc"
4416 E =
getSema().ActOnStmtExprResult(E);
4424template<
typename Derived>
4432#define GEN_CLANG_CLAUSE_CLASS
4433#define CLAUSE_CLASS(Enum, Str, Class) \
4435 return getDerived().Transform##Class(cast<Class>(S));
4436#include "llvm/Frontend/OpenMP/OMP.inc"
4443template<
typename Derived>
4450#define STMT(Node, Parent) case Stmt::Node##Class: break;
4451#define ABSTRACT_STMT(Stmt)
4452#define EXPR(Node, Parent) \
4453 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4454#include "clang/AST/StmtNodes.inc"
4460template<
typename Derived>
4468 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4469 Init = FE->getSubExpr();
4471 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4477 Init = MTE->getSubExpr();
4480 Init = Binder->getSubExpr();
4483 Init = ICE->getSubExprAsWritten();
4486 dyn_cast<CXXStdInitializerListExpr>(
Init))
4523 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4524 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4525 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4526 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4528 bool ArgChanged =
false;
4530 true, NewArgs, &ArgChanged))
4541 if (
Parens.isInvalid()) {
4544 assert(NewArgs.empty() &&
4545 "no parens or braces but have direct init with arguments?");
4552template<
typename Derived>
4558 for (
unsigned I = 0; I != NumInputs; ++I) {
4568 Expr *Pattern = Expansion->getPattern();
4571 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4572 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4577 bool RetainExpansion =
false;
4578 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4582 Unexpanded,
true, Expand,
4583 RetainExpansion, NumExpansions))
4596 Expansion->getEllipsisLoc(),
4598 if (Out.isInvalid())
4603 Outputs.push_back(Out.get());
4609 if (ArgChanged) *ArgChanged =
true;
4613 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4616 if (Out.isInvalid())
4619 if (Out.get()->containsUnexpandedParameterPack()) {
4621 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4622 if (Out.isInvalid())
4626 Outputs.push_back(Out.get());
4631 if (RetainExpansion) {
4632 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4635 if (Out.isInvalid())
4639 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4640 if (Out.isInvalid())
4643 Outputs.push_back(Out.get());
4650 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4655 if (
Result.get() != Inputs[I] && ArgChanged)
4658 Outputs.push_back(
Result.get());
4664template <
typename Derived>
4675 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4681 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4690 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4697template <
typename Derived>
4705 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4717 llvm_unreachable(
"unexpected null nested name specifier");
4748 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4749 QualifierLoc, ObjectType, FirstQualifierInScope);
4753 FirstQualifierInScope =
nullptr;
4755 SS.
Adopt(QualifierLoc);
4759 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4761 FirstQualifierInScope,
false))
4769 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4770 FirstQualifierInScope);
4776 if (T->isDependentType() || T->isRecordType() ||
4777 (
SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4778 if (T->isEnumeralType())
4780 diag::warn_cxx98_compat_enum_nested_name_spec);
4787 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4811template<
typename Derived>
4831 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4838 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4848 NewTInfo =
getDerived().TransformType(OldTInfo);
4851 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4859 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4872 llvm_unreachable(
"Unknown name kind.");
4875template <
typename Derived>
4879 QualType ObjectType,
bool AllowInjectedClassName) {
4881 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4882 ObjectType, AllowInjectedClassName);
4884 NameLoc, ObjectType,
4885 AllowInjectedClassName);
4888template <
typename Derived>
4892 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4894 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4897 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4898 QualifierLoc, ObjectType, FirstQualifierInScope);
4905 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4906 FirstQualifierInScope, AllowInjectedClassName);
4907 if (NewUnderlyingName.
isNull())
4909 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4913 NewUnderlyingName == UnderlyingName)
4916 SS.
Adopt(QualifierLoc);
4917 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4923 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4924 QualifierLoc, ObjectType, FirstQualifierInScope);
4938 SS.
Adopt(QualifierLoc);
4939 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4940 NameLoc, ObjectType,
4941 AllowInjectedClassName);
4946 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4953 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4957 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4958 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4961 Decl *AssociatedDecl =
4962 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4964 AssociatedDecl == S->getAssociatedDecl())
4966 return SemaRef.Context.getSubstTemplateTemplateParm(
4967 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4972 "DeducedTemplateName should not escape partial ordering");
4976 assert(!QualifierLoc &&
"Unexpected qualifier");
4983 assert(!QualifierLoc &&
4984 "Unexpected qualified SubstTemplateTemplateParmPack");
4986 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4987 SubstPack->getIndex(), SubstPack->getFinal());
4991 llvm_unreachable(
"overloaded function decl survived to here");
4994template <
typename Derived>
4999 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5005template<
typename Derived>
5009 Output =
getSema().getTrivialTemplateArgumentLoc(
5013template <
typename Derived>
5021 llvm_unreachable(
"Unexpected TemplateArgument");
5044 if (NewT == T && D == NewD)
5061 llvm_unreachable(
"unexpected template argument kind");
5093 llvm_unreachable(
"Caller should expand pack expansions");
5109 E =
SemaRef.ActOnConstantExpression(E);
5124template<
typename Derived,
typename InputIterator>
5132 typedef typename std::iterator_traits<InputIterator>::difference_type
5147 : Self(Self), Iter(Iter) { }
5162 Self.InventTemplateArgumentLoc(*Iter,
Result);
5170 return X.Iter == Y.Iter;
5175 return X.Iter != Y.Iter;
5179template<
typename Derived>
5180template<
typename InputIterator>
5200 PackLocIterator(*
this, In.getArgument().pack_begin()),
5201 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5208 if (In.getArgument().isPackExpansion()) {
5220 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5230 if (Out.getArgument().containsUnexpandedParameterPack()) {
5233 if (Out.getArgument().isNull())
5243 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5251 if (Out.getArgument().isNull())
5270template <
typename Derived>
5271template <
typename InputIterator>
5280 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5292 PackLocIterator(*
this, In.getArgument().pack_begin()),
5293 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5299 if (!isNonDependentConceptArgument(In.getArgument())) {
5314template <
typename Derived>
5325 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5328 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5329 if (IsLateExpansionAttempt) {
5334 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5336 if (!SawPackTypes) {
5341 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5349 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5355 if (ComputeInfo(In,
false, Info, Pattern))
5367 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5368 std::in_place,
getSema(), std::nullopt);
5374 if (Out.getArgument().isNull())
5411 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5412 if (ComputeInfo(Out,
true, Info, OutPattern))
5425template<
typename Derived>
5443template <
typename Derived>
5463template<
typename Derived>
5466 switch (T.getTypeLocClass()) {
5467#define ABSTRACT_TYPELOC(CLASS, PARENT)
5468#define TYPELOC(CLASS, PARENT) \
5469 case TypeLoc::CLASS: \
5470 return getDerived().Transform##CLASS##Type(TLB, \
5471 T.castAs<CLASS##TypeLoc>());
5472#include "clang/AST/TypeLocNodes.def"
5475 llvm_unreachable(
"unhandled type loc!");
5478template<
typename Derived>
5491template <
typename Derived>
5529template<
typename Derived>
5535 auto SuppressObjCLifetime =
5538 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5539 SuppressObjCLifetime);
5540 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5541 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5542 TLB, STTP, SuppressObjCLifetime);
5544 Result = getDerived().TransformType(TLB, UnqualTL);
5563template <
typename Derived>
5573 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5580 if (T.getPointerAuth().isPresent()) {
5581 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5584 if (!T->isDependentType()) {
5585 if (!T->isSignableType(
SemaRef.getASTContext())) {
5586 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) << T;
5594 if (T->isFunctionType()) {
5595 T =
SemaRef.getASTContext().getAddrSpaceQualType(T,
5605 if (T->isReferenceType()) {
5615 if (!T->isObjCLifetimeType() && !T->isDependentType())
5617 else if (T.getObjCLifetime()) {
5621 const AutoType *AutoTy;
5622 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5628 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5629 T =
SemaRef.Context.getAutoType(AutoTy->getDeducedKind(),
Deduced,
5630 AutoTy->getKeyword(),
5631 AutoTy->getTypeConstraintConcept(),
5632 AutoTy->getTypeConstraintArguments());
5637 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
5643 return SemaRef.BuildQualifiedType(T, Loc, Quals);
5646template <
typename Derived>
5647QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5650 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5653 case TypeLoc::TemplateSpecialization:
5654 return getDerived().TransformTemplateSpecializationType(
5656 FirstQualifierInScope,
true);
5657 case TypeLoc::DependentName:
5658 return getDerived().TransformDependentNameType(
5660 ObjectType, FirstQualifierInScope);
5664 return getDerived().TransformType(TLB, TL);
5668template <
class TyLoc>
static inline
5670 TyLoc NewT = TLB.
push<TyLoc>(T.getType());
5671 NewT.setNameLoc(T.getNameLoc());
5675template<
typename Derived>
5676QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5678 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5679 NewT.setBuiltinLoc(T.getBuiltinLoc());
5680 if (T.needsExtraLocalData())
5681 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5685template<
typename Derived>
5692template <
typename Derived>
5696 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5699template<
typename Derived>
5702 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5703 if (OriginalType.isNull())
5707 if (getDerived().AlwaysRebuild() ||
5708 OriginalType != TL.getOriginalLoc().getType())
5715template <
typename Derived>
5719 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5720 if (OriginalType.isNull())
5724 if (getDerived().AlwaysRebuild() ||
5725 OriginalType != TL.getElementLoc().getType())
5732template<
typename Derived>
5736 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5737 if (PointeeType.isNull())
5741 if (PointeeType->getAs<ObjCObjectType>()) {
5753 if (getDerived().AlwaysRebuild() ||
5754 PointeeType != TL.getPointeeLoc().getType()) {
5755 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5762 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5769template<
typename Derived>
5774 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5775 if (PointeeType.isNull())
5779 if (getDerived().AlwaysRebuild() ||
5780 PointeeType != TL.getPointeeLoc().getType()) {
5781 Result = getDerived().RebuildBlockPointerType(PointeeType,
5796template<
typename Derived>
5804 if (PointeeType.
isNull())
5809 PointeeType != T->getPointeeTypeAsWritten()) {
5811 T->isSpelledAsLValue(),
5833template<
typename Derived>
5837 return TransformReferenceType(TLB, TL);
5840template<
typename Derived>
5842TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5843 RValueReferenceTypeLoc TL) {
5844 return TransformReferenceType(TLB, TL);
5847template<
typename Derived>
5851 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5852 if (PointeeType.isNull())
5859 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5860 if (!NewQualifierLoc)
5863 CXXRecordDecl *OldCls = T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5865 NewCls = cast_or_null<CXXRecordDecl>(
5866 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5872 if (getDerived().AlwaysRebuild() || PointeeType != T->getPointeeType() ||
5873 NewQualifierLoc.getNestedNameSpecifier() !=
5874 OldQualifierLoc.getNestedNameSpecifier() ||
5877 SS.
Adopt(NewQualifierLoc);
5878 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5887 if (MPT && PointeeType != MPT->getPointeeType()) {
5894 NewTL.setQualifierLoc(NewQualifierLoc);
5899template<
typename Derived>
5904 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5905 if (ElementType.isNull())
5909 Expr *OldSize = TL.getSizeExpr();
5911 OldSize =
const_cast<Expr*
>(T->getSizeExpr());
5912 Expr *NewSize =
nullptr;
5916 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5921 if (getDerived().AlwaysRebuild() ||
5922 ElementType != T->getElementType() ||
5923 (T->getSizeExpr() && NewSize != OldSize)) {
5924 Result = getDerived().RebuildConstantArrayType(ElementType,
5925 T->getSizeModifier(),
5926 T->getSize(), NewSize,
5927 T->getIndexTypeCVRQualifiers(),
5928 TL.getBracketsRange());
5939 NewTL.setRBracketLoc(TL.getRBracketLoc());
5940 NewTL.setSizeExpr(NewSize);
5945template<
typename Derived>
5950 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5951 if (ElementType.isNull())
5955 if (getDerived().AlwaysRebuild() ||
5956 ElementType != T->getElementType()) {
5957 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5958 T->getSizeModifier(),
5959 T->getIndexTypeCVRQualifiers(),
5960 TL.getBracketsRange());
5967 NewTL.setRBracketLoc(TL.getRBracketLoc());
5968 NewTL.setSizeExpr(
nullptr);
5973template<
typename Derived>
5978 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5979 if (ElementType.isNull())
5986 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5988 if (SizeResult.isInvalid())
5992 if (SizeResult.isInvalid())
5998 if (getDerived().AlwaysRebuild() ||
5999 ElementType != T->getElementType() ||
6000 Size != T->getSizeExpr()) {
6001 Result = getDerived().RebuildVariableArrayType(ElementType,
6002 T->getSizeModifier(),
6004 T->getIndexTypeCVRQualifiers(),
6005 TL.getBracketsRange());
6014 NewTL.setRBracketLoc(TL.getRBracketLoc());
6015 NewTL.setSizeExpr(Size);
6020template<
typename Derived>
6025 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6026 if (ElementType.isNull())
6034 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6037 Expr *origSize = TL.getSizeExpr();
6038 if (!origSize) origSize = T->getSizeExpr();
6041 = getDerived().TransformExpr(origSize);
6043 if (sizeResult.isInvalid())
6046 Expr *size = sizeResult.get();
6049 if (getDerived().AlwaysRebuild() ||
6050 ElementType != T->getElementType() ||
6052 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6053 T->getSizeModifier(),
6055 T->getIndexTypeCVRQualifiers(),
6056 TL.getBracketsRange());
6065 NewTL.setRBracketLoc(TL.getRBracketLoc());
6066 NewTL.setSizeExpr(size);
6071template <
typename Derived>
6075 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6076 if (ElementType.isNull())
6084 if (
Size.isInvalid())
6088 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6089 Size.get() != T->getSizeExpr()) {
6090 Result = getDerived().RebuildDependentVectorType(
6091 ElementType,
Size.get(), T->getAttributeLoc(), T->getVectorKind());
6109template<
typename Derived>
6116 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6117 if (ElementType.isNull())
6126 if (
Size.isInvalid())
6130 if (getDerived().AlwaysRebuild() ||
6131 ElementType != T->getElementType() ||
6132 Size.get() != T->getSizeExpr()) {
6133 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6135 T->getAttributeLoc());
6153template <
typename Derived>
6158 QualType ElementType = getDerived().TransformType(T->getElementType());
6159 if (ElementType.isNull())
6163 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
6164 Result = getDerived().RebuildConstantMatrixType(
6165 ElementType, T->getNumRows(), T->getNumColumns());
6172 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6173 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6174 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6179template <
typename Derived>
6184 QualType ElementType = getDerived().TransformType(T->getElementType());
6185 if (ElementType.isNull()) {
6193 Expr *origRows = TL.getAttrRowOperand();
6195 origRows = T->getRowExpr();
6196 Expr *origColumns = TL.getAttrColumnOperand();
6198 origColumns = T->getColumnExpr();
6200 ExprResult rowResult = getDerived().TransformExpr(origRows);
6202 if (rowResult.isInvalid())
6205 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6207 if (columnResult.isInvalid())
6210 Expr *rows = rowResult.get();
6211 Expr *columns = columnResult.get();
6214 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
6215 rows != origRows || columns != origColumns) {
6216 Result = getDerived().RebuildDependentSizedMatrixType(
6217 ElementType, rows, columns, T->getAttributeLoc());
6227 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6228 NewTL.setAttrRowOperand(rows);
6229 NewTL.setAttrColumnOperand(columns);
6233template <
typename Derived>
6239 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6241 if (pointeeType.isNull())
6248 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
6250 if (AddrSpace.isInvalid())
6254 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
6255 AddrSpace.get() != T->getAddrSpaceExpr()) {
6256 Result = getDerived().RebuildDependentAddressSpaceType(
6257 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6268 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6269 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6272 TLB.TypeWasModifiedSafely(
Result);
6278template <
typename Derived>
6282 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6283 if (ElementType.isNull())
6287 if (getDerived().AlwaysRebuild() ||
6288 ElementType != T->getElementType()) {
6289 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6290 T->getVectorKind());
6301template<
typename Derived>
6305 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6306 if (ElementType.isNull())
6310 if (getDerived().AlwaysRebuild() ||
6311 ElementType != T->getElementType()) {
6312 Result = getDerived().RebuildExtVectorType(ElementType,
6313 T->getNumElements(),
6325template <
typename Derived>
6328 bool ExpectParameterPack) {
6363 if (NewTSI == OldTSI && indexAdjustment == 0)
6373 getDerived().transformedLocalDecl(OldParm, {newParm});
6377template <
typename Derived>
6385 unsigned *LastParamTransformed) {
6386 int indexAdjustment = 0;
6388 unsigned NumParams = Params.size();
6389 for (
unsigned i = 0; i != NumParams; ++i) {
6390 if (LastParamTransformed)
6391 *LastParamTransformed = i;
6393 assert(OldParm->getFunctionScopeIndex() == i);
6397 if (OldParm->isParameterPack()) {
6402 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6405 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6408 bool ShouldExpand =
false;
6409 bool RetainExpansion =
false;
6411 if (Unexpanded.size() > 0) {
6412 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6413 NumExpansions = OrigNumExpansions;
6417 ShouldExpand, RetainExpansion, NumExpansions)) {
6422 const AutoType *AT =
6423 Pattern.getType().getTypePtr()->getContainedAutoType();
6424 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6425 "Could not find parameter packs or undeduced auto type!");
6432 getDerived().ExpandingFunctionParameterPack(OldParm);
6433 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6436 =
getDerived().TransformFunctionTypeParam(OldParm,
6444 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6445 OutParamTypes.push_back(NewParm->
getType());
6447 PVars->push_back(NewParm);
6452 if (RetainExpansion) {
6453 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6455 =
getDerived().TransformFunctionTypeParam(OldParm,
6463 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6464 OutParamTypes.push_back(NewParm->
getType());
6466 PVars->push_back(NewParm);
6482 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6487 "Parameter pack no longer a parameter pack after "
6490 NewParm =
getDerived().TransformFunctionTypeParam(
6491 OldParm, indexAdjustment, std::nullopt,
6499 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6500 OutParamTypes.push_back(NewParm->
getType());
6502 PVars->push_back(NewParm);
6510 bool IsPackExpansion =
false;
6513 if (
const PackExpansionType *Expansion
6514 = dyn_cast<PackExpansionType>(OldType)) {
6516 QualType Pattern = Expansion->getPattern();
6518 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6521 bool ShouldExpand =
false;
6522 bool RetainExpansion =
false;
6526 RetainExpansion, NumExpansions)) {
6533 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6540 NewType =
getSema().getASTContext().getPackExpansionType(
6541 NewType, std::nullopt);
6548 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6549 OutParamTypes.push_back(NewType);
6551 PVars->push_back(
nullptr);
6560 if (RetainExpansion) {
6561 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6567 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6568 OutParamTypes.push_back(NewType);
6570 PVars->push_back(
nullptr);
6575 OldType = Expansion->getPattern();
6576 IsPackExpansion =
true;
6578 NewType =
getDerived().TransformType(OldType);
6580 NewType =
getDerived().TransformType(OldType);
6586 if (IsPackExpansion)
6587 NewType =
getSema().Context.getPackExpansionType(NewType,
6591 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6592 OutParamTypes.push_back(NewType);
6594 PVars->push_back(
nullptr);
6599 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6601 assert(parm->getFunctionScopeIndex() == i);
6608template<
typename Derived>
6613 return getDerived().TransformFunctionProtoType(
6617 ExceptionStorage, Changed);
6621template<
typename Derived>
template<
typename Fn>
6640 if (T->hasTrailingReturn()) {
6644 T->getExtParameterInfosOrNull(),
6645 ParamTypes, &ParamDecls, ExtParamInfos))
6655 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6657 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6672 T->getExtParameterInfosOrNull(),
6673 ParamTypes, &ParamDecls, ExtParamInfos))
6679 bool EPIChanged =
false;
6684 if (
auto NewExtParamInfos =
6700 std::optional<FunctionEffectSet> NewFX;
6712 std::optional<FunctionEffectMode> Mode =
6732 "FunctionEffectMode::None shouldn't be possible here");
6735 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6738 NewFX->insert(NewEC, Errs);
6739 assert(Errs.empty());
6748 T->getParamTypes() !=
llvm::ArrayRef(ParamTypes) || EPIChanged) {
6749 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6760 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6766template<
typename Derived>
6789 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6804 if (
const PackExpansionType *PackExpansion =
6805 T->getAs<PackExpansionType>()) {
6810 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6812 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6817 bool Expand =
false;
6818 bool RetainExpansion =
false;
6819 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6824 true, Expand, RetainExpansion,
6837 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6838 Exceptions.push_back(
U);
6844 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6848 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6851 Exceptions.push_back(
U);
6855 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6860 Exceptions.push_back(
U);
6870template<
typename Derived>
6880 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6881 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6892template <
typename Derived>
6893QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6894 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6896 const UnresolvedUsingType *T = TL.getTypePtr();
6897 bool Changed =
false;
6899 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6900 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6901 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6904 Changed |= QualifierLoc != OldQualifierLoc;
6907 auto *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6913 if (getDerived().AlwaysRebuild() || Changed) {
6914 Result = getDerived().RebuildUnresolvedUsingType(
6915 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6923 QualifierLoc, TL.getNameLoc());
6926 QualifierLoc, TL.getNameLoc());
6930template <
typename Derived>
6938 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6941 Changed |= QualifierLoc != OldQualifierLoc;
6944 auto *D = cast_or_null<UsingShadowDecl>(
6945 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6950 QualType UnderlyingType = getDerived().TransformType(T->desugar());
6951 if (UnderlyingType.isNull())
6953 Changed |= UnderlyingType != T->desugar();
6956 if (getDerived().AlwaysRebuild() || Changed) {
6957 Result = getDerived().RebuildUsingType(
6958 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6968template<
typename Derived>
6976 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6979 Changed |= QualifierLoc != OldQualifierLoc;
6982 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6983 getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
6991 if (getDerived().AlwaysRebuild() || Changed) {
6992 Result = getDerived().RebuildTypedefType(
6993 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6999 QualifierLoc, TL.getNameLoc());
7003template<
typename Derived>
7011 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7021 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7023 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7030 NewTL.setLParenLoc(TL.getLParenLoc());
7031 NewTL.setRParenLoc(TL.getRParenLoc());
7036template<
typename Derived>
7040 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7046 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7047 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7054 NewTL.setLParenLoc(TL.getLParenLoc());
7055 NewTL.setRParenLoc(TL.getRParenLoc());
7056 NewTL.setUnmodifiedTInfo(New_Under_TI);
7061template<
typename Derived>
7064 const DecltypeType *T = TL.getTypePtr();
7071 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
7075 E = getSema().ActOnDecltypeExpression(E.get());
7080 if (getDerived().AlwaysRebuild() ||
7081 E.get() != T->getUnderlyingExpr()) {
7082 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7090 NewTL.setRParenLoc(TL.getRParenLoc());
7094template <
typename Derived>
7104 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7105 if (IndexExpr.isInvalid())
7108 QualType Pattern = TL.getPattern();
7110 const PackIndexingType *PIT = TL.
getTypePtr();
7114 bool NotYetExpanded = Types.empty();
7115 bool FullySubstituted =
true;
7117 if (Types.empty() && !PIT->expandsToEmptyPack())
7121 if (!T->containsUnexpandedParameterPack()) {
7122 QualType Transformed = getDerived().TransformType(T);
7123 if (Transformed.isNull())
7125 SubtitutedTypes.push_back(Transformed);
7130 getSema().collectUnexpandedParameterPacks(T, Unexpanded);
7131 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7134 bool ShouldExpand =
true;
7135 bool RetainExpansion =
false;
7137 if (getDerived().TryExpandParameterPacks(
7140 RetainExpansion, NumExpansions))
7142 if (!ShouldExpand) {
7148 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7151 if (NotYetExpanded) {
7152 FullySubstituted =
false;
7153 QualType Out = getDerived().RebuildPackIndexingType(
7163 SubtitutedTypes.push_back(Pack);
7166 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7171 SubtitutedTypes.push_back(Out);
7172 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7176 if (RetainExpansion) {
7177 FullySubstituted =
false;
7178 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7182 SubtitutedTypes.push_back(Out);
7190 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7192 QualType Out = getDerived().RebuildPackIndexingType(
7194 FullySubstituted, SubtitutedTypes);
7203template<
typename Derived>
7209 if (
Result->isDependentType()) {
7210 const UnaryTransformType *T = TL.getTypePtr();
7212 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7215 QualType NewBase = NewBaseTSI->getType();
7217 Result = getDerived().RebuildUnaryTransformType(NewBase,
7226 NewTL.setParensRange(TL.getParensRange());
7227 NewTL.setUnderlyingTInfo(NewBaseTSI);
7231template<
typename Derived>
7234 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
7239 TL.getTemplateNameLoc());
7243 QualType OldDeduced = T->getDeducedType();
7245 if (!OldDeduced.isNull()) {
7246 NewDeduced = getDerived().TransformType(OldDeduced);
7247 if (NewDeduced.isNull())
7251 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7259 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7260 NewTL.setQualifierLoc(QualifierLoc);
7264template <
typename Derived>
7271 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7276 auto *TD = cast_or_null<TagDecl>(
7283 TD != T->getDecl()) {
7284 if (T->isCanonicalUnqualified())
7301template <
typename Derived>
7307template <
typename Derived>
7308QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7310 return getDerived().TransformTagType(TLB, TL);
7313template<
typename Derived>
7320template<
typename Derived>
7324 return getDerived().TransformTemplateTypeParmType(
7329template <
typename Derived>
7335template<
typename Derived>
7336QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7337 TypeLocBuilder &TLB,
7338 SubstTemplateTypeParmTypeLoc TL) {
7339 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7342 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7347 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7348 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7349 if (Replacement.isNull())
7353 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7357 SubstTemplateTypeParmTypeLoc NewTL
7358 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7359 NewTL.setNameLoc(TL.getNameLoc());
7363template <
typename Derived>
7369template<
typename Derived>
7373 return getDerived().TransformSubstTemplateTypeParmPackType(
7377template <
typename Derived>
7383template<
typename Derived>
7384QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7386 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7387 if (ValueType.isNull())
7390 QualType
Result = TL.getType();
7391 if (getDerived().AlwaysRebuild() ||
7392 ValueType != TL.getValueLoc().getType()) {
7393 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7400 NewTL.setLParenLoc(TL.getLParenLoc());
7401 NewTL.setRParenLoc(TL.getRParenLoc());
7406template <
typename Derived>
7409 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7410 if (ValueType.isNull())
7414 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7417 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7428template <
typename Derived>
7434 if (getDerived().AlwaysRebuild()) {
7435 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7436 EIT->getNumBits(), TL.getNameLoc());
7446template <
typename Derived>
7453 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7456 if (BitsExpr.isInvalid())
7461 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7462 Result = getDerived().RebuildDependentBitIntType(
7463 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7479template <
typename Derived>
7482 llvm_unreachable(
"This type does not need to be transformed.");
7490 template<
typename ArgLocContainer>
7492 ArgLocContainer *Container;
7517 : Container(&Container), Index(Index) { }
7531 return Container->getArgLoc(Index);
7535 return pointer(Container->getArgLoc(Index));
7540 return X.Container == Y.Container &&
X.Index == Y.Index;
7549template<
typename Derived>
7550QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7552 const AutoType *T = TL.getTypePtr();
7553 QualType OldDeduced = T->getDeducedType();
7554 QualType NewDeduced;
7555 if (!OldDeduced.isNull()) {
7556 NewDeduced = getDerived().TransformType(OldDeduced);
7557 if (NewDeduced.isNull())
7564 if (T->isConstrained()) {
7565 assert(TL.getConceptReference());
7566 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7567 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7569 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7570 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7572 if (getDerived().TransformTemplateArguments(
7573 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7577 if (TL.getNestedNameSpecifierLoc()) {
7579 = getDerived().TransformNestedNameSpecifierLoc(
7580 TL.getNestedNameSpecifierLoc());
7581 if (!NewNestedNameSpec)
7587 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7588 T->isDependentType() || T->isConstrained()) {
7591 NewArgList.reserve(NewTemplateArgs.size());
7592 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7593 NewArgList.push_back(ArgLoc.getArgument());
7594 Result = getDerived().RebuildAutoType(
7596 NewDeduced, T->getKeyword(), NewCD, NewArgList);
7603 NewTL.setRParenLoc(TL.getRParenLoc());
7604 NewTL.setConceptReference(
nullptr);
7606 if (T->isConstrained()) {
7608 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7609 TL.getConceptNameLoc(),
7610 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7612 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7613 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7615 NewTL.setConceptReference(CR);
7621template <
typename Derived>
7624 return getDerived().TransformTemplateSpecializationType(
7629template <
typename Derived>
7632 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7633 const TemplateSpecializationType *T = TL.
getTypePtr();
7639 AllowInjectedClassName);
7648 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7657 QualType Result = getDerived().RebuildTemplateSpecializationType(
7670template <
typename Derived>
7674 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7675 if (modifiedType.isNull())
7682 oldType->getAttrKind(), modifiedType,
7683 TL.getAttr() ? TL.getAttr()->getLocation()
7684 : TL.getModifiedLoc().getBeginLoc()))
7688 const Attr *oldAttr = TL.getAttr();
7689 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7690 if (oldAttr && !newAttr)
7696 if (getDerived().AlwaysRebuild() ||
7697 modifiedType != oldType->getModifiedType()) {
7710 QualType equivalentType = modifiedType;
7711 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7713 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7715 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7716 if (equivalentType.isNull())
7722 if (
auto nullability = oldType->getImmediateNullability()) {
7723 if (!modifiedType->canHaveNullability()) {
7724 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7725 : TL.getModifiedLoc().getBeginLoc()),
7726 diag::err_nullability_nonpointer)
7743template <
typename Derived>
7747 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7748 if (InnerTy.isNull())
7751 Expr *OldCount = TL.getCountExpr();
7752 Expr *NewCount =
nullptr;
7754 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7755 if (CountResult.isInvalid())
7757 NewCount = CountResult.get();
7761 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7762 OldCount != NewCount) {
7765 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7772template <
typename Derived>
7776 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7779template <
typename Derived>
7782 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7783 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7784 if (InnerTy.isNull())
7788 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7800template <
typename Derived>
7804 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7806 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7807 if (WrappedTy.isNull())
7811 QualType OldContainedTy = oldType->getContainedType();
7813 if (!OldContainedTy.isNull()) {
7814 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7815 if (!oldContainedTSI)
7816 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7818 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7821 ContainedTy = ContainedTSI->getType();
7825 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7826 ContainedTy != oldType->getContainedType()) {
7828 WrappedTy, ContainedTy, oldType->getAttrs());
7834 NewTL.setContainedTypeSourceInfo(ContainedTSI);
7838template <
typename Derived>
7842 return TL.getType();
7845template<
typename Derived>
7849 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7854 if (getDerived().AlwaysRebuild() ||
7855 Inner != TL.getInnerLoc().getType()) {
7856 Result = getDerived().RebuildParenType(Inner);
7863 NewTL.setRParenLoc(TL.getRParenLoc());
7867template <
typename Derived>
7871 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7876 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7878 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7888template<
typename Derived>
7889QualType TreeTransform<Derived>::TransformDependentNameType(
7891 return TransformDependentNameType(TLB, TL,
false);
7894template <
typename Derived>
7895QualType TreeTransform<Derived>::TransformDependentNameType(
7898 const DependentNameType *T = TL.
getTypePtr();
7902 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7903 QualifierLoc, ObjectType, UnqualLookup);
7907 assert((ObjectType.isNull() && !UnqualLookup) &&
7908 "must be transformed by TransformNestedNameSpecifierLoc");
7912 = getDerived().RebuildDependentNameType(T->getKeyword(),
7913 TL.getElaboratedKeywordLoc(),
7924 NewTL.setQualifierLoc(QualifierLoc);
7925 NewTL.setNameLoc(TL.getNameLoc());
7929 NewTL.setTemplateNameLoc(TL.getNameLoc());
7930 NewTL.setQualifierLoc(QualifierLoc);
7933 QualifierLoc, TL.getNameLoc());
7936 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7940 NewTL.setQualifierLoc(QualifierLoc);
7941 NewTL.setNameLoc(TL.getNameLoc());
7946template<
typename Derived>
7950 = getDerived().TransformType(TLB, TL.getPatternLoc());
7951 if (Pattern.isNull())
7955 if (getDerived().AlwaysRebuild() ||
7956 Pattern != TL.getPatternLoc().getType()) {
7957 Result = getDerived().RebuildPackExpansionType(Pattern,
7958 TL.getPatternLoc().getSourceRange(),
7959 TL.getEllipsisLoc(),
7960 TL.getTypePtr()->getNumExpansions());
7970template<
typename Derived>
7975 TLB.pushFullCopy(TL);
7976 return TL.getType();
7979template<
typename Derived>
7983 const ObjCTypeParamType *T = TL.getTypePtr();
7985 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7990 if (getDerived().AlwaysRebuild() ||
7991 OTP != T->getDecl()) {
7992 Result = getDerived().RebuildObjCTypeParamType(
7993 OTP, TL.getProtocolLAngleLoc(),
7994 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7995 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8001 if (TL.getNumProtocols()) {
8002 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8003 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8004 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8005 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8010template<
typename Derived>
8015 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8016 if (BaseType.isNull())
8019 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8023 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8025 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8026 QualType TypeArg = TypeArgInfo->getType();
8031 const auto *PackExpansion = PackExpansionLoc.getType()
8032 ->castAs<PackExpansionType>();
8036 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8040 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8041 bool Expand =
false;
8042 bool RetainExpansion =
false;
8043 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8044 if (getDerived().TryExpandParameterPacks(
8045 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8046 Unexpanded,
true, Expand,
8047 RetainExpansion, NumExpansions))
8057 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8058 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8060 if (NewPatternType.isNull())
8064 NewPatternType, NumExpansions);
8066 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8067 NewTypeArgInfos.push_back(
8068 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8074 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8078 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8080 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8082 if (NewTypeArg.isNull())
8085 NewTypeArgInfos.push_back(
8086 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8093 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8095 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8096 if (NewTypeArg.isNull())
8100 if (NewTypeArg == TypeArg) {
8101 NewTypeArgInfos.push_back(TypeArgInfo);
8105 NewTypeArgInfos.push_back(
8106 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8111 if (getDerived().AlwaysRebuild() || AnyChanged) {
8113 Result = getDerived().RebuildObjCObjectType(
8114 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8115 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8116 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8117 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8125 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8126 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8127 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8128 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8129 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8130 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8131 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8132 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8136template<
typename Derived>
8140 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8141 if (PointeeType.isNull())
8145 if (getDerived().AlwaysRebuild() ||
8146 PointeeType != TL.getPointeeLoc().getType()) {
8147 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8161template<
typename Derived>
8167template<
typename Derived>
8170 return getDerived().TransformCompoundStmt(S,
false);
8173template<
typename Derived>
8180 getSema().resetFPOptions(
8183 bool SubStmtInvalid =
false;
8184 bool SubStmtChanged =
false;
8186 for (
auto *B : S->
body()) {
8188 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8189 : StmtDiscardKind::Discarded);
8191 if (
Result.isInvalid()) {
8198 SubStmtInvalid =
true;
8202 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8203 Statements.push_back(
Result.getAs<Stmt>());
8209 if (!getDerived().AlwaysRebuild() &&
8213 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8219template<
typename Derived>
8228 LHS = getDerived().TransformExpr(S->getLHS());
8230 if (LHS.isInvalid())
8234 RHS = getDerived().TransformExpr(S->getRHS());
8236 if (RHS.isInvalid())
8243 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8245 S->getEllipsisLoc(),
8248 if (Case.isInvalid())
8253 getDerived().TransformStmt(S->getSubStmt());
8254 if (SubStmt.isInvalid())
8258 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8261template <
typename Derived>
8265 getDerived().TransformStmt(S->getSubStmt());
8266 if (SubStmt.isInvalid())
8270 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8274template<
typename Derived>
8277 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8278 if (SubStmt.isInvalid())
8281 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8289 if (LD == S->getDecl())
8290 S->getDecl()->setStmt(
nullptr);
8293 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8298template <
typename Derived>
8303 switch (R->getKind()) {
8307 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8308#include "clang/Basic/AttrList.inc"
8313template <
typename Derived>
8320 switch (R->getKind()) {
8324 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8325#include "clang/Basic/AttrList.inc"
8330template <
typename Derived>
8333 StmtDiscardKind SDK) {
8338 bool AttrsChanged =
false;
8342 for (
const auto *I : S->
getAttrs()) {
8344 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8345 AttrsChanged |= (I != R);
8358 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8362template<
typename Derived>
8367 if (
Init.isInvalid())
8371 if (!S->isConsteval()) {
8373 Cond = getDerived().TransformCondition(
8374 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8377 if (
Cond.isInvalid())
8382 std::optional<bool> ConstexprConditionValue;
8383 if (S->isConstexpr())
8384 ConstexprConditionValue =
Cond.getKnownValue();
8388 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8392 S->isNonNegatedConsteval());
8394 Then = getDerived().TransformStmt(S->getThen());
8395 if (Then.isInvalid())
8401 Then =
new (getSema().Context)
8402 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8407 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8411 S->isNegatedConsteval());
8413 Else = getDerived().TransformStmt(S->getElse());
8414 if (Else.isInvalid())
8416 }
else if (S->getElse() && ConstexprConditionValue &&
8417 *ConstexprConditionValue) {
8421 Else =
new (getSema().Context)
8422 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8425 if (!getDerived().AlwaysRebuild() &&
8426 Init.get() == S->getInit() &&
8427 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8428 Then.get() == S->getThen() &&
8429 Else.get() == S->getElse())
8432 return getDerived().RebuildIfStmt(
8433 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8434 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8437template<
typename Derived>
8442 if (
Init.isInvalid())
8447 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8449 if (
Cond.isInvalid())
8454 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8455 Init.get(),
Cond, S->getRParenLoc());
8460 StmtResult Body = getDerived().TransformStmt(S->getBody());
8461 if (Body.isInvalid())
8465 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8469template<
typename Derived>
8474 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8476 if (
Cond.isInvalid())
8485 StmtResult Body = getDerived().TransformStmt(S->getBody());
8486 if (Body.isInvalid())
8489 if (!getDerived().AlwaysRebuild() &&
8490 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8491 Body.get() == S->getBody())
8494 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8495 Cond, S->getRParenLoc(), Body.get());
8498template<
typename Derived>
8507 StmtResult Body = getDerived().TransformStmt(S->getBody());
8508 if (Body.isInvalid())
8513 if (
Cond.isInvalid())
8516 if (!getDerived().AlwaysRebuild() &&
8517 Cond.get() == S->getCond() &&
8518 Body.get() == S->getBody())
8521 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8522 S->getWhileLoc(),
Cond.get(),
8526template<
typename Derived>
8529 if (getSema().getLangOpts().OpenMP)
8530 getSema().OpenMP().startOpenMPLoop();
8534 if (
Init.isInvalid())
8539 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8540 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8545 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8547 if (
Cond.isInvalid())
8552 if (
Inc.isInvalid())
8556 if (S->getInc() && !FullInc.get())
8563 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8564 Cond.get().second, S->getInc(),
Inc.get());
8567 StmtResult Body = getDerived().TransformStmt(S->getBody());
8568 if (Body.isInvalid())
8573 if (!getDerived().AlwaysRebuild() &&
8574 Init.get() == S->getInit() &&
8575 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8576 Inc.get() == S->getInc() &&
8577 Body.get() == S->getBody())
8580 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8582 S->getRParenLoc(), Body.get());
8585template<
typename Derived>
8588 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8594 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8598template<
typename Derived>
8606 if (!getDerived().AlwaysRebuild() &&
8607 Target.get() == S->getTarget())
8610 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8614template<
typename Derived>
8617 if (!S->hasLabelTarget())
8620 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8629template<
typename Derived>
8632 if (!S->hasLabelTarget())
8635 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8644template <
typename Derived>
8652template<
typename Derived>
8662 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8665template<
typename Derived>
8668 bool DeclChanged =
false;
8671 for (
auto *D : S->decls()) {
8672 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8676 if (Transformed != D)
8680 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8681 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8682 LSI->ContainsUnexpandedParameterPack |=
8683 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8685 LSI->ContainsUnexpandedParameterPack |=
8688 .getTypeDeclType(TD)
8689 ->containsUnexpandedParameterPack();
8692 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8693 LSI->ContainsUnexpandedParameterPack |=
8694 VD->getType()->containsUnexpandedParameterPack();
8697 Decls.push_back(Transformed);
8700 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8703 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8706template<
typename Derived>
8716 bool ExprsChanged =
false;
8718 auto RebuildString = [&](
Expr *E) {
8723 ExprsChanged =
true;
8730 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8731 Names.push_back(S->getOutputIdentifier(I));
8737 Constraints.push_back(
Result.get());
8740 Expr *OutputExpr = S->getOutputExpr(I);
8741 Result = getDerived().TransformExpr(OutputExpr);
8745 ExprsChanged |=
Result.get() != OutputExpr;
8747 Exprs.push_back(
Result.get());
8751 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8752 Names.push_back(S->getInputIdentifier(I));
8758 Constraints.push_back(
Result.get());
8761 Expr *InputExpr = S->getInputExpr(I);
8762 Result = getDerived().TransformExpr(InputExpr);
8766 ExprsChanged |=
Result.get() != InputExpr;
8768 Exprs.push_back(
Result.get());
8772 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8773 Names.push_back(S->getLabelIdentifier(I));
8778 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8779 Exprs.push_back(
Result.get());
8783 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8787 Clobbers.push_back(
Result.get());
8790 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8791 if (AsmString.isInvalid())
8794 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8797 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8798 S->isVolatile(), S->getNumOutputs(),
8799 S->getNumInputs(), Names.data(),
8800 Constraints, Exprs, AsmString.get(),
8801 Clobbers, S->getNumLabels(),
8805template<
typename Derived>
8810 bool HadError =
false, HadChange =
false;
8814 TransformedExprs.reserve(SrcExprs.size());
8815 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8817 if (!
Result.isUsable()) {
8820 HadChange |= (
Result.get() != SrcExprs[i]);
8821 TransformedExprs.push_back(
Result.get());
8826 if (!HadChange && !getDerived().AlwaysRebuild())
8829 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8830 AsmToks, S->getAsmString(),
8831 S->getNumOutputs(), S->getNumInputs(),
8832 S->getAllConstraints(), S->getClobbers(),
8833 TransformedExprs, S->getEndLoc());
8837template<
typename Derived>
8842 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8843 ScopeInfo->NeedsCoroutineSuspends &&
8844 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8845 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8846 "expected clean scope info");
8850 ScopeInfo->setNeedsCoroutineSuspends(
false);
8863 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8864 ScopeInfo->CoroutinePromise = Promise;
8869 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8870 if (InitSuspend.isInvalid())
8873 getDerived().TransformStmt(S->getFinalSuspendStmt());
8874 if (FinalSuspend.isInvalid() ||
8877 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8880 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8881 if (BodyRes.isInvalid())
8885 if (Builder.isInvalid())
8888 Expr *ReturnObject = S->getReturnValueInit();
8889 assert(ReturnObject &&
"the return object is expected to be valid");
8890 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8892 if (Res.isInvalid())
8894 Builder.ReturnValue = Res.get();
8899 if (S->hasDependentPromiseType()) {
8902 if (!Promise->getType()->isDependentType()) {
8903 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8904 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8905 "these nodes should not have been built yet");
8906 if (!Builder.buildDependentStatements())
8910 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8911 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8912 if (Res.isInvalid())
8914 Builder.OnFallthrough = Res.get();
8917 if (
auto *OnException = S->getExceptionHandler()) {
8918 StmtResult Res = getDerived().TransformStmt(OnException);
8919 if (Res.isInvalid())
8921 Builder.OnException = Res.get();
8924 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8925 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8926 if (Res.isInvalid())
8928 Builder.ReturnStmtOnAllocFailure = Res.get();
8932 assert(S->getAllocate() && S->getDeallocate() &&
8933 "allocation and deallocation calls must already be built");
8934 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8935 if (AllocRes.isInvalid())
8937 Builder.Allocate = AllocRes.get();
8939 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8940 if (DeallocRes.isInvalid())
8942 Builder.Deallocate = DeallocRes.get();
8944 if (
auto *ResultDecl = S->getResultDecl()) {
8945 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8946 if (Res.isInvalid())
8948 Builder.ResultDecl = Res.get();
8953 if (Res.isInvalid())
8955 Builder.ReturnStmt = Res.get();
8959 return getDerived().RebuildCoroutineBodyStmt(Builder);
8962template<
typename Derived>
8972 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8976template <
typename Derived>
8989 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8990 getSema().getCurScope(), E->getKeywordLoc());
8994 return getDerived().RebuildCoawaitExpr(
8995 E->getKeywordLoc(),
Operand.get(),
8999template <
typename Derived>
9002 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9004 if (OperandResult.isInvalid())
9008 E->getOperatorCoawaitLookup());
9015 return getDerived().RebuildDependentCoawaitExpr(
9016 E->getKeywordLoc(), OperandResult.get(),
9020template<
typename Derived>
9030 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9035template<
typename Derived>
9039 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9040 if (TryBody.isInvalid())
9044 bool AnyCatchChanged =
false;
9046 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9047 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9048 if (Catch.isInvalid())
9050 if (Catch.get() != S->getCatchStmt(I))
9051 AnyCatchChanged =
true;
9052 CatchStmts.push_back(Catch.get());
9057 if (S->getFinallyStmt()) {
9058 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9059 if (Finally.isInvalid())
9064 if (!getDerived().AlwaysRebuild() &&
9065 TryBody.get() == S->getTryBody() &&
9067 Finally.get() == S->getFinallyStmt())
9071 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9072 CatchStmts, Finally.get());
9075template<
typename Derived>
9080 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9082 if (FromVar->getTypeSourceInfo()) {
9083 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9090 T = TSInfo->getType();
9092 T = getDerived().TransformType(FromVar->getType());
9097 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
9102 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9103 if (Body.isInvalid())
9106 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9111template<
typename Derived>
9115 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9116 if (Body.isInvalid())
9120 if (!getDerived().AlwaysRebuild() &&
9121 Body.get() == S->getFinallyBody())
9125 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9129template<
typename Derived>
9133 if (S->getThrowExpr()) {
9134 Operand = getDerived().TransformExpr(S->getThrowExpr());
9139 if (!getDerived().AlwaysRebuild() &&
9140 Operand.get() == S->getThrowExpr())
9143 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9146template<
typename Derived>
9155 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9161 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9162 if (Body.isInvalid())
9166 if (!getDerived().AlwaysRebuild() &&
9167 Object.get() == S->getSynchExpr() &&
9168 Body.get() == S->getSynchBody())
9172 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9173 Object.get(), Body.get());
9176template<
typename Derived>
9181 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9182 if (Body.isInvalid())
9186 if (!getDerived().AlwaysRebuild() &&
9187 Body.get() == S->getSubStmt())
9191 return getDerived().RebuildObjCAutoreleasePoolStmt(
9192 S->getAtLoc(), Body.get());
9195template<
typename Derived>
9200 StmtResult Element = getDerived().TransformStmt(
9201 S->getElement(), StmtDiscardKind::NotDiscarded);
9202 if (Element.isInvalid())
9206 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9207 if (Collection.isInvalid())
9211 StmtResult Body = getDerived().TransformStmt(S->getBody());
9212 if (Body.isInvalid())
9216 if (!getDerived().AlwaysRebuild() &&
9217 Element.get() == S->getElement() &&
9218 Collection.get() == S->getCollection() &&
9219 Body.get() == S->getBody())
9223 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9230template <
typename Derived>
9234 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9236 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9240 Var = getDerived().RebuildExceptionDecl(
9241 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9242 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9243 if (!Var || Var->isInvalidDecl())
9248 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9249 if (Handler.isInvalid())
9252 if (!getDerived().AlwaysRebuild() && !Var &&
9253 Handler.get() == S->getHandlerBlock())
9256 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9259template <
typename Derived>
9262 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9263 if (TryBlock.isInvalid())
9267 bool HandlerChanged =
false;
9269 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9270 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9271 if (Handler.isInvalid())
9274 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9275 Handlers.push_back(Handler.getAs<
Stmt>());
9278 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9280 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9284 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9288template<
typename Derived>
9299 auto &LastRecord = getSema().currentEvaluationContext();
9300 LastRecord.InLifetimeExtendingContext =
true;
9301 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9304 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9305 if (
Init.isInvalid())
9309 if (
Range.isInvalid())
9314 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9315 auto ForRangeLifetimeExtendTemps =
9316 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9318 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9319 if (Begin.isInvalid())
9321 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9322 if (End.isInvalid())
9326 if (
Cond.isInvalid())
9330 if (
Cond.isInvalid())
9336 if (
Inc.isInvalid())
9341 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9342 if (LoopVar.isInvalid())
9346 if (getDerived().AlwaysRebuild() ||
9347 Init.get() != S->getInit() ||
9348 Range.get() != S->getRangeStmt() ||
9349 Begin.get() != S->getBeginStmt() ||
9350 End.get() != S->getEndStmt() ||
9351 Cond.get() != S->getCond() ||
9352 Inc.get() != S->getInc() ||
9353 LoopVar.get() != S->getLoopVarStmt()) {
9354 NewStmt = getDerived().RebuildCXXForRangeStmt(
9355 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9356 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9357 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9358 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9360 getSema().ActOnInitializerError(
9371 StmtResult Body = getDerived().TransformStmt(S->getBody());
9372 if (Body.isInvalid())
9379 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9380 NewStmt = getDerived().RebuildCXXForRangeStmt(
9381 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9382 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9383 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9384 if (NewStmt.isInvalid())
9388 if (NewStmt.get() == S)
9391 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9394template <
typename Derived>
9400 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9401 if (!ESD || ESD->isInvalidDecl())
9408 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9411 return getDerived().TransformStmt(SubStmt);
9430 if (S->isDependent() || S->isIterating()) {
9436 if (S->isDependent()) {
9442 ExpansionInitializer =
9443 getDerived().TransformExpr(S->getExpansionInitializer());
9444 if (ExpansionInitializer.isInvalid())
9446 }
else if (S->isIterating()) {
9447 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9448 if (
Range.isInvalid())
9452 ExpansionInitializer =
9455 LifetimeExtendTemps =
9460 if (S->isEnumerating()) {
9462 getDerived().TransformStmt(S->getExpansionVarStmt());
9463 if (ExpansionVar.isInvalid())
9468 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9469 }
else if (S->isIterating()) {
9470 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9471 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9472 if (Begin.isInvalid() || Iter.isInvalid())
9479 getDerived().TransformStmt(S->getExpansionVarStmt());
9480 if (ExpansionVar.isInvalid())
9486 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9490 NewPattern->getRangeVar(), LifetimeExtendTemps);
9491 }
else if (S->isDependent()) {
9493 getDerived().TransformStmt(S->getExpansionVarStmt());
9494 if (ExpansionVar.isInvalid())
9499 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9500 S->getRParenLoc(), LifetimeExtendTemps);
9502 if (Res.isInvalid())
9512 llvm_unreachable(
"destructuring pattern should never be instantiated");
9515 StmtResult Body = getDerived().TransformStmt(S->getBody());
9516 if (Body.isInvalid())
9522template <
typename Derived>
9525 bool SubStmtChanged =
false;
9528 for (
Stmt *OldDS : OldStmts) {
9529 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9530 if (NewDS.isInvalid())
9533 SubStmtChanged |= NewDS.get() != OldDS;
9534 NewStmts.push_back(NewDS.get());
9541 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9542 if (!ESD || ESD->isInvalidDecl())
9556 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9559 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9567 if (TransformStmts(Instantiations, S->getInstantiations()))
9570 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9574 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9575 S->shouldApplyLifetimeExtensionToPreamble());
9578template <
typename Derived>
9582 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9583 if (
Range.isInvalid() || Idx.isInvalid())
9586 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9587 Idx.get() == E->getIndexExpr())
9594template<
typename Derived>
9600 if (S->getQualifierLoc()) {
9602 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9609 if (NameInfo.getName()) {
9610 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9611 if (!NameInfo.getName())
9616 if (!getDerived().AlwaysRebuild() &&
9617 QualifierLoc == S->getQualifierLoc() &&
9618 NameInfo.getName() == S->getNameInfo().getName())
9623 SS.
Adopt(QualifierLoc);
9625 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9627 if (S->isIfExists())
9630 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9633 if (S->isIfNotExists())
9636 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9647 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9648 if (SubStmt.isInvalid())
9656 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9663template<
typename Derived>
9667 if (E->getQualifierLoc()) {
9669 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9675 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9680 if (
Base.isInvalid())
9686 QualifierLoc, E->getMemberLoc());
9689template <
typename Derived>
9693 if (BaseRes.isInvalid())
9695 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9696 if (IdxRes.isInvalid())
9699 if (!getDerived().AlwaysRebuild() &&
9700 BaseRes.get() == E->getBase() &&
9701 IdxRes.get() == E->getIdx())
9704 return getDerived().RebuildArraySubscriptExpr(
9705 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9708template <
typename Derived>
9710 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9711 if (TryBlock.isInvalid())
9714 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9715 if (Handler.isInvalid())
9718 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9719 Handler.get() == S->getHandler())
9722 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9723 TryBlock.get(), Handler.get());
9726template <
typename Derived>
9729 if (
Block.isInvalid())
9732 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9735template <
typename Derived>
9737 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9738 if (FilterExpr.isInvalid())
9742 if (
Block.isInvalid())
9745 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9749template <
typename Derived>
9757template<
typename Derived>
9767template <
typename Derived>
9769TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9773 return getDerived().TransformStmt(L->getLoopStmt());
9776template <
typename Derived>
9783 TClauses.reserve(Clauses.size());
9787 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9789 getDerived().getSema().OpenMP().EndOpenMPClause();
9791 TClauses.push_back(Clause);
9793 TClauses.push_back(
nullptr);
9797 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9798 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9799 D->getDirectiveKind(),
9805 if (D->getDirectiveKind() == OMPD_atomic ||
9806 D->getDirectiveKind() == OMPD_critical ||
9807 D->getDirectiveKind() == OMPD_section ||
9808 D->getDirectiveKind() == OMPD_master)
9809 CS = D->getAssociatedStmt();
9811 CS = D->getRawStmt();
9814 getSema().getLangOpts().OpenMPIRBuilder)
9818 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9823 if (TClauses.size() != Clauses.size()) {
9829 if (D->getDirectiveKind() == OMPD_critical) {
9831 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9834 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9836 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9840 return getDerived().RebuildOMPExecutableDirective(
9841 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9842 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9850template <
typename Derived>
9857 TClauses.reserve(Clauses.size());
9860 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9862 getDerived().getSema().OpenMP().EndOpenMPClause();
9864 TClauses.push_back(Clause);
9866 TClauses.push_back(
nullptr);
9870 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9871 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9872 D->getDirectiveKind(),
9877 assert(D->getDirectiveKind() == OMPD_assume &&
9878 "Unexpected informational directive");
9879 Stmt *CS = D->getAssociatedStmt();
9883 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9887 if (TClauses.size() != Clauses.size())
9892 return getDerived().RebuildOMPInformationalDirective(
9893 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9894 D->getBeginLoc(), D->getEndLoc());
9897template <
typename Derived>
9902 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9903 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9907template <
typename Derived>
9909TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9910 DeclarationNameInfo DirName;
9911 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9912 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9913 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9914 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9918template <
typename Derived>
9922 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9923 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9924 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9925 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9929template <
typename Derived>
9933 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9934 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9935 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9936 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9940template <
typename Derived>
9944 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9945 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9946 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9947 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9951template <
typename Derived>
9955 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9956 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9957 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9958 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9962template <
typename Derived>
9966 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9967 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9968 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9969 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9973template <
typename Derived>
9975 OMPInterchangeDirective *D) {
9977 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9978 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9979 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9980 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9984template <
typename Derived>
9988 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9989 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9990 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9991 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9995template <
typename Derived>
9999 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10000 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10001 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10002 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10006template <
typename Derived>
10010 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10011 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10012 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10013 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10017template <
typename Derived>
10021 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10022 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10023 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10024 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10028template <
typename Derived>
10032 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10033 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10034 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10035 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10039template <
typename Derived>
10043 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10044 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10045 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10046 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10050template <
typename Derived>
10054 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10055 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10056 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10057 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10061template <
typename Derived>
10065 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10066 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10067 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10068 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10072template <
typename Derived>
10076 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10077 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10078 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10079 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10083template <
typename Derived>
10087 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
10088 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10089 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093template <
typename Derived>
10095 OMPParallelForDirective *D) {
10097 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10098 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10099 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10100 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104template <
typename Derived>
10106 OMPParallelForSimdDirective *D) {
10108 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10109 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10110 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10111 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115template <
typename Derived>
10117 OMPParallelMasterDirective *D) {
10119 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10120 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10121 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10122 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126template <
typename Derived>
10128 OMPParallelMaskedDirective *D) {
10130 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10131 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10132 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10133 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137template <
typename Derived>
10139 OMPParallelSectionsDirective *D) {
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10143 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10144 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148template <
typename Derived>
10152 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10153 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10161 OMPTaskyieldDirective *D) {
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10165 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10166 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10170template <
typename Derived>
10174 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10175 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10176 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10177 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10181template <
typename Derived>
10185 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10186 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10187 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10188 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10192template <
typename Derived>
10196 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10197 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10216 OMPTaskgroupDirective *D) {
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10220 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10221 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10225template <
typename Derived>
10229 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10230 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10231 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10232 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10236template <
typename Derived>
10240 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10241 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10242 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10243 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10247template <
typename Derived>
10251 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10252 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10253 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10254 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10258template <
typename Derived>
10262 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10263 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
10264 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10265 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10269template <
typename Derived>
10273 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10274 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10275 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10276 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10280template <
typename Derived>
10284 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10285 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10286 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10287 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10291template <
typename Derived>
10293 OMPTargetDataDirective *D) {
10295 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10296 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10297 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10298 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10302template <
typename Derived>
10304 OMPTargetEnterDataDirective *D) {
10306 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10307 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10308 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10309 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10313template <
typename Derived>
10315 OMPTargetExitDataDirective *D) {
10317 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10318 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10319 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10320 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10324template <
typename Derived>
10326 OMPTargetParallelDirective *D) {
10328 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10329 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10330 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10331 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10335template <
typename Derived>
10337 OMPTargetParallelForDirective *D) {
10339 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10340 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10341 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10342 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10346template <
typename Derived>
10348 OMPTargetUpdateDirective *D) {
10350 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10351 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10352 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10353 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10357template <
typename Derived>
10361 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10362 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10363 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10364 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10368template <
typename Derived>
10370 OMPCancellationPointDirective *D) {
10372 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10373 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10374 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10375 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10379template <
typename Derived>
10383 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10384 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10385 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10386 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10390template <
typename Derived>
10394 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10395 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10396 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10397 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10401template <
typename Derived>
10403 OMPTaskLoopSimdDirective *D) {
10405 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10406 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10407 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10408 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10412template <
typename Derived>
10414 OMPMasterTaskLoopDirective *D) {
10416 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10417 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10418 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10419 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10423template <
typename Derived>
10425 OMPMaskedTaskLoopDirective *D) {
10427 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10428 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10429 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10430 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10434template <
typename Derived>
10436 OMPMasterTaskLoopSimdDirective *D) {
10438 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10439 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10440 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10441 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10445template <
typename Derived>
10447 OMPMaskedTaskLoopSimdDirective *D) {
10449 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10450 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10451 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10452 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10456template <
typename Derived>
10458 OMPParallelMasterTaskLoopDirective *D) {
10460 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10461 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10462 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10463 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10467template <
typename Derived>
10469 OMPParallelMaskedTaskLoopDirective *D) {
10471 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10472 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10473 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10474 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10478template <
typename Derived>
10481 OMPParallelMasterTaskLoopSimdDirective *D) {
10483 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10484 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10485 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10486 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10490template <
typename Derived>
10493 OMPParallelMaskedTaskLoopSimdDirective *D) {
10495 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10496 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10497 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10498 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10502template <
typename Derived>
10504 OMPDistributeDirective *D) {
10506 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10507 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10508 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10509 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10513template <
typename Derived>
10515 OMPDistributeParallelForDirective *D) {
10517 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10518 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10519 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10520 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10524template <
typename Derived>
10527 OMPDistributeParallelForSimdDirective *D) {
10529 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10530 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10531 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10532 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10536template <
typename Derived>
10538 OMPDistributeSimdDirective *D) {
10540 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10541 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10542 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10543 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10547template <
typename Derived>
10549 OMPTargetParallelForSimdDirective *D) {
10551 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10552 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10553 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10554 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10558template <
typename Derived>
10560 OMPTargetSimdDirective *D) {
10562 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10563 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10564 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10565 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10569template <
typename Derived>
10571 OMPTeamsDistributeDirective *D) {
10573 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10574 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10575 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10576 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10580template <
typename Derived>
10582 OMPTeamsDistributeSimdDirective *D) {
10584 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10585 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10586 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10587 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10591template <
typename Derived>
10593 OMPTeamsDistributeParallelForSimdDirective *D) {
10595 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10596 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10598 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10599 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10603template <
typename Derived>
10605 OMPTeamsDistributeParallelForDirective *D) {
10607 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10608 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10609 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10610 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10614template <
typename Derived>
10616 OMPTargetTeamsDirective *D) {
10618 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10619 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10620 auto Res = getDerived().TransformOMPExecutableDirective(D);
10621 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10625template <
typename Derived>
10627 OMPTargetTeamsDistributeDirective *D) {
10629 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10630 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10631 auto Res = getDerived().TransformOMPExecutableDirective(D);
10632 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10636template <
typename Derived>
10639 OMPTargetTeamsDistributeParallelForDirective *D) {
10641 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10642 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10644 auto Res = getDerived().TransformOMPExecutableDirective(D);
10645 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10649template <
typename Derived>
10652 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10654 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10655 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10657 auto Res = getDerived().TransformOMPExecutableDirective(D);
10658 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10662template <
typename Derived>
10665 OMPTargetTeamsDistributeSimdDirective *D) {
10667 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10668 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10669 auto Res = getDerived().TransformOMPExecutableDirective(D);
10670 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10674template <
typename Derived>
10678 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10679 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10680 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10681 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10685template <
typename Derived>
10689 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10690 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10691 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10692 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10696template <
typename Derived>
10700 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10701 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10702 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10703 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10707template <
typename Derived>
10709 OMPGenericLoopDirective *D) {
10711 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10712 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10713 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10714 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10718template <
typename Derived>
10720 OMPTeamsGenericLoopDirective *D) {
10722 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10723 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10724 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10725 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10729template <
typename Derived>
10731 OMPTargetTeamsGenericLoopDirective *D) {
10733 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10734 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10735 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10736 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10740template <
typename Derived>
10742 OMPParallelGenericLoopDirective *D) {
10744 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10745 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10746 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10747 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10751template <
typename Derived>
10754 OMPTargetParallelGenericLoopDirective *D) {
10756 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10757 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10758 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10759 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10766template <
typename Derived>
10769 if (
Cond.isInvalid())
10771 return getDerived().RebuildOMPIfClause(
10772 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10773 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10776template <
typename Derived>
10779 if (
Cond.isInvalid())
10781 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10782 C->getLParenLoc(),
C->getEndLoc());
10785template <
typename Derived>
10788 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10789 if (NumThreads.isInvalid())
10791 return getDerived().RebuildOMPNumThreadsClause(
10792 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10793 C->getModifierLoc(),
C->getEndLoc());
10796template <
typename Derived>
10799 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10802 return getDerived().RebuildOMPSafelenClause(
10803 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10806template <
typename Derived>
10809 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10812 return getDerived().RebuildOMPAllocatorClause(
10813 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10816template <
typename Derived>
10819 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10822 return getDerived().RebuildOMPSimdlenClause(
10823 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10826template <
typename Derived>
10829 TransformedSizes.reserve(
C->getNumSizes());
10831 for (
Expr *E :
C->getSizesRefs()) {
10833 TransformedSizes.push_back(
nullptr);
10837 ExprResult T = getDerived().TransformExpr(E);
10842 TransformedSizes.push_back(T.get());
10845 if (!Changed && !getDerived().AlwaysRebuild())
10847 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10848 C->getLParenLoc(),
C->getEndLoc());
10851template <
typename Derived>
10855 TransformedCounts.reserve(
C->getNumCounts());
10856 for (
Expr *E :
C->getCountsRefs()) {
10858 TransformedCounts.push_back(
nullptr);
10862 ExprResult T = getDerived().TransformExpr(E);
10865 TransformedCounts.push_back(T.get());
10868 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
10869 C->getLParenLoc(),
C->getEndLoc(),
10870 C->getOmpFillIndex(),
C->getOmpFillLoc());
10873template <
typename Derived>
10877 TransformedArgs.reserve(
C->getNumLoops());
10879 for (
Expr *E :
C->getArgsRefs()) {
10881 TransformedArgs.push_back(
nullptr);
10885 ExprResult T = getDerived().TransformExpr(E);
10890 TransformedArgs.push_back(T.get());
10893 if (!Changed && !getDerived().AlwaysRebuild())
10895 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10896 C->getLParenLoc(),
C->getEndLoc());
10899template <
typename Derived>
10901 if (!getDerived().AlwaysRebuild())
10903 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10906template <
typename Derived>
10909 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10912 Expr *Factor = T.get();
10913 bool Changed = Factor !=
C->getFactor();
10915 if (!Changed && !getDerived().AlwaysRebuild())
10917 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10921template <
typename Derived>
10924 ExprResult F = getDerived().TransformExpr(
C->getFirst());
10928 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
10929 if (Cn.isInvalid())
10933 Expr *Count = Cn.get();
10935 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
10938 if (!Changed && !getDerived().AlwaysRebuild())
10941 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
10942 C->getLParenLoc(),
C->getFirstLoc(),
10943 C->getCountLoc(),
C->getEndLoc());
10946template <
typename Derived>
10949 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10952 return getDerived().RebuildOMPCollapseClause(
10953 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10956template <
typename Derived>
10960 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10961 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10965template <
typename Derived>
10972template <
typename Derived>
10975 Expr *Impex =
C->getImpexType();
10976 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
10978 if (TransformedImpex.isInvalid())
10981 return getDerived().RebuildOMPTransparentClause(
10982 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10986template <
typename Derived>
10990 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10991 C->getLParenLoc(),
C->getEndLoc());
10994template <
typename Derived>
10997 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11000 return getDerived().RebuildOMPScheduleClause(
11001 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11002 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11003 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11004 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11007template <
typename Derived>
11011 if (
auto *
Num =
C->getNumForLoops()) {
11012 E = getDerived().TransformExpr(
Num);
11016 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11017 C->getLParenLoc(), E.get());
11020template <
typename Derived>
11024 if (
Expr *Evt =
C->getEventHandler()) {
11025 E = getDerived().TransformExpr(Evt);
11029 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11030 C->getLParenLoc(),
C->getEndLoc());
11033template <
typename Derived>
11039 if (
Cond.isInvalid())
11042 return getDerived().RebuildOMPNowaitClause(
Cond.get(),
C->getBeginLoc(),
11043 C->getLParenLoc(),
C->getEndLoc());
11046template <
typename Derived>
11053template <
typename Derived>
11060template <
typename Derived>
11066template <
typename Derived>
11072template <
typename Derived>
11079template <
typename Derived>
11086template <
typename Derived>
11093template <
typename Derived>
11099template <
typename Derived>
11105template <
typename Derived>
11107 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11110 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11111 C->getLParenLoc(),
C->getEndLoc());
11114template <
typename Derived>
11120template <
typename Derived>
11125template <
typename Derived>
11127 OMPNoOpenMPRoutinesClause *
C) {
11130template <
typename Derived>
11132 OMPNoOpenMPConstructsClause *
C) {
11135template <
typename Derived>
11137 OMPNoParallelismClause *
C) {
11141template <
typename Derived>
11148template <
typename Derived>
11155template <
typename Derived>
11162template <
typename Derived>
11169template <
typename Derived>
11176template <
typename Derived>
11182template <
typename Derived>
11189template <
typename Derived>
11195template <
typename Derived>
11202template <
typename Derived>
11204 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11205 if (IVR.isInvalid())
11209 for (OMPInitClause::PrefView P :
C->prefs()) {
11210 Expr *NewFr =
nullptr;
11212 ExprResult ER = getDerived().TransformExpr(P.Fr);
11213 if (ER.isInvalid())
11218 NewAttrs.reserve(P.Attrs.size());
11219 for (
Expr *A : P.Attrs) {
11220 ExprResult ER = getDerived().TransformExpr(A);
11221 if (ER.isInvalid())
11223 NewAttrs.push_back(ER.get());
11225 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11227 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11228 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11229 C->getBeginLoc(),
C->getLParenLoc(),
11230 C->getVarLoc(),
C->getEndLoc());
11233template <
typename Derived>
11235 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11236 if (ER.isInvalid())
11238 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11239 C->getLParenLoc(),
C->getVarLoc(),
11243template <
typename Derived>
11247 if (
Expr *IV =
C->getInteropVar()) {
11248 ER = getDerived().TransformExpr(IV);
11249 if (ER.isInvalid())
11252 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11253 C->getLParenLoc(),
C->getVarLoc(),
11257template <
typename Derived>
11261 if (
Cond.isInvalid())
11263 return getDerived().RebuildOMPNovariantsClause(
11264 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11267template <
typename Derived>
11271 if (
Cond.isInvalid())
11273 return getDerived().RebuildOMPNocontextClause(
11274 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11277template <
typename Derived>
11280 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11281 if (ThreadID.isInvalid())
11283 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11284 C->getLParenLoc(),
C->getEndLoc());
11287template <
typename Derived>
11289 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11292 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11293 C->getLParenLoc(),
C->getEndLoc());
11296template <
typename Derived>
11298 OMPUnifiedAddressClause *
C) {
11299 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11302template <
typename Derived>
11304 OMPUnifiedSharedMemoryClause *
C) {
11306 "unified_shared_memory clause cannot appear in dependent context");
11309template <
typename Derived>
11311 OMPReverseOffloadClause *
C) {
11312 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11315template <
typename Derived>
11317 OMPDynamicAllocatorsClause *
C) {
11319 "dynamic_allocators clause cannot appear in dependent context");
11322template <
typename Derived>
11324 OMPAtomicDefaultMemOrderClause *
C) {
11326 "atomic_default_mem_order clause cannot appear in dependent context");
11329template <
typename Derived>
11332 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11335template <
typename Derived>
11338 C->getBeginLoc(),
C->getLParenLoc(),
11342template <
typename Derived>
11346 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11347 C->getLParenLoc(),
C->getEndLoc());
11350template <
typename Derived>
11353 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11356 return getDerived().RebuildOMPMessageClause(
11357 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11360template <
typename Derived>
11364 Vars.reserve(
C->varlist_size());
11365 for (
auto *
VE :
C->varlist()) {
11367 if (EVar.isInvalid())
11369 Vars.push_back(EVar.get());
11371 return getDerived().RebuildOMPPrivateClause(
11372 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11375template <
typename Derived>
11377 OMPFirstprivateClause *
C) {
11379 Vars.reserve(
C->varlist_size());
11380 for (
auto *
VE :
C->varlist()) {
11382 if (EVar.isInvalid())
11384 Vars.push_back(EVar.get());
11386 return getDerived().RebuildOMPFirstprivateClause(
11387 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11390template <
typename Derived>
11394 Vars.reserve(
C->varlist_size());
11395 for (
auto *
VE :
C->varlist()) {
11397 if (EVar.isInvalid())
11399 Vars.push_back(EVar.get());
11401 return getDerived().RebuildOMPLastprivateClause(
11402 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11403 C->getLParenLoc(),
C->getEndLoc());
11406template <
typename Derived>
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().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11418 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());
11433 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11436 if (NameInfo.getName()) {
11437 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11438 if (!NameInfo.getName())
11444 for (
auto *E :
C->reduction_ops()) {
11449 for (
auto *D : ULE->decls()) {
11452 Decls.addDecl(InstD, InstD->getAccess());
11456 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11457 true, Decls.begin(), Decls.end(),
11460 UnresolvedReductions.push_back(
nullptr);
11462 return getDerived().RebuildOMPReductionClause(
11463 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11464 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11465 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11468template <
typename Derived>
11470 OMPTaskReductionClause *
C) {
11472 Vars.reserve(
C->varlist_size());
11473 for (
auto *
VE :
C->varlist()) {
11475 if (EVar.isInvalid())
11477 Vars.push_back(EVar.get());
11480 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11483 if (NameInfo.getName()) {
11484 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11485 if (!NameInfo.getName())
11491 for (
auto *E :
C->reduction_ops()) {
11496 for (
auto *D : ULE->decls()) {
11499 Decls.addDecl(InstD, InstD->getAccess());
11503 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11504 true, Decls.begin(), Decls.end(),
11507 UnresolvedReductions.push_back(
nullptr);
11509 return getDerived().RebuildOMPTaskReductionClause(
11510 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11511 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11514template <
typename Derived>
11518 Vars.reserve(
C->varlist_size());
11519 for (
auto *
VE :
C->varlist()) {
11521 if (EVar.isInvalid())
11523 Vars.push_back(EVar.get());
11526 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11529 if (NameInfo.getName()) {
11530 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11531 if (!NameInfo.getName())
11537 for (
auto *E :
C->reduction_ops()) {
11542 for (
auto *D : ULE->decls()) {
11545 Decls.addDecl(InstD, InstD->getAccess());
11549 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11550 true, Decls.begin(), Decls.end(),
11553 UnresolvedReductions.push_back(
nullptr);
11555 return getDerived().RebuildOMPInReductionClause(
11556 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11557 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11560template <
typename Derived>
11564 Vars.reserve(
C->varlist_size());
11565 for (
auto *
VE :
C->varlist()) {
11567 if (EVar.isInvalid())
11569 Vars.push_back(EVar.get());
11571 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11572 if (Step.isInvalid())
11574 return getDerived().RebuildOMPLinearClause(
11575 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11576 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11580template <
typename Derived>
11584 Vars.reserve(
C->varlist_size());
11585 for (
auto *
VE :
C->varlist()) {
11587 if (EVar.isInvalid())
11589 Vars.push_back(EVar.get());
11591 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11592 if (Alignment.isInvalid())
11594 return getDerived().RebuildOMPAlignedClause(
11595 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11596 C->getColonLoc(),
C->getEndLoc());
11599template <
typename Derived>
11603 Vars.reserve(
C->varlist_size());
11604 for (
auto *
VE :
C->varlist()) {
11606 if (EVar.isInvalid())
11608 Vars.push_back(EVar.get());
11610 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11611 C->getLParenLoc(),
C->getEndLoc());
11614template <
typename Derived>
11618 Vars.reserve(
C->varlist_size());
11619 for (
auto *
VE :
C->varlist()) {
11621 if (EVar.isInvalid())
11623 Vars.push_back(EVar.get());
11625 return getDerived().RebuildOMPCopyprivateClause(
11626 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11629template <
typename Derived>
11632 Vars.reserve(
C->varlist_size());
11633 for (
auto *
VE :
C->varlist()) {
11635 if (EVar.isInvalid())
11637 Vars.push_back(EVar.get());
11639 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11640 C->getLParenLoc(),
C->getEndLoc());
11643template <
typename Derived>
11646 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11649 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11650 C->getLParenLoc(),
C->getEndLoc());
11653template <
typename Derived>
11657 Expr *DepModifier =
C->getModifier();
11659 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11660 if (DepModRes.isInvalid())
11662 DepModifier = DepModRes.get();
11664 Vars.reserve(
C->varlist_size());
11665 for (
auto *
VE :
C->varlist()) {
11667 if (EVar.isInvalid())
11669 Vars.push_back(EVar.get());
11671 return getDerived().RebuildOMPDependClause(
11672 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11673 C->getOmpAllMemoryLoc()},
11674 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11677template <
typename Derived>
11680 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11683 return getDerived().RebuildOMPDeviceClause(
11684 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11685 C->getModifierLoc(),
C->getEndLoc());
11688template <
typename Derived,
class T>
11695 Vars.reserve(
C->varlist_size());
11696 for (
auto *
VE :
C->varlist()) {
11700 Vars.push_back(EVar.
get());
11704 if (
C->getMapperQualifierLoc()) {
11705 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11706 C->getMapperQualifierLoc());
11710 MapperIdScopeSpec.
Adopt(QualifierLoc);
11711 MapperIdInfo =
C->getMapperIdInfo();
11712 if (MapperIdInfo.
getName()) {
11713 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11719 for (
auto *E :
C->mapperlists()) {
11724 for (
auto *D : ULE->decls()) {
11727 Decls.addDecl(InstD, InstD->
getAccess());
11732 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11735 UnresolvedMappers.push_back(
nullptr);
11741template <
typename Derived>
11743 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11745 Expr *IteratorModifier =
C->getIteratorModifier();
11746 if (IteratorModifier) {
11747 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11748 if (MapModRes.isInvalid())
11750 IteratorModifier = MapModRes.
get();
11756 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11758 return getDerived().RebuildOMPMapClause(
11759 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11760 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11761 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11764template <
typename Derived>
11767 Expr *Allocator =
C->getAllocator();
11769 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11770 if (AllocatorRes.isInvalid())
11772 Allocator = AllocatorRes.get();
11774 Expr *Alignment =
C->getAlignment();
11776 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11777 if (AlignmentRes.isInvalid())
11779 Alignment = AlignmentRes.get();
11782 Vars.reserve(
C->varlist_size());
11783 for (
auto *
VE :
C->varlist()) {
11785 if (EVar.isInvalid())
11787 Vars.push_back(EVar.get());
11789 return getDerived().RebuildOMPAllocateClause(
11790 Allocator, Alignment,
C->getFirstAllocateModifier(),
11791 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11792 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11793 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11796template <
typename Derived>
11800 Vars.reserve(
C->varlist_size());
11801 for (
auto *
VE :
C->varlist()) {
11803 if (EVar.isInvalid())
11805 Vars.push_back(EVar.get());
11807 Expr *ModifierExpr =
C->getModifierExpr();
11808 if (ModifierExpr) {
11810 if (EVar.isInvalid())
11812 ModifierExpr = EVar.get();
11814 return getDerived().RebuildOMPNumTeamsClause(
11815 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
11816 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11819template <
typename Derived>
11823 Vars.reserve(
C->varlist_size());
11824 for (
auto *
VE :
C->varlist()) {
11826 if (EVar.isInvalid())
11828 Vars.push_back(EVar.get());
11830 return getDerived().RebuildOMPThreadLimitClause(
11831 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11834template <
typename Derived>
11837 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11840 return getDerived().RebuildOMPPriorityClause(
11841 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11844template <
typename Derived>
11847 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11850 return getDerived().RebuildOMPGrainsizeClause(
11851 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11852 C->getModifierLoc(),
C->getEndLoc());
11855template <
typename Derived>
11858 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11861 return getDerived().RebuildOMPNumTasksClause(
11862 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11863 C->getModifierLoc(),
C->getEndLoc());
11866template <
typename Derived>
11868 ExprResult E = getDerived().TransformExpr(
C->getHint());
11871 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11872 C->getLParenLoc(),
C->getEndLoc());
11875template <
typename Derived>
11877 OMPDistScheduleClause *
C) {
11878 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11881 return getDerived().RebuildOMPDistScheduleClause(
11882 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11883 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11886template <
typename Derived>
11892 C->getDefaultmapKind(),
11895 C->getDefaultmapModifierLoc(),
11896 C->getDefaultmapKindLoc(),
11900template <
typename Derived>
11904 Expr *IteratorModifier =
C->getIteratorModifier();
11905 if (IteratorModifier) {
11906 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11907 if (MapModRes.isInvalid())
11909 IteratorModifier = MapModRes.get();
11915 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11917 return getDerived().RebuildOMPToClause(
11918 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11919 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11920 UnresolvedMappers);
11923template <
typename Derived>
11927 Expr *IteratorModifier =
C->getIteratorModifier();
11928 if (IteratorModifier) {
11929 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11930 if (MapModRes.isInvalid())
11932 IteratorModifier = MapModRes.get();
11938 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11940 return getDerived().RebuildOMPFromClause(
11941 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
11942 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
11943 UnresolvedMappers);
11946template <
typename Derived>
11948 OMPUseDevicePtrClause *
C) {
11950 Vars.reserve(
C->varlist_size());
11951 for (
auto *
VE :
C->varlist()) {
11953 if (EVar.isInvalid())
11955 Vars.push_back(EVar.get());
11958 return getDerived().RebuildOMPUseDevicePtrClause(
11959 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
11962template <
typename Derived>
11964 OMPUseDeviceAddrClause *
C) {
11966 Vars.reserve(
C->varlist_size());
11967 for (
auto *
VE :
C->varlist()) {
11969 if (EVar.isInvalid())
11971 Vars.push_back(EVar.get());
11974 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11977template <
typename Derived>
11981 Vars.reserve(
C->varlist_size());
11982 for (
auto *
VE :
C->varlist()) {
11984 if (EVar.isInvalid())
11986 Vars.push_back(EVar.get());
11989 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11992template <
typename Derived>
11994 OMPHasDeviceAddrClause *
C) {
11996 Vars.reserve(
C->varlist_size());
11997 for (
auto *
VE :
C->varlist()) {
11999 if (EVar.isInvalid())
12001 Vars.push_back(EVar.get());
12004 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12007template <
typename Derived>
12011 Vars.reserve(
C->varlist_size());
12012 for (
auto *
VE :
C->varlist()) {
12014 if (EVar.isInvalid())
12016 Vars.push_back(EVar.get());
12018 return getDerived().RebuildOMPNontemporalClause(
12019 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12022template <
typename Derived>
12026 Vars.reserve(
C->varlist_size());
12027 for (
auto *
VE :
C->varlist()) {
12029 if (EVar.isInvalid())
12031 Vars.push_back(EVar.get());
12033 return getDerived().RebuildOMPInclusiveClause(
12034 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12037template <
typename Derived>
12041 Vars.reserve(
C->varlist_size());
12042 for (
auto *
VE :
C->varlist()) {
12044 if (EVar.isInvalid())
12046 Vars.push_back(EVar.get());
12048 return getDerived().RebuildOMPExclusiveClause(
12049 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12052template <
typename Derived>
12054 OMPUsesAllocatorsClause *
C) {
12056 Data.reserve(
C->getNumberOfAllocators());
12057 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12058 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12060 if (Allocator.isInvalid())
12064 AllocatorTraits = getDerived().TransformExpr(AT);
12065 if (AllocatorTraits.isInvalid())
12069 NewD.Allocator = Allocator.get();
12070 NewD.AllocatorTraits = AllocatorTraits.get();
12074 return getDerived().RebuildOMPUsesAllocatorsClause(
12075 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12078template <
typename Derived>
12082 Locators.reserve(
C->varlist_size());
12084 if (
Expr *Modifier =
C->getModifier()) {
12085 ModifierRes = getDerived().TransformExpr(Modifier);
12086 if (ModifierRes.isInvalid())
12089 for (
Expr *E :
C->varlist()) {
12090 ExprResult Locator = getDerived().TransformExpr(E);
12091 if (Locator.isInvalid())
12093 Locators.push_back(Locator.get());
12095 return getDerived().RebuildOMPAffinityClause(
12096 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12097 ModifierRes.get(), Locators);
12100template <
typename Derived>
12103 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12104 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12107template <
typename Derived>
12110 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12111 C->getLParenLoc(),
C->getEndLoc());
12114template <
typename Derived>
12116 OMPXDynCGroupMemClause *
C) {
12118 if (
Size.isInvalid())
12120 return getDerived().RebuildOMPXDynCGroupMemClause(
12121 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12124template <
typename Derived>
12126 OMPDynGroupprivateClause *
C) {
12128 if (
Size.isInvalid())
12130 return getDerived().RebuildOMPDynGroupprivateClause(
12131 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12132 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12133 C->getDynGroupprivateModifierLoc(),
12134 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12137template <
typename Derived>
12141 Vars.reserve(
C->varlist_size());
12142 for (
auto *
VE :
C->varlist()) {
12144 if (EVar.isInvalid())
12146 Vars.push_back(EVar.get());
12148 return getDerived().RebuildOMPDoacrossClause(
12149 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12150 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12153template <
typename Derived>
12157 for (
auto *A :
C->getAttrs())
12158 NewAttrs.push_back(getDerived().TransformAttr(A));
12159 return getDerived().RebuildOMPXAttributeClause(
12160 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12163template <
typename Derived>
12172template <
typename Derived>
12173class OpenACCClauseTransform final
12175 TreeTransform<Derived> &Self;
12176 ArrayRef<const OpenACCClause *> ExistingClauses;
12177 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12178 OpenACCClause *NewClause =
nullptr;
12181 ExprResult Res = Self.TransformExpr(VarRef);
12183 if (!Res.isUsable())
12186 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12187 ParsedClause.getClauseKind(),
12193 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12194 llvm::SmallVector<Expr *> InstantiatedVarList;
12195 for (Expr *CurVar : VarList) {
12198 if (VarRef.isUsable())
12199 InstantiatedVarList.push_back(VarRef.get());
12202 return InstantiatedVarList;
12206 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12207 ArrayRef<const OpenACCClause *> ExistingClauses,
12208 SemaOpenACC::OpenACCParsedClause &PC)
12209 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12211 OpenACCClause *CreatedClause()
const {
return NewClause; }
12213#define VISIT_CLAUSE(CLAUSE_NAME) \
12214 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12215#include "clang/Basic/OpenACCClauses.def"
12218template <
typename Derived>
12219void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12221 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12224 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12225 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12226 ParsedClause.getEndLoc());
12229template <
typename Derived>
12230void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12232 assert(
Cond &&
"If constructed with invalid Condition");
12236 if (Res.isInvalid() || !Res.get().second)
12239 ParsedClause.setConditionDetails(Res.get().second);
12242 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12243 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12244 ParsedClause.getEndLoc());
12247template <
typename Derived>
12248void OpenACCClauseTransform<Derived>::VisitSelfClause(
12254 for (
Expr *CurVar :
C.getVarList()) {
12257 if (!Res.isUsable())
12260 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12261 ParsedClause.getClauseKind(),
12264 if (Res.isUsable())
12265 InstantiatedVarList.push_back(Res.get());
12268 ParsedClause.setVarListDetails(InstantiatedVarList,
12272 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12273 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12274 ParsedClause.getEndLoc());
12277 if (
C.hasConditionExpr()) {
12280 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
12283 if (Res.isInvalid() || !Res.get().second)
12286 ParsedClause.setConditionDetails(Res.get().second);
12290 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12291 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12292 ParsedClause.getEndLoc());
12296template <
typename Derived>
12297void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12301 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12304 if (!Res.isUsable())
12309 C.getBeginLoc(), Res.get());
12310 if (!Res.isUsable())
12313 InstantiatedIntExprs.push_back(Res.get());
12316 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12318 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12319 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12320 ParsedClause.getEndLoc());
12323template <
typename Derived>
12324void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12329 for (
const auto [RefExpr, InitRecipe] :
12330 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12333 if (VarRef.isUsable()) {
12334 InstantiatedVarList.push_back(VarRef.get());
12338 if (InitRecipe.isSet())
12339 InitRecipes.push_back(InitRecipe);
12341 InitRecipes.push_back(
12342 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12345 ParsedClause.setVarListDetails(InstantiatedVarList,
12349 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12350 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12351 ParsedClause.getEndLoc());
12354template <
typename Derived>
12355void OpenACCClauseTransform<Derived>::VisitHostClause(
12357 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12361 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12362 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12363 ParsedClause.getEndLoc());
12366template <
typename Derived>
12367void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12369 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12373 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12374 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12375 ParsedClause.getEndLoc());
12378template <
typename Derived>
12379void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12384 for (
const auto [RefExpr, InitRecipe] :
12385 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12388 if (VarRef.isUsable()) {
12389 InstantiatedVarList.push_back(VarRef.get());
12393 if (InitRecipe.isSet())
12394 InitRecipes.push_back(InitRecipe);
12396 InitRecipes.push_back(
12397 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12401 ParsedClause.setVarListDetails(InstantiatedVarList,
12405 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12406 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12407 ParsedClause.getEndLoc());
12410template <
typename Derived>
12411void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12413 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12417 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12418 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12419 ParsedClause.getEndLoc());
12422template <
typename Derived>
12423void OpenACCClauseTransform<Derived>::VisitPresentClause(
12425 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12429 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12430 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12431 ParsedClause.getEndLoc());
12434template <
typename Derived>
12435void OpenACCClauseTransform<Derived>::VisitCopyClause(
12437 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12438 C.getModifierList());
12441 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12442 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12443 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12444 ParsedClause.getEndLoc());
12447template <
typename Derived>
12448void OpenACCClauseTransform<Derived>::VisitLinkClause(
12450 llvm_unreachable(
"link clause not valid unless a decl transform");
12453template <
typename Derived>
12454void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12456 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12458template <
typename Derived>
12459void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12461 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12463template <
typename Derived>
12464void OpenACCClauseTransform<Derived>::VisitBindClause(
12466 llvm_unreachable(
"bind clause not valid unless a decl transform");
12469template <
typename Derived>
12470void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12472 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12473 C.getModifierList());
12476 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12477 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12478 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12479 ParsedClause.getEndLoc());
12482template <
typename Derived>
12483void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12485 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12486 C.getModifierList());
12489 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12490 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12491 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12492 ParsedClause.getEndLoc());
12495template <
typename Derived>
12496void OpenACCClauseTransform<Derived>::VisitCreateClause(
12498 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12499 C.getModifierList());
12502 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12503 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12504 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12505 ParsedClause.getEndLoc());
12507template <
typename Derived>
12508void OpenACCClauseTransform<Derived>::VisitAttachClause(
12513 llvm::erase_if(VarList, [&](
Expr *E) {
12514 return Self.getSema().OpenACC().CheckVarIsPointerType(
12520 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12521 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12522 ParsedClause.getEndLoc());
12525template <
typename Derived>
12526void OpenACCClauseTransform<Derived>::VisitDetachClause(
12531 llvm::erase_if(VarList, [&](
Expr *E) {
12532 return Self.getSema().OpenACC().CheckVarIsPointerType(
12538 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12539 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12540 ParsedClause.getEndLoc());
12543template <
typename Derived>
12544void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12546 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12549 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12550 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12551 ParsedClause.getEndLoc());
12554template <
typename Derived>
12555void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12557 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12560 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12561 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12562 ParsedClause.getEndLoc());
12565template <
typename Derived>
12566void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
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>::VisitNumWorkersClause(
12586 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12587 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12590 if (!Res.isUsable())
12595 C.getBeginLoc(), Res.get());
12596 if (!Res.isUsable())
12599 ParsedClause.setIntExprDetails(Res.get());
12601 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12602 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12603 ParsedClause.getEndLoc());
12606template <
typename Derived>
12607void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12609 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12610 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12613 if (!Res.isUsable())
12618 C.getBeginLoc(), Res.get());
12619 if (!Res.isUsable())
12622 ParsedClause.setIntExprDetails(Res.get());
12624 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12625 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12626 ParsedClause.getEndLoc());
12629template <
typename Derived>
12630void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12632 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12633 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12636 if (!Res.isUsable())
12641 C.getBeginLoc(), Res.get());
12642 if (!Res.isUsable())
12645 ParsedClause.setIntExprDetails(Res.get());
12647 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12648 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12649 ParsedClause.getEndLoc());
12652template <
typename Derived>
12653void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12655 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12656 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12659 if (!Res.isUsable())
12664 C.getBeginLoc(), Res.get());
12665 if (!Res.isUsable())
12668 ParsedClause.setIntExprDetails(Res.get());
12670 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12671 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12672 ParsedClause.getEndLoc());
12675template <
typename Derived>
12676void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12678 if (
C.hasIntExpr()) {
12680 if (!Res.isUsable())
12685 C.getBeginLoc(), Res.get());
12686 if (!Res.isUsable())
12688 ParsedClause.setIntExprDetails(Res.get());
12692 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12693 ParsedClause.getLParenLoc(),
12694 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12696 ParsedClause.getEndLoc());
12699template <
typename Derived>
12700void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12702 if (
C.hasIntExpr()) {
12707 if (!Res.isUsable())
12712 C.getBeginLoc(), Res.get());
12713 if (!Res.isUsable())
12715 ParsedClause.setIntExprDetails(Res.get());
12719 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12720 ParsedClause.getLParenLoc(),
12721 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12723 ParsedClause.getEndLoc());
12726template <
typename Derived>
12727void OpenACCClauseTransform<Derived>::VisitVectorClause(
12729 if (
C.hasIntExpr()) {
12734 if (!Res.isUsable())
12739 C.getBeginLoc(), Res.get());
12740 if (!Res.isUsable())
12742 ParsedClause.setIntExprDetails(Res.get());
12746 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12747 ParsedClause.getLParenLoc(),
12748 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12750 ParsedClause.getEndLoc());
12753template <
typename Derived>
12754void OpenACCClauseTransform<Derived>::VisitWaitClause(
12756 if (
C.hasExprs()) {
12757 Expr *DevNumExpr =
nullptr;
12761 if (
C.getDevNumExpr()) {
12763 if (!Res.isUsable())
12767 C.getBeginLoc(), Res.get());
12768 if (!Res.isUsable())
12771 DevNumExpr = Res.get();
12775 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12777 if (!Res.isUsable())
12781 C.getBeginLoc(), Res.get());
12782 if (!Res.isUsable())
12785 InstantiatedQueueIdExprs.push_back(Res.get());
12788 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12789 std::move(InstantiatedQueueIdExprs));
12793 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12794 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12795 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12796 ParsedClause.getEndLoc());
12799template <
typename Derived>
12800void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12804 Self.getSema().getASTContext(),
C.getClauseKind(),
12805 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12806 C.getArchitectures(), ParsedClause.getEndLoc());
12809template <
typename Derived>
12810void OpenACCClauseTransform<Derived>::VisitAutoClause(
12814 ParsedClause.getBeginLoc(),
12815 ParsedClause.getEndLoc());
12818template <
typename Derived>
12819void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12822 ParsedClause.getBeginLoc(),
12823 ParsedClause.getEndLoc());
12826template <
typename Derived>
12827void OpenACCClauseTransform<Derived>::VisitSeqClause(
12830 ParsedClause.getBeginLoc(),
12831 ParsedClause.getEndLoc());
12833template <
typename Derived>
12834void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12837 ParsedClause.getBeginLoc(),
12838 ParsedClause.getEndLoc());
12841template <
typename Derived>
12842void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12845 ParsedClause.getBeginLoc(),
12846 ParsedClause.getEndLoc());
12849template <
typename Derived>
12850void OpenACCClauseTransform<Derived>::VisitReductionClause(
12856 for (
const auto [Var, OrigRecipe] :
12857 llvm::zip(TransformedVars,
C.getRecipes())) {
12859 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12860 if (Res.isUsable()) {
12861 ValidVars.push_back(Res.get());
12863 if (OrigRecipe.isSet())
12864 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
12866 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12867 C.getReductionOp(), Res.get()));
12871 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12872 ExistingClauses, ParsedClause.getDirectiveKind(),
12873 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12874 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12877template <
typename Derived>
12878void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12880 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12881 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12885 if (!NewLoopCount.isUsable())
12888 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12890 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12894 if (!NewLoopCount.isUsable())
12898 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12902 if (!NewLoopCount.isUsable())
12905 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12907 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12908 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12909 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12912template <
typename Derived>
12913void OpenACCClauseTransform<Derived>::VisitTileClause(
12918 for (
Expr *E :
C.getSizeExprs()) {
12921 if (!NewSizeExpr.isUsable())
12924 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12926 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12930 if (!NewSizeExpr.isUsable())
12933 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12935 if (!NewSizeExpr.isUsable())
12937 TransformedExprs.push_back(NewSizeExpr.get());
12940 ParsedClause.setIntExprDetails(TransformedExprs);
12942 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12943 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12944 ParsedClause.getEndLoc());
12946template <
typename Derived>
12947void OpenACCClauseTransform<Derived>::VisitGangClause(
12952 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12954 if (!ER.isUsable())
12957 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12958 ParsedClause.getDirectiveKind(),
12959 C.getExpr(I).first, ER.get());
12960 if (!ER.isUsable())
12962 TransformedGangKinds.push_back(
C.getExpr(I).first);
12963 TransformedIntExprs.push_back(ER.get());
12966 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12967 ParsedClause.getDirectiveKind(), ExistingClauses,
12968 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12969 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12972template <
typename Derived>
12973OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12978 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12979 ParsedClause.setEndLoc(OldClause->getEndLoc());
12981 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12982 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12984 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12986 Transform.Visit(OldClause);
12988 return Transform.CreatedClause();
12991template <
typename Derived>
12993TreeTransform<Derived>::TransformOpenACCClauseList(
12996 for (
const auto *Clause : OldClauses) {
12997 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12998 TransformedClauses, DirKind, Clause))
12999 TransformedClauses.push_back(TransformedClause);
13001 return TransformedClauses;
13004template <
typename Derived>
13007 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13010 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13013 if (getSema().OpenACC().ActOnStartStmtDirective(
13014 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13019 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13020 C->clauses(), TransformedClauses);
13021 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13022 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13023 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13025 return getDerived().RebuildOpenACCComputeConstruct(
13026 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13027 C->getEndLoc(), TransformedClauses, StrBlock);
13030template <
typename Derived>
13034 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13037 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13040 if (getSema().OpenACC().ActOnStartStmtDirective(
13041 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13046 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13047 C->clauses(), TransformedClauses);
13049 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13050 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13052 return getDerived().RebuildOpenACCLoopConstruct(
13053 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13054 TransformedClauses,
Loop);
13057template <
typename Derived>
13059 OpenACCCombinedConstruct *
C) {
13060 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13063 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13066 if (getSema().OpenACC().ActOnStartStmtDirective(
13067 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13072 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13073 C->clauses(), TransformedClauses);
13075 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13076 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13078 return getDerived().RebuildOpenACCCombinedConstruct(
13079 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13080 C->getEndLoc(), TransformedClauses,
Loop);
13083template <
typename Derived>
13086 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13089 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13091 if (getSema().OpenACC().ActOnStartStmtDirective(
13092 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13096 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13097 C->clauses(), TransformedClauses);
13098 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13099 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13100 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13102 return getDerived().RebuildOpenACCDataConstruct(
13103 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13104 TransformedClauses, StrBlock);
13107template <
typename Derived>
13109 OpenACCEnterDataConstruct *
C) {
13110 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13113 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13115 if (getSema().OpenACC().ActOnStartStmtDirective(
13116 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13119 return getDerived().RebuildOpenACCEnterDataConstruct(
13120 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13121 TransformedClauses);
13124template <
typename Derived>
13126 OpenACCExitDataConstruct *
C) {
13127 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13130 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13132 if (getSema().OpenACC().ActOnStartStmtDirective(
13133 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13136 return getDerived().RebuildOpenACCExitDataConstruct(
13137 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13138 TransformedClauses);
13141template <
typename Derived>
13143 OpenACCHostDataConstruct *
C) {
13144 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13147 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13149 if (getSema().OpenACC().ActOnStartStmtDirective(
13150 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13154 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13155 C->clauses(), TransformedClauses);
13156 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13157 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13158 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13160 return getDerived().RebuildOpenACCHostDataConstruct(
13161 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13162 TransformedClauses, StrBlock);
13165template <
typename Derived>
13168 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13171 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13173 if (getSema().OpenACC().ActOnStartStmtDirective(
13174 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13177 return getDerived().RebuildOpenACCInitConstruct(
13178 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13179 TransformedClauses);
13182template <
typename Derived>
13184 OpenACCShutdownConstruct *
C) {
13185 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13188 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13190 if (getSema().OpenACC().ActOnStartStmtDirective(
13191 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13194 return getDerived().RebuildOpenACCShutdownConstruct(
13195 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13196 TransformedClauses);
13198template <
typename Derived>
13201 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13204 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13206 if (getSema().OpenACC().ActOnStartStmtDirective(
13207 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13210 return getDerived().RebuildOpenACCSetConstruct(
13211 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13212 TransformedClauses);
13215template <
typename Derived>
13217 OpenACCUpdateConstruct *
C) {
13218 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13221 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13223 if (getSema().OpenACC().ActOnStartStmtDirective(
13224 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13227 return getDerived().RebuildOpenACCUpdateConstruct(
13228 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13229 TransformedClauses);
13232template <
typename Derived>
13235 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13238 if (
C->hasDevNumExpr()) {
13239 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13241 if (DevNumExpr.isUsable())
13242 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13244 C->getBeginLoc(), DevNumExpr.get());
13249 for (
Expr *QE :
C->getQueueIdExprs()) {
13250 assert(QE &&
"Null queue id expr?");
13251 ExprResult NewEQ = getDerived().TransformExpr(QE);
13253 if (!NewEQ.isUsable())
13257 C->getBeginLoc(), NewEQ.get());
13258 if (NewEQ.isUsable())
13259 QueueIdExprs.push_back(NewEQ.get());
13263 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13266 if (getSema().OpenACC().ActOnStartStmtDirective(
13267 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13270 return getDerived().RebuildOpenACCWaitConstruct(
13271 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13272 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13273 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13275template <
typename Derived>
13277 OpenACCCacheConstruct *
C) {
13278 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13281 for (
Expr *Var :
C->getVarList()) {
13282 assert(Var &&
"Null var listexpr?");
13284 ExprResult NewVar = getDerived().TransformExpr(Var);
13286 if (!NewVar.isUsable())
13289 NewVar = getSema().OpenACC().ActOnVar(
13291 if (!NewVar.isUsable())
13294 TransformedVarList.push_back(NewVar.get());
13297 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13298 C->getBeginLoc(), {}))
13301 return getDerived().RebuildOpenACCCacheConstruct(
13302 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13303 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13307template <
typename Derived>
13309 OpenACCAtomicConstruct *
C) {
13310 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13313 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13316 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13317 C->getBeginLoc(), {}))
13322 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13324 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13325 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13326 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13329 return getDerived().RebuildOpenACCAtomicConstruct(
13330 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13331 C->getEndLoc(), TransformedClauses, AssocStmt);
13334template <
typename Derived>
13337 if (getDerived().AlwaysRebuild())
13346template<
typename Derived>
13349 return TransformExpr(E->getSubExpr());
13352template <
typename Derived>
13355 if (!E->isTypeDependent())
13358 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13363 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13366 return getDerived().RebuildSYCLUniqueStableNameExpr(
13367 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13370template <
typename Derived>
13374 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13375 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13378 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13379 if (IdExpr.isInvalid())
13382 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13383 if (Body.isInvalid())
13389 if (SR.isInvalid())
13395template <
typename Derived>
13398 assert(
false &&
"not implemented yet");
13402template<
typename Derived>
13405 if (!E->isTypeDependent())
13409 E->getIdentKind());
13412template<
typename Derived>
13416 if (E->getQualifierLoc()) {
13418 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13424 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13426 if (!ND || ND->isInvalidDecl())
13430 if (E->getFoundDecl() != E->getDecl()) {
13431 Found = cast_or_null<NamedDecl>(
13432 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13438 if (NameInfo.getName()) {
13439 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13440 if (!NameInfo.getName())
13444 if (!getDerived().AlwaysRebuild() &&
13445 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13446 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13447 Found == E->getFoundDecl() &&
13448 NameInfo.getName() == E->getDecl()->getDeclName() &&
13449 !E->hasExplicitTemplateArgs()) {
13459 if (E->hasExplicitTemplateArgs()) {
13460 TemplateArgs = &TransArgs;
13461 TransArgs.setLAngleLoc(E->getLAngleLoc());
13462 TransArgs.setRAngleLoc(E->getRAngleLoc());
13463 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13464 E->getNumTemplateArgs(),
13469 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13470 Found, TemplateArgs);
13473template<
typename Derived>
13479template <
typename Derived>
13485template<
typename Derived>
13491template<
typename Derived>
13497template<
typename Derived>
13503template<
typename Derived>
13509template<
typename Derived>
13512 return getDerived().TransformCallExpr(E);
13515template<
typename Derived>
13520 if (E->isExprPredicate())
13521 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13523 ControllingType = getDerived().TransformType(E->getControllingType());
13525 if (ControllingExpr.isInvalid() && !ControllingType)
13536 AssocTypes.push_back(AssocType);
13538 AssocTypes.push_back(
nullptr);
13542 getDerived().TransformExpr(Assoc.getAssociationExpr());
13543 if (AssocExpr.isInvalid())
13545 AssocExprs.push_back(AssocExpr.get());
13548 if (!ControllingType)
13549 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13550 E->getDefaultLoc(),
13552 ControllingExpr.get(),
13555 return getDerived().RebuildGenericSelectionExpr(
13556 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13557 ControllingType, AssocTypes, AssocExprs);
13560template<
typename Derived>
13563 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13564 if (SubExpr.isInvalid())
13567 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13570 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13577template<
typename Derived>
13581 return getDerived().TransformDependentScopeDeclRefExpr(
13582 DRE,
true,
nullptr);
13584 return getDerived().TransformUnresolvedLookupExpr(
13590template<
typename Derived>
13595 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13601 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13609template<
typename Derived>
13611TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13613 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13623 bool ExprChanged =
false;
13625 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13626 const OffsetOfNode &ON = E->getComponent(I);
13627 switch (ON.getKind()) {
13629 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13630 ExprResult Index = getDerived().TransformExpr(FromIndex);
13631 if (Index.isInvalid())
13634 ExprChanged = ExprChanged || Index.get() != FromIndex;
13637 AD.setRBracketLoc(ON.getEndLoc());
13638 Desig.AddDesignator(AD);
13650 Desig.AddDesignator(
13662 if (!getDerived().AlwaysRebuild() &&
13663 Type == E->getTypeSourceInfo() &&
13668 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13669 E->getRParenLoc());
13672template<
typename Derived>
13675 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13676 "opaque value expression requires transformation");
13680template <
typename Derived>
13684 for (
Expr *
C : E->subExpressions()) {
13686 if (NewC.isInvalid())
13692 if (!getDerived().AlwaysRebuild() && !Changed)
13694 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13698template<
typename Derived>
13708 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13709 if (result.isInvalid())
return ExprError();
13714 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13720template<
typename Derived>
13724 if (E->isArgumentType()) {
13731 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13734 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13736 E->getSourceRange());
13750 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13752 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13753 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13754 PE, DRE,
false, &RecoveryTSI);
13756 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13759 return getDerived().RebuildUnaryExprOrTypeTrait(
13760 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13761 }
else if (SubExpr.isInvalid())
13764 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13767 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13768 E->getOperatorLoc(),
13770 E->getSourceRange());
13773template<
typename Derived>
13776 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13777 if (LHS.isInvalid())
13780 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13781 if (RHS.isInvalid())
13785 if (!getDerived().AlwaysRebuild() &&
13786 LHS.get() == E->getLHS() &&
13787 RHS.get() == E->getRHS())
13790 return getDerived().RebuildArraySubscriptExpr(
13792 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13795template <
typename Derived>
13799 if (
Base.isInvalid())
13802 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13803 if (RowIdx.isInvalid())
13806 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13807 RowIdx.get() == E->getRowIdx())
13810 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
13811 E->getRBracketLoc());
13814template <
typename Derived>
13818 if (
Base.isInvalid())
13821 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13822 if (RowIdx.isInvalid())
13825 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13826 if (ColumnIdx.isInvalid())
13829 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13830 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13833 return getDerived().RebuildMatrixSubscriptExpr(
13834 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13837template <
typename Derived>
13841 if (
Base.isInvalid())
13845 if (E->getLowerBound()) {
13846 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13847 if (LowerBound.isInvalid())
13852 if (E->getLength()) {
13853 Length = getDerived().TransformExpr(E->getLength());
13854 if (Length.isInvalid())
13859 if (E->isOMPArraySection()) {
13860 if (
Expr *Str = E->getStride()) {
13861 Stride = getDerived().TransformExpr(Str);
13862 if (Stride.isInvalid())
13867 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13868 LowerBound.get() == E->getLowerBound() &&
13869 Length.get() == E->getLength() &&
13870 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13873 return getDerived().RebuildArraySectionExpr(
13874 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13875 LowerBound.get(), E->getColonLocFirst(),
13876 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13877 Length.get(), Stride.get(), E->getRBracketLoc());
13880template <
typename Derived>
13884 if (
Base.isInvalid())
13888 bool ErrorFound =
false;
13889 for (
Expr *
Dim : E->getDimensions()) {
13891 if (DimRes.isInvalid()) {
13895 Dims.push_back(DimRes.get());
13900 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13901 E->getRParenLoc(), Dims,
13902 E->getBracketsRanges());
13905template <
typename Derived>
13908 unsigned NumIterators = E->numOfIterators();
13911 bool ErrorFound =
false;
13912 bool NeedToRebuild = getDerived().AlwaysRebuild();
13913 for (
unsigned I = 0; I < NumIterators; ++I) {
13915 Data[I].DeclIdent = D->getIdentifier();
13916 Data[I].DeclIdentLoc = D->getLocation();
13917 if (D->getLocation() == D->getBeginLoc()) {
13919 "Implicit type must be int.");
13921 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13929 ErrorFound = ErrorFound ||
13930 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13931 !
Data[I].Type.get().isNull())) ||
13932 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13935 Data[I].Range.Begin = Begin.get();
13936 Data[I].Range.End = End.get();
13937 Data[I].Range.Step = Step.get();
13938 Data[I].AssignLoc = E->getAssignLoc(I);
13939 Data[I].ColonLoc = E->getColonLoc(I);
13940 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13943 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13944 D->getType().getTypePtrOrNull()) ||
13950 if (!NeedToRebuild)
13953 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13954 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13955 if (!Res.isUsable())
13958 for (
unsigned I = 0; I < NumIterators; ++I)
13959 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13960 IE->getIteratorDecl(I));
13964template<
typename Derived>
13973 bool ArgChanged =
false;
13975 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13979 if (!getDerived().AlwaysRebuild() &&
13980 Callee.get() == E->getCallee() &&
13986 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13989 if (E->hasStoredFPFeatures()) {
13991 getSema().CurFPFeatures =
13993 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13996 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13998 E->getRParenLoc());
14001template<
typename Derived>
14005 if (
Base.isInvalid())
14009 if (E->hasQualifier()) {
14011 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14019 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14020 E->getMemberDecl()));
14024 NamedDecl *FoundDecl = E->getFoundDecl();
14025 if (FoundDecl == E->getMemberDecl()) {
14028 FoundDecl = cast_or_null<NamedDecl>(
14029 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14034 if (!getDerived().AlwaysRebuild() &&
14035 Base.get() == E->getBase() &&
14036 QualifierLoc == E->getQualifierLoc() &&
14037 Member == E->getMemberDecl() &&
14038 FoundDecl == E->getFoundDecl() &&
14039 !E->hasExplicitTemplateArgs()) {
14044 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14054 if (E->hasExplicitTemplateArgs()) {
14055 TransArgs.setLAngleLoc(E->getLAngleLoc());
14056 TransArgs.setRAngleLoc(E->getRAngleLoc());
14057 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14058 E->getNumTemplateArgs(),
14071 NamedDecl *FirstQualifierInScope =
nullptr;
14073 if (MemberNameInfo.getName()) {
14074 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14075 if (!MemberNameInfo.getName())
14079 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14086 (E->hasExplicitTemplateArgs()
14087 ? &TransArgs :
nullptr),
14088 FirstQualifierInScope);
14091template<
typename Derived>
14094 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14095 if (LHS.isInvalid())
14099 getDerived().TransformInitializer(E->getRHS(),
false);
14100 if (RHS.isInvalid())
14103 if (!getDerived().AlwaysRebuild() &&
14104 LHS.get() == E->getLHS() &&
14105 RHS.get() == E->getRHS())
14108 if (E->isCompoundAssignmentOp())
14110 return getDerived().RebuildBinaryOperator(
14111 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14114 getSema().CurFPFeatures =
14115 NewOverrides.applyOverrides(getSema().getLangOpts());
14116 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14117 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14118 LHS.get(), RHS.get());
14121template <
typename Derived>
14126 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14127 if (LHS.isInvalid())
14130 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14131 if (RHS.isInvalid())
14137 bool ChangedAnyLookups =
false;
14138 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14139 const_cast<Expr *
>(Decomp.InnerBinOp)};
14140 for (
Expr *PossibleBinOp : PossibleBinOps) {
14141 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14144 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14150 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14151 E->getOperatorLoc(),
Callee->getFoundDecl()));
14155 ChangedAnyLookups =
true;
14156 UnqualLookups.addDecl(
Found);
14159 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14160 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14166 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14171 return getDerived().RebuildCXXRewrittenBinaryOperator(
14172 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14175template<
typename Derived>
14181 getSema().CurFPFeatures =
14182 NewOverrides.applyOverrides(getSema().getLangOpts());
14183 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14184 return getDerived().TransformBinaryOperator(E);
14187template<
typename Derived>
14193 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14194 if (commonExpr.isInvalid())
14197 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14198 if (rhs.isInvalid())
14201 if (!getDerived().AlwaysRebuild() &&
14202 commonExpr.get() == e->getCommon() &&
14203 rhs.get() == e->getFalseExpr())
14206 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14207 e->getQuestionLoc(),
14213template<
typename Derived>
14217 if (
Cond.isInvalid())
14220 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14221 if (LHS.isInvalid())
14224 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14225 if (RHS.isInvalid())
14228 if (!getDerived().AlwaysRebuild() &&
14229 Cond.get() == E->getCond() &&
14230 LHS.get() == E->getLHS() &&
14231 RHS.get() == E->getRHS())
14234 return getDerived().RebuildConditionalOperator(
Cond.get(),
14235 E->getQuestionLoc(),
14241template<
typename Derived>
14246 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14249template<
typename Derived>
14257 = getDerived().TransformExpr(E->getSubExprAsWritten());
14258 if (SubExpr.isInvalid())
14261 if (!getDerived().AlwaysRebuild() &&
14262 Type == E->getTypeInfoAsWritten() &&
14263 SubExpr.get() == E->getSubExpr())
14266 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14272template<
typename Derived>
14280 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14281 if (
Init.isInvalid())
14284 if (!getDerived().AlwaysRebuild() &&
14286 Init.get() == E->getInitializer())
14293 return getDerived().RebuildCompoundLiteralExpr(
14294 E->getLParenLoc(), NewT,
14295 E->getInitializer()->getEndLoc(),
Init.get());
14298template<
typename Derived>
14302 if (
Base.isInvalid())
14305 if (!getDerived().AlwaysRebuild() &&
14306 Base.get() == E->getBase())
14312 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14313 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14317template <
typename Derived>
14321 if (
Base.isInvalid())
14324 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14330 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14331 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14335template<
typename Derived>
14341 bool InitChanged =
false;
14347 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14348 Inits, &InitChanged))
14351 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14358 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14359 E->getRBraceLoc(), E->isExplicit());
14362template<
typename Derived>
14369 if (
Init.isInvalid())
14374 bool ExprChanged =
false;
14376 if (D.isFieldDesignator()) {
14377 if (D.getFieldDecl()) {
14379 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14380 if (Field != D.getFieldDecl())
14383 ExprChanged =
true;
14384 if (
Field->isAnonymousStructOrUnion())
14390 ExprChanged =
true;
14393 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14397 if (D.isArrayDesignator()) {
14398 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14399 if (Index.isInvalid())
14402 Desig.AddDesignator(
14405 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14406 ArrayExprs.push_back(Index.get());
14410 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14412 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14413 if (Start.isInvalid())
14416 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14417 if (End.isInvalid())
14421 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14423 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14424 End.get() != E->getArrayRangeEnd(D);
14426 ArrayExprs.push_back(Start.get());
14427 ArrayExprs.push_back(End.get());
14430 if (!getDerived().AlwaysRebuild() &&
14431 Init.get() == E->getInit() &&
14435 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14436 E->getEqualOrColonLoc(),
14437 E->usesGNUSyntax(),
Init.get());
14442template<
typename Derived>
14446 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14451template<
typename Derived>
14455 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14459template<
typename Derived>
14462 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14466template<
typename Derived>
14469 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14473template<
typename Derived>
14481 QualType T = getDerived().TransformType(E->getType());
14485 if (!getDerived().AlwaysRebuild() &&
14489 return getDerived().RebuildImplicitValueInitExpr(T);
14492template<
typename Derived>
14495 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14499 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14500 if (SubExpr.isInvalid())
14503 if (!getDerived().AlwaysRebuild() &&
14504 TInfo == E->getWrittenTypeInfo() &&
14505 SubExpr.get() == E->getSubExpr())
14508 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14509 TInfo, E->getRParenLoc());
14512template<
typename Derived>
14515 bool ArgumentChanged =
false;
14517 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14521 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14523 E->getRParenLoc());
14531template<
typename Derived>
14534 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14539 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14543template<
typename Derived>
14548 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14549 if (SubStmt.isInvalid()) {
14554 unsigned OldDepth = E->getTemplateDepth();
14555 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14557 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14558 SubStmt.get() == E->getSubStmt()) {
14564 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14565 E->getRParenLoc(), NewDepth);
14568template<
typename Derived>
14572 if (
Cond.isInvalid())
14575 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14576 if (LHS.isInvalid())
14579 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14580 if (RHS.isInvalid())
14583 if (!getDerived().AlwaysRebuild() &&
14584 Cond.get() == E->getCond() &&
14585 LHS.get() == E->getLHS() &&
14586 RHS.get() == E->getRHS())
14589 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14590 Cond.get(), LHS.get(), RHS.get(),
14591 E->getRParenLoc());
14594template<
typename Derived>
14600template<
typename Derived>
14603 switch (E->getOperator()) {
14607 case OO_Array_Delete:
14608 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14613 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14626 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14627 FakeLParenLoc = EndLoc;
14631 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14635 if (E->getOperator() == OO_Subscript)
14636 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14637 Args, E->getEndLoc());
14639 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14643#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14647#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14648#include "clang/Basic/OperatorKinds.def"
14650 case OO_Conditional:
14651 llvm_unreachable(
"conditional operator is not actually overloadable");
14655 llvm_unreachable(
"not an overloaded operator?");
14659 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14660 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14662 First = getDerived().TransformExpr(E->getArg(0));
14663 if (
First.isInvalid())
14667 if (E->getNumArgs() == 2) {
14669 getDerived().TransformInitializer(E->getArg(1),
false);
14670 if (Second.isInvalid())
14676 getSema().CurFPFeatures =
14677 NewOverrides.applyOverrides(getSema().getLangOpts());
14678 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14684 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14687 return getDerived().RebuildCXXOperatorCallExpr(
14688 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14689 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14694 Callee = ICE->getSubExprAsWritten();
14696 ValueDecl *VD = cast_or_null<ValueDecl>(
14697 getDerived().TransformDecl(DR->getLocation(), DR));
14702 Functions.addDecl(VD);
14704 return getDerived().RebuildCXXOperatorCallExpr(
14705 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14706 false, Functions,
First.get(), Second.get());
14709template<
typename Derived>
14712 return getDerived().TransformCallExpr(E);
14715template <
typename Derived>
14718 getSema().CurContext != E->getParentContext();
14720 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14723 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14724 E->getBeginLoc(), E->getEndLoc(),
14725 getSema().CurContext);
14728template <
typename Derived>
14733template<
typename Derived>
14742 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14743 if (EC.isInvalid())
14747 bool ArgChanged =
false;
14749 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14753 if (!getDerived().AlwaysRebuild() &&
14754 Callee.get() == E->getCallee() &&
14760 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14761 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14763 E->getRParenLoc(), EC.get());
14766template<
typename Derived>
14782 return getDerived().RebuildCXXNamedCastExpr(
14789template<
typename Derived>
14798 if (Sub.isInvalid())
14801 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14805template<
typename Derived>
14807TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14808 return getDerived().TransformCXXNamedCastExpr(E);
14811template<
typename Derived>
14817template<
typename Derived>
14824template<
typename Derived>
14830template<
typename Derived>
14836template<
typename Derived>
14841 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14846 = getDerived().TransformExpr(E->getSubExprAsWritten());
14847 if (SubExpr.isInvalid())
14850 if (!getDerived().AlwaysRebuild() &&
14851 Type == E->getTypeInfoAsWritten() &&
14852 SubExpr.get() == E->getSubExpr())
14855 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14859 E->isListInitialization());
14862template<
typename Derived>
14865 if (E->isTypeOperand()) {
14867 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14871 if (!getDerived().AlwaysRebuild() &&
14872 TInfo == E->getTypeOperandSourceInfo())
14875 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14876 TInfo, E->getEndLoc());
14882 Expr *Op = E->getExprOperand();
14884 if (E->isGLValue()) {
14886 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
14888 diag::err_incomplete_typeid))
14891 if (RD->isPolymorphic())
14899 ExprResult SubExpr = getDerived().TransformExpr(Op);
14900 if (SubExpr.isInvalid())
14903 if (!getDerived().AlwaysRebuild() &&
14904 SubExpr.get() == E->getExprOperand())
14907 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14908 SubExpr.get(), E->getEndLoc());
14911template<
typename Derived>
14914 if (E->isTypeOperand()) {
14916 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14920 if (!getDerived().AlwaysRebuild() &&
14921 TInfo == E->getTypeOperandSourceInfo())
14924 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14925 TInfo, E->getEndLoc());
14931 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14932 if (SubExpr.isInvalid())
14935 if (!getDerived().AlwaysRebuild() &&
14936 SubExpr.get() == E->getExprOperand())
14939 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14940 SubExpr.get(), E->getEndLoc());
14943template<
typename Derived>
14949template<
typename Derived>
14956template<
typename Derived>
14972 auto &S = getSema();
14973 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14974 return S.getCurrentThisType();
14975 if (S.getCurLambda())
14976 return getDerived().TransformType(E->getType());
14977 return S.getCurrentThisType();
14980 if (!getDerived().AlwaysRebuild() && T == E->getType() &&
14981 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14984 getSema().MarkThisReferenced(E);
14988 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14991template<
typename Derived>
14994 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14995 if (SubExpr.isInvalid())
14998 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15000 if (!getDerived().AlwaysRebuild() &&
15001 SubExpr.get() == E->getSubExpr())
15004 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15005 E->isThrownVariableInScope());
15008template<
typename Derived>
15012 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15017 if (E->hasRewrittenInit()) {
15018 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15019 if (InitRes.isInvalid())
15023 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15024 E->getUsedContext() == SemaRef.
CurContext &&
15025 InitRes.get() == E->getRewrittenExpr())
15028 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15032template<
typename Derived>
15036 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15040 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15044 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
15047template<
typename Derived>
15051 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
15055 if (!getDerived().AlwaysRebuild() &&
15056 T == E->getTypeSourceInfo())
15059 return getDerived().RebuildCXXScalarValueInitExpr(T,
15060 T->getTypeLoc().getEndLoc(),
15061 E->getRParenLoc());
15064template<
typename Derived>
15069 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15070 if (!AllocTypeInfo)
15074 std::optional<Expr *> ArraySize;
15075 if (E->isArray()) {
15077 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15078 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15079 if (NewArraySize.isInvalid())
15082 ArraySize = NewArraySize.get();
15086 bool ArgumentChanged =
false;
15088 if (getDerived().TransformExprs(E->getPlacementArgs(),
15089 E->getNumPlacementArgs(),
true,
15090 PlacementArgs, &ArgumentChanged))
15094 Expr *OldInit = E->getInitializer();
15097 NewInit = getDerived().TransformInitializer(OldInit,
true);
15098 if (NewInit.isInvalid())
15103 if (E->getOperatorNew()) {
15104 OperatorNew = cast_or_null<FunctionDecl>(
15105 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15111 if (E->getOperatorDelete()) {
15112 OperatorDelete = cast_or_null<FunctionDecl>(
15113 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15114 if (!OperatorDelete)
15118 if (!getDerived().AlwaysRebuild() &&
15119 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15120 ArraySize == E->getArraySize() &&
15121 NewInit.get() == OldInit &&
15122 OperatorNew == E->getOperatorNew() &&
15123 OperatorDelete == E->getOperatorDelete() &&
15124 !ArgumentChanged) {
15129 if (OperatorDelete)
15132 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15144 QualType AllocType = AllocTypeInfo->getType();
15155 = dyn_cast<ConstantArrayType>(ArrayT)) {
15159 AllocType = ConsArrayT->getElementType();
15161 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15162 if (DepArrayT->getSizeExpr()) {
15163 ArraySize = DepArrayT->getSizeExpr();
15164 AllocType = DepArrayT->getElementType();
15169 return getDerived().RebuildCXXNewExpr(
15170 E->getBeginLoc(), E->isGlobalNew(),
15171 E->getBeginLoc(), PlacementArgs,
15172 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15173 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15176template<
typename Derived>
15185 if (E->getOperatorDelete()) {
15186 OperatorDelete = cast_or_null<FunctionDecl>(
15187 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15188 if (!OperatorDelete)
15192 if (!getDerived().AlwaysRebuild() &&
15193 Operand.get() == E->getArgument() &&
15194 OperatorDelete == E->getOperatorDelete()) {
15197 if (OperatorDelete)
15200 if (!E->getArgument()->isTypeDependent()) {
15202 E->getDestroyedType());
15211 return getDerived().RebuildCXXDeleteExpr(
15212 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15215template<
typename Derived>
15220 if (
Base.isInvalid())
15224 bool MayBePseudoDestructor =
false;
15226 E->getOperatorLoc(),
15227 E->isArrow()? tok::arrow : tok::period,
15229 MayBePseudoDestructor);
15230 if (
Base.isInvalid())
15233 QualType ObjectType = ObjectTypePtr.get();
15235 if (QualifierLoc) {
15237 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15242 SS.
Adopt(QualifierLoc);
15245 if (E->getDestroyedTypeInfo()) {
15246 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15247 E->getDestroyedTypeInfo(), ObjectType,
15249 if (!DestroyedTypeInfo)
15252 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15256 E->getDestroyedTypeLoc());
15260 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15261 nullptr, SS, ObjectTypePtr,
false);
15267 E->getDestroyedTypeLoc());
15271 if (E->getScopeTypeInfo()) {
15272 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15273 E->getScopeTypeInfo(), ObjectType,
nullptr);
15274 if (!ScopeTypeInfo)
15278 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15279 E->getOperatorLoc(),
15283 E->getColonColonLoc(),
15288template <
typename Derived>
15293 bool AllEmptyPacks =
true;
15294 for (
auto *OldD : Old->
decls()) {
15310 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15311 Decls = UPD->expansions();
15314 for (
auto *D : Decls) {
15315 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15316 for (
auto *SD : UD->shadows())
15323 AllEmptyPacks &= Decls.empty();
15332 if (AllEmptyPacks && !RequiresADL) {
15343 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15344 getSema().FilterAcceptableTemplateNames(R,
15350 getSema().Diag(R.getNameLoc(),
15351 diag::err_template_kw_refers_to_non_template)
15355 diag::note_template_kw_refers_to_non_template)
15356 << R.getLookupName();
15364template <
typename Derived>
15370template <
typename Derived>
15373 bool IsAddressOfOperand) {
15378 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15385 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15389 SS.
Adopt(QualifierLoc);
15393 CXXRecordDecl *NamingClass
15394 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15397 if (!NamingClass) {
15402 R.setNamingClass(NamingClass);
15423 SS, TemplateKWLoc, R,
15430 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15433 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15437template<
typename Derived>
15440 bool ArgChanged =
false;
15442 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15444 TypeLoc FromTL = From->getTypeLoc();
15447 TLB.
reserve(FromTL.getFullDataSize());
15448 QualType To = getDerived().TransformType(TLB, FromTL);
15452 if (To == From->getType())
15453 Args.push_back(From);
15455 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15465 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15471 bool Expand =
true;
15472 bool RetainExpansion =
false;
15474 ExpansionTL.getTypePtr()->getNumExpansions();
15476 if (getDerived().TryExpandParameterPacks(
15477 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15478 Unexpanded,
true, Expand,
15479 RetainExpansion, NumExpansions))
15489 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15491 QualType To = getDerived().TransformType(TLB, PatternTL);
15495 To = getDerived().RebuildPackExpansionType(To,
15496 PatternTL.getSourceRange(),
15497 ExpansionTL.getEllipsisLoc(),
15505 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15511 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15514 TLB.
reserve(PatternTL.getFullDataSize());
15515 QualType To = getDerived().TransformType(TLB, PatternTL);
15519 if (To->containsUnexpandedParameterPack()) {
15520 To = getDerived().RebuildPackExpansionType(To,
15521 PatternTL.getSourceRange(),
15522 ExpansionTL.getEllipsisLoc(),
15532 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15535 if (!RetainExpansion)
15540 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15543 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15545 QualType To = getDerived().TransformType(TLB, PatternTL);
15549 To = getDerived().RebuildPackExpansionType(To,
15550 PatternTL.getSourceRange(),
15551 ExpansionTL.getEllipsisLoc(),
15559 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15562 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15565 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15569template<
typename Derived>
15575 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15576 Old->NumTemplateArgs, TransArgs))
15579 return getDerived().RebuildConceptSpecializationExpr(
15580 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15581 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
15585template<
typename Derived>
15599 getSema().Context, getSema().CurContext,
15600 E->getBody()->getBeginLoc());
15604 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15605 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15606 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15610 Param->setDeclContext(Body);
15616 if (!TypeParamResult.isUnset())
15617 return TypeParamResult;
15620 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15625 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15626 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15627 ER->getReturnTypeRequirement()
15628 .getTypeConstraintTemplateParameterList()->getParam(0)
15629 ->setDeclContext(Body);
15634 return getDerived().RebuildRequiresExpr(
15635 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15636 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15639template<
typename Derived>
15645 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15646 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15647 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15648 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15650 TransReq =
getDerived().TransformNestedRequirement(
15654 Transformed.push_back(TransReq);
15659template<
typename Derived>
15672 return getDerived().RebuildTypeRequirement(TransType);
15675template<
typename Derived>
15678 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15684 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15687 TransExpr = TransExprRes.
get();
15690 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15692 if (RetReq.isEmpty())
15693 TransRetReq.emplace();
15694 else if (RetReq.isSubstitutionFailure())
15695 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15696 else if (RetReq.isTypeConstraint()) {
15698 RetReq.getTypeConstraintTemplateParameterList();
15700 getDerived().TransformTemplateParameterList(OrigTPL);
15703 TransRetReq.emplace(TPL);
15705 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15706 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15709 std::move(*TransRetReq));
15715template<
typename Derived>
15721 return getDerived().RebuildNestedRequirement(
15729 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15732template<
typename Derived>
15739 if (!getDerived().AlwaysRebuild() &&
15756template<
typename Derived>
15763 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15764 if (SubExpr.isInvalid())
15767 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15771 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15772 SubExpr.get(), E->getEndLoc());
15775template <
typename Derived>
15780 DRE, AddrTaken, RecoveryTSI);
15793template <
typename Derived>
15800template <
typename Derived>
15816 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15821 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15827 return getDerived().RebuildDependentScopeDeclRefExpr(
15828 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15829 IsAddressOfOperand, RecoveryTSI);
15833 if (getDerived().TransformTemplateArguments(
15837 return getDerived().RebuildDependentScopeDeclRefExpr(
15838 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15842template<
typename Derived>
15848 if (getDerived().AllowSkippingCXXConstructExpr() &&
15849 ((E->getNumArgs() == 1 ||
15850 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15851 (!getDerived().DropCallArgument(E->getArg(0))) &&
15852 !E->isListInitialization()))
15858 QualType T = getDerived().TransformType(E->getType());
15863 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15867 bool ArgumentChanged =
false;
15872 E->isListInitialization());
15873 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15878 if (!getDerived().AlwaysRebuild() &&
15879 T == E->getType() &&
15881 !ArgumentChanged) {
15888 return getDerived().RebuildCXXConstructExpr(
15889 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15890 E->hadMultipleCandidates(), E->isListInitialization(),
15891 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15892 E->getConstructionKind(), E->getParenOrBraceRange());
15895template<
typename Derived>
15898 QualType T = getDerived().TransformType(E->getType());
15903 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15907 if (!getDerived().AlwaysRebuild() &&
15908 T == E->getType() &&
15916 return getDerived().RebuildCXXInheritedCtorInitExpr(
15918 E->constructsVBase(), E->inheritedFromVBase());
15925template<
typename Derived>
15928 if (
auto *Dtor = E->getTemporary()->getDestructor())
15931 return getDerived().TransformExpr(E->getSubExpr());
15939template<
typename Derived>
15945template<
typename Derived>
15950 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15955 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15959 bool ArgumentChanged =
false;
15961 Args.reserve(E->getNumArgs());
15965 E->isListInitialization());
15966 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15970 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15971 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
15973 if (Res.isInvalid())
15975 Args = {Res.get()};
15979 if (!getDerived().AlwaysRebuild() &&
15980 T == E->getTypeSourceInfo() &&
15982 !ArgumentChanged) {
15989 return getDerived().RebuildCXXTemporaryObjectExpr(
15990 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15993template<
typename Derived>
15998 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15999 struct TransformedInitCapture {
16001 SourceLocation EllipsisLoc;
16003 SmallVector<InitCaptureInfoTy, 4> Expansions;
16006 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16008 CEnd = E->capture_end();
16010 if (!E->isInitCapture(
C))
16013 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16018 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16021 if (NewExprInitResult.isInvalid()) {
16025 Expr *NewExprInit = NewExprInitResult.get();
16028 getSema().buildLambdaInitCaptureInitialization(
16029 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16030 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16034 Result.Expansions.push_back(
16035 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16039 if (OldVD->isParameterPack()) {
16048 bool Expand =
true;
16049 bool RetainExpansion =
false;
16051 ExpansionTL.getTypePtr()->getNumExpansions();
16053 if (getDerived().TryExpandParameterPacks(
16054 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16055 Unexpanded,
true, Expand,
16056 RetainExpansion, NumExpansions))
16058 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16059 "capture since it cannot be extended");
16061 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16066 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16067 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16106 if ((getSema().isUnevaluatedContext() ||
16107 getSema().isConstantEvaluatedContext()) &&
16108 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16110 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16115 E->getIntroducerRange(),
nullptr, DependencyKind,
16116 E->getCaptureDefault());
16117 getDerived().transformedLocalDecl(OldClass, {
Class});
16120 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16123 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16124 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16125 E->hasExplicitParameters(), E->isMutable());
16135 CEnd = E->capture_end();
16139 if (
C->isImplicit())
16143 if (
C->capturesThis()) {
16151 dyn_cast_if_present<CXXRecordDecl>(
16152 getSema().getFunctionLevelDeclContext()),
16154 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16161 if (
C->capturesVLAType())
16165 if (E->isInitCapture(
C)) {
16166 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16171 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16173 QualType InitQualType = Info.second;
16174 if (
Init.isInvalid() || InitQualType.isNull()) {
16178 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16179 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16180 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16181 getSema().CurContext);
16186 NewVDs.push_back(NewVD);
16187 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16192 if (NewC.EllipsisLoc.isInvalid())
16193 LSI->ContainsUnexpandedParameterPack |=
16194 Init.get()->containsUnexpandedParameterPack();
16200 getDerived().transformedLocalDecl(OldVD, NewVDs);
16204 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16212 if (
C->isPackExpansion()) {
16214 bool ShouldExpand =
false;
16215 bool RetainExpansion =
false;
16217 if (getDerived().TryExpandParameterPacks(
16218 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16219 true, ShouldExpand,
16220 RetainExpansion, NumExpansions)) {
16225 if (ShouldExpand) {
16230 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16232 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16233 getDerived().TransformDecl(
C->getLocation(), Pack));
16234 if (!CapturedVar) {
16240 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16248 EllipsisLoc =
C->getEllipsisLoc();
16252 auto *CapturedVar = cast_or_null<ValueDecl>(
16253 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16254 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16261 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16262 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16265 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16268 getSema().finishLambdaExplicitCaptures(LSI);
16272 auto TPL = getDerived().TransformTemplateParameterList(
16273 E->getTemplateParameterList());
16274 LSI->GLTemplateParameterList = TPL;
16276 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16278 LSI->ContainsUnexpandedParameterPack |=
16279 TPL->containsUnexpandedParameterPack();
16284 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16286 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16287 if (NewCallOpType.isNull())
16289 LSI->ContainsUnexpandedParameterPack |=
16290 NewCallOpType->containsUnexpandedParameterPack();
16292 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16297 assert(FPTL &&
"Not a FunctionProtoType?");
16301 ExprResult E = getDerived().TransformLambdaConstraint(
16302 const_cast<Expr *
>(TRC.ConstraintExpr));
16305 TRC.ConstraintExpr = E.get();
16308 getSema().CompleteLambdaCallOperator(
16309 NewCallOperator, E->getCallOperator()->getLocation(),
16310 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16311 E->getCallOperator()->getConstexprKind(),
16312 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16313 E->hasExplicitResultType());
16315 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16316 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16322 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16323 if (getDerived().ReplacingOriginal()) {
16324 Numbering = OldClass->getLambdaNumbering();
16327 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16332 getSema().PushExpressionEvaluationContextForFunction(
16334 E->getCallOperator());
16341 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16342 getSema().pushCodeSynthesisContext(
C);
16346 : getDerived().TransformLambdaBody(E, E->getBody());
16348 getSema().popCodeSynthesisContext();
16352 FuncScopeCleanup.disable();
16354 if (Body.isInvalid()) {
16355 SavedContext.pop();
16356 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16361 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16364 SavedContext.pop();
16399 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16400 Class->setLambdaDependencyKind(DependencyKind);
16402 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16403 Body.get()->getEndLoc(), LSI);
16406template<
typename Derived>
16412template<
typename Derived>
16421 if (!
C->isImplicit())
16425 if (
C->capturesThis()) {
16426 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16433 if (
C->capturesVLAType())
16436 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16440 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16446 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16452template<
typename Derived>
16461 bool ArgumentChanged =
false;
16473 if (!getDerived().AlwaysRebuild() &&
16479 return getDerived().RebuildCXXUnresolvedConstructExpr(
16483template<
typename Derived>
16492 if (!E->isImplicitAccess()) {
16493 OldBase = E->getBase();
16494 Base = getDerived().TransformExpr(OldBase);
16495 if (
Base.isInvalid())
16500 bool MayBePseudoDestructor =
false;
16502 E->getOperatorLoc(),
16503 E->isArrow()? tok::arrow : tok::period,
16505 MayBePseudoDestructor);
16506 if (
Base.isInvalid())
16509 ObjectType = ObjectTy.get();
16510 BaseType = ((
Expr*)
Base.get())->getType();
16513 BaseType = getDerived().TransformType(E->getBaseType());
16520 = getDerived().TransformFirstQualifierInScope(
16521 E->getFirstQualifierFoundInScope(),
16522 E->getQualifierLoc().getBeginLoc());
16525 if (E->getQualifier()) {
16527 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16529 FirstQualifierInScope);
16541 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16542 if (!NameInfo.getName())
16545 if (!E->hasExplicitTemplateArgs()) {
16548 if (!getDerived().AlwaysRebuild() &&
16549 Base.get() == OldBase &&
16550 BaseType == E->getBaseType() &&
16551 QualifierLoc == E->getQualifierLoc() &&
16552 NameInfo.getName() == E->getMember() &&
16553 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16556 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16559 E->getOperatorLoc(),
16562 FirstQualifierInScope,
16568 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16569 E->getNumTemplateArgs(),
16573 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16576 E->getOperatorLoc(),
16579 FirstQualifierInScope,
16584template <
typename Derived>
16590 if (!Old->isImplicitAccess()) {
16591 Base = getDerived().TransformExpr(Old->getBase());
16592 if (
Base.isInvalid())
16595 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16596 if (
Base.isInvalid())
16598 BaseType =
Base.get()->getType();
16600 BaseType = getDerived().TransformType(Old->getBaseType());
16604 if (Old->getQualifierLoc()) {
16606 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16616 if (TransformOverloadExprDecls(Old,
false, R))
16620 if (Old->getNamingClass()) {
16622 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16626 R.setNamingClass(NamingClass);
16630 if (Old->hasExplicitTemplateArgs()) {
16631 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16632 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16633 if (getDerived().TransformTemplateArguments(
16634 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16642 NamedDecl *FirstQualifierInScope =
nullptr;
16644 return getDerived().RebuildUnresolvedMemberExpr(
16645 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16646 TemplateKWLoc, FirstQualifierInScope, R,
16647 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16650template<
typename Derived>
16655 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16656 if (SubExpr.isInvalid())
16659 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16662 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16665template<
typename Derived>
16668 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16669 if (Pattern.isInvalid())
16672 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16675 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16676 E->getNumExpansions());
16679template <
typename Derived>
16684 if (!Arg.isPackExpansion()) {
16696 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16697 OrigNumExpansions);
16709 if (!NumExpansions) {
16721template<
typename Derived>
16740 bool ShouldExpand =
false;
16741 bool RetainExpansion =
false;
16743 if (getDerived().TryExpandParameterPacks(
16745 true, ShouldExpand,
16746 RetainExpansion, NumExpansions))
16751 if (ShouldExpand) {
16753 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16754 ArgStorage = getSema().Context.getPackExpansionType(
16755 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16756 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16760 ExprResult DRE = getSema().BuildDeclRefExpr(
16761 VD, VD->getType().getNonLValueExprType(getSema().Context),
16764 if (DRE.isInvalid())
16767 new (getSema().Context)
16771 PackArgs = ArgStorage;
16776 if (!PackArgs.size()) {
16777 auto *Pack = cast_or_null<NamedDecl>(
16781 return getDerived().RebuildSizeOfPackExpr(
16788 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16800 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16803 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16804 PackLocIterator(*
this, PackArgs.end()),
16805 TransformedPackArgs,
true))
16812 bool PartialSubstitution =
false;
16813 for (
auto &Loc : TransformedPackArgs.arguments()) {
16814 Args.push_back(Loc.getArgument());
16815 if (Loc.getArgument().isPackExpansion())
16816 PartialSubstitution =
true;
16819 if (PartialSubstitution)
16820 return getDerived().RebuildSizeOfPackExpr(
16822 std::nullopt, Args);
16824 return getDerived().RebuildSizeOfPackExpr(
16826 static_cast<unsigned>(Args.size()),
16830template <
typename Derived>
16833 if (!E->isValueDependent())
16841 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16842 if (IndexExpr.isInvalid())
16847 bool FullySubstituted =
true;
16848 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16849 Expr *Pattern = E->getPackIdExpression();
16851 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16853 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16857 bool ShouldExpand =
true;
16858 bool RetainExpansion =
false;
16860 NumExpansions = std::nullopt;
16861 if (getDerived().TryExpandParameterPacks(
16862 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16863 true, ShouldExpand,
16864 RetainExpansion, NumExpansions))
16866 if (!ShouldExpand) {
16868 ExprResult Pack = getDerived().TransformExpr(Pattern);
16869 if (Pack.isInvalid())
16871 return getDerived().RebuildPackIndexingExpr(
16872 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16875 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16878 if (
Out.isInvalid())
16880 if (
Out.get()->containsUnexpandedParameterPack()) {
16881 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16882 OrigNumExpansions);
16883 if (
Out.isInvalid())
16885 FullySubstituted =
false;
16887 ExpandedExprs.push_back(
Out.get());
16891 if (RetainExpansion) {
16892 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16895 if (
Out.isInvalid())
16898 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16899 OrigNumExpansions);
16900 if (
Out.isInvalid())
16902 FullySubstituted =
false;
16903 ExpandedExprs.push_back(
Out.get());
16905 }
else if (!E->expandsToEmptyPack()) {
16906 if (getDerived().TransformExprs(E->getExpressions().data(),
16907 E->getExpressions().size(),
false,
16912 return getDerived().RebuildPackIndexingExpr(
16913 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16914 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16917template <
typename Derived>
16920 if (!getSema().ArgPackSubstIndex)
16926 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16927 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
16928 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
16932template <
typename Derived>
16949 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
16950 if (Replacement.isInvalid())
16953 Decl *AssociatedDecl =
16954 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
16955 if (!AssociatedDecl)
16958 QualType ParamType = TransformType(E->getParameterType());
16959 if (ParamType.isNull())
16962 if (Replacement.get() == OrigReplacement &&
16963 AssociatedDecl == E->getAssociatedDecl() &&
16964 ParamType == E->getParameterType())
16967 if (Replacement.get() != OrigReplacement ||
16968 ParamType != E->getParameterType()) {
16977 Param, ParamType, Replacement.get(), SugaredConverted,
16978 CanonicalConverted,
16980 if (Replacement.isInvalid())
16984 Replacement = E->getReplacement();
16987 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
16988 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
16990 E->getPackIndex(), E->getFinal());
16993template<
typename Derived>
17000template<
typename Derived>
17007template<
typename Derived>
17011 if (
Expr *OldCallee = E->getCallee()) {
17012 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17013 if (CalleeResult.isInvalid())
17018 Expr *Pattern = E->getPattern();
17021 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17022 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17026 bool Expand =
true;
17027 bool RetainExpansion =
false;
17029 NumExpansions = OrigNumExpansions;
17030 if (getDerived().TryExpandParameterPacks(
17031 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17032 true, Expand, RetainExpansion,
17042 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17043 if (LHS.isInvalid())
17047 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17048 if (RHS.isInvalid())
17051 if (!getDerived().AlwaysRebuild() &&
17052 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17055 return getDerived().RebuildCXXFoldExpr(
17056 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17057 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17063 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17064 SemaRef.
Diag(E->getEllipsisLoc(),
17065 clang::diag::err_fold_expression_limit_exceeded)
17066 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17067 << E->getSourceRange();
17068 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17077 bool LeftFold = E->isLeftFold();
17081 if (!LeftFold && RetainExpansion) {
17082 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17085 if (
Out.isInvalid())
17088 Result = getDerived().RebuildCXXFoldExpr(
17089 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17090 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17095 bool WarnedOnComparison =
false;
17096 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17098 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17100 if (
Out.isInvalid())
17103 if (
Out.get()->containsUnexpandedParameterPack()) {
17105 Result = getDerived().RebuildCXXFoldExpr(
17106 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17107 E->getOperator(), E->getEllipsisLoc(),
17108 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17109 OrigNumExpansions);
17110 }
else if (
Result.isUsable()) {
17117 Result = getDerived().RebuildCXXOperatorCallExpr(
17119 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17120 Functions, LHS, RHS);
17122 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17123 E->getOperator(), LHS, RHS,
17125 if (!WarnedOnComparison &&
Result.isUsable()) {
17126 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17127 BO && BO->isComparisonOp()) {
17128 WarnedOnComparison =
true;
17129 SemaRef.
Diag(BO->getBeginLoc(),
17130 diag::warn_comparison_in_fold_expression)
17131 << BO->getOpcodeStr();
17144 if (LeftFold && RetainExpansion) {
17145 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17148 if (
Out.isInvalid())
17151 Result = getDerived().RebuildCXXFoldExpr(
17152 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17153 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17159 PE->setIsProducedByFoldExpansion();
17164 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17169template <
typename Derived>
17175 QualType T = getDerived().TransformType(E->getType());
17177 bool ArgChanged =
false;
17179 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17180 TransformedInits, &ArgChanged))
17183 if (!getDerived().AlwaysRebuild() && !ArgChanged && T == E->getType())
17186 return getDerived().RebuildCXXParenListInitExpr(
17187 TransformedInits, T, E->getUserSpecifiedInitExprs().size(),
17188 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17191template<
typename Derived>
17198template<
typename Derived>
17204template<
typename Derived>
17210template<
typename Derived>
17213 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17214 if (SubExpr.isInvalid())
17217 if (!getDerived().AlwaysRebuild() &&
17218 SubExpr.get() == E->getSubExpr())
17221 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17224template<
typename Derived>
17229 bool ArgChanged =
false;
17230 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17231 false, Elements, &ArgChanged))
17234 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17237 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17242template<
typename Derived>
17248 bool ArgChanged =
false;
17249 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17252 if (OrigElement.isPackExpansion()) {
17255 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17256 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17257 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17261 bool Expand =
true;
17262 bool RetainExpansion =
false;
17265 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17266 OrigElement.Value->getEndLoc());
17267 if (getDerived().TryExpandParameterPacks(
17268 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17269 true, Expand, RetainExpansion,
17278 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17279 if (Key.isInvalid())
17282 if (Key.get() != OrigElement.Key)
17286 if (
Value.isInvalid())
17293 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17295 Elements.push_back(Expansion);
17305 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17307 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17308 if (Key.isInvalid())
17312 if (
Value.isInvalid())
17322 if (Key.get()->containsUnexpandedParameterPack() ||
17323 Value.get()->containsUnexpandedParameterPack())
17324 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17326 Elements.push_back(Element);
17336 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17337 if (Key.isInvalid())
17340 if (Key.get() != OrigElement.Key)
17345 = getDerived().TransformExpr(OrigElement.Value);
17346 if (
Value.isInvalid())
17354 Elements.push_back(Element);
17357 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17360 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17364template<
typename Derived>
17368 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17369 if (!EncodedTypeInfo)
17372 if (!getDerived().AlwaysRebuild() &&
17373 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17376 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17378 E->getRParenLoc());
17381template<
typename Derived>
17391template<
typename Derived>
17395 = getDerived().TransformType(E->getTypeInfoAsWritten());
17403 if (!getDerived().AlwaysRebuild() &&
17404 TSInfo == E->getTypeInfoAsWritten() &&
17405 Result.get() == E->getSubExpr())
17409 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17413template <
typename Derived>
17419template<
typename Derived>
17423 bool ArgChanged =
false;
17425 Args.reserve(E->getNumArgs());
17426 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17433 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17434 if (!ReceiverTypeInfo)
17438 if (!getDerived().AlwaysRebuild() &&
17439 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17444 E->getSelectorLocs(SelLocs);
17445 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17448 E->getMethodDecl(),
17455 if (!E->getMethodDecl())
17460 E->getSelectorLocs(SelLocs);
17461 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17464 E->getReceiverType(),
17465 E->getMethodDecl(),
17473 "Only class and instance messages may be instantiated");
17475 = getDerived().TransformExpr(E->getInstanceReceiver());
17476 if (Receiver.isInvalid())
17480 if (!getDerived().AlwaysRebuild() &&
17481 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17486 E->getSelectorLocs(SelLocs);
17487 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17490 E->getMethodDecl(),
17496template<
typename Derived>
17502template<
typename Derived>
17508template<
typename Derived>
17513 if (
Base.isInvalid())
17519 if (!getDerived().AlwaysRebuild() &&
17520 Base.get() == E->getBase())
17523 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17525 E->isArrow(), E->isFreeIvar());
17528template<
typename Derived>
17533 if (!E->isObjectReceiver())
17538 if (
Base.isInvalid())
17544 if (!getDerived().AlwaysRebuild() &&
17545 Base.get() == E->getBase())
17548 if (E->isExplicitProperty())
17549 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17550 E->getExplicitProperty(),
17553 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17555 E->getImplicitPropertyGetter(),
17556 E->getImplicitPropertySetter(),
17560template<
typename Derived>
17565 if (
Base.isInvalid())
17569 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17570 if (Key.isInvalid())
17574 if (!getDerived().AlwaysRebuild() &&
17575 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17578 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17579 Base.get(), Key.get(),
17580 E->getAtIndexMethodDecl(),
17581 E->setAtIndexMethodDecl());
17584template<
typename Derived>
17589 if (
Base.isInvalid())
17593 if (!getDerived().AlwaysRebuild() &&
17594 Base.get() == E->getBase())
17597 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17602template<
typename Derived>
17605 bool ArgumentChanged =
false;
17607 SubExprs.reserve(E->getNumSubExprs());
17608 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17609 SubExprs, &ArgumentChanged))
17612 if (!getDerived().AlwaysRebuild() &&
17616 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17618 E->getRParenLoc());
17621template<
typename Derived>
17624 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17625 if (SrcExpr.isInvalid())
17632 if (!getDerived().AlwaysRebuild() &&
17633 Type == E->getTypeSourceInfo() &&
17634 SrcExpr.get() == E->getSrcExpr())
17637 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17638 SrcExpr.get(),
Type,
17639 E->getRParenLoc());
17642template<
typename Derived>
17645 BlockDecl *oldBlock = E->getBlockDecl();
17651 blockScope->TheDecl->setBlockMissingReturnType(
17652 oldBlock->blockMissingReturnType());
17661 if (getDerived().TransformFunctionTypeParams(
17662 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17663 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17665 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17670 getDerived().TransformType(exprFunctionType->getReturnType());
17672 auto epi = exprFunctionType->getExtProtoInfo();
17673 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17676 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17680 if (!params.empty())
17681 blockScope->TheDecl->setParams(params);
17683 if (!oldBlock->blockMissingReturnType()) {
17684 blockScope->HasImplicitReturnType =
false;
17685 blockScope->ReturnType = exprResultType;
17689 StmtResult body = getDerived().TransformStmt(E->getBody());
17690 if (body.isInvalid()) {
17691 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17699 for (
const auto &I : oldBlock->captures()) {
17700 VarDecl *oldCapture = I.getVariable();
17703 if (oldCapture->isParameterPack())
17707 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17709 assert(blockScope->CaptureMap.count(newCapture));
17715 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17716 "this pointer isn't captured in the old block");
17724template<
typename Derived>
17727 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17728 if (SrcExpr.isInvalid())
17731 QualType Type = getDerived().TransformType(E->getType());
17734 E->getRParenLoc());
17737template<
typename Derived>
17740 bool ArgumentChanged =
false;
17742 SubExprs.reserve(E->getNumSubExprs());
17743 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17744 SubExprs, &ArgumentChanged))
17747 if (!getDerived().AlwaysRebuild() &&
17751 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17752 E->getOp(), E->getRParenLoc());
17759template<
typename Derived>
17762 return SemaRef.BuildPointerType(PointeeType,
Star,
17766template<
typename Derived>
17769 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17773template<
typename Derived>
17776 bool WrittenAsLValue,
17778 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17782template <
typename Derived>
17786 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17790template<
typename Derived>
17797 return SemaRef.ObjC().BuildObjCTypeParamType(
17798 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17802template<
typename Derived>
17813 return SemaRef.ObjC().BuildObjCObjectType(
17814 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17815 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17820template<
typename Derived>
17824 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17827template <
typename Derived>
17830 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17831 if (SizeExpr || !Size)
17832 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17833 IndexTypeQuals, BracketsRange,
17837 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17839 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17842 for (
const auto &T : Types)
17843 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(T)) {
17853 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17854 IndexTypeQuals, BracketsRange,
17858template <
typename Derived>
17861 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17862 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17863 IndexTypeQuals, BracketsRange);
17866template <
typename Derived>
17870 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17871 IndexTypeQuals, BracketsRange);
17874template <
typename Derived>
17877 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17878 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17880 IndexTypeQuals, BracketsRange);
17883template <
typename Derived>
17886 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17887 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17889 IndexTypeQuals, BracketsRange);
17892template <
typename Derived>
17895 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17899template <
typename Derived>
17901 unsigned NumElements,
17904 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17907template <
typename Derived>
17911 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17914template<
typename Derived>
17916 unsigned NumElements,
17918 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17919 NumElements,
true);
17923 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17926template<
typename Derived>
17931 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17934template <
typename Derived>
17936 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17937 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17941template <
typename Derived>
17945 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17949template <
typename Derived>
17953 return SemaRef.BuildFunctionType(T, ParamTypes,
17959template<
typename Derived>
17961 return SemaRef.Context.getFunctionNoProtoType(T);
17964template <
typename Derived>
17968 assert(D &&
"no decl found");
17972 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17976 if (UPD->expansions().empty()) {
17977 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17978 << UPD->isCXXClassMember() << UPD;
17987 for (
auto *E : UPD->expansions()) {
17994 else if (T.isNull())
17997 assert(
getSema().Context.hasSameType(ThisT, T) &&
17998 "mismatched resolved types in using pack expansion");
18000 return T.
isNull() ? FallbackT : T;
18002 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18003 assert(Using->hasTypename() &&
18004 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18007 assert(++Using->shadow_begin() == Using->shadow_end());
18012 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18015 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18016 return SemaRef.Context.getUnresolvedUsingType(
18020template <
typename Derived>
18023 return SemaRef.BuildTypeofExprType(E, Kind);
18026template<
typename Derived>
18029 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18032template <
typename Derived>
18034 return SemaRef.BuildDecltypeType(E);
18037template <
typename Derived>
18042 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
18043 FullySubstituted, Expansions);
18046template<
typename Derived>
18048 UnaryTransformType::UTTKind UKind,
18050 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18053template <
typename Derived>
18057 return SemaRef.CheckTemplateIdType(
18062template<
typename Derived>
18065 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18068template<
typename Derived>
18072 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18073 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18076template <
typename Derived>
18080 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18084 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18087template <
typename Derived>
18090 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18093template <
typename Derived>
18101template <
typename Derived>
18108 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18111 AllowInjectedClassName);
18115template<
typename Derived>
18122 bool AllowInjectedClassName) {
18125 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18130 false,
Template, AllowInjectedClassName);
18134template <
typename Derived>
18139 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18144 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18145 Opc,
First, Second);
18160 if (Op == OO_Subscript) {
18161 if (!
First->getType()->isOverloadableType() &&
18163 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18165 }
else if (Op == OO_Arrow) {
18168 if (
First->getType()->isDependentType())
18171 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18172 }
else if (Second ==
nullptr || isPostIncDec) {
18173 if (!
First->getType()->isOverloadableType() ||
18174 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18181 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18185 !
First->getType()->isOverloadableType() &&
18191 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18200 if (!Second || isPostIncDec) {
18203 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18210 First, Second, RequiresADL);
18217template<
typename Derived>
18227 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18228 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18233 ->getAsCanonical<RecordType>())) {
18235 return SemaRef.BuildPseudoDestructorExpr(
18236 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18237 CCLoc, TildeLoc, Destroyed);
18249 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18250 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18251 diag::err_expected_class_or_namespace)
18252 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18256 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18260 return getSema().BuildMemberReferenceExpr(
18261 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18267template<
typename Derived>
18275 for (
unsigned I = 0; I < NumParams; ++I) {
18276 if (I != ContextParamPos) {
18282 Params.push_back(std::make_pair(StringRef(), QualType()));
18285 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18293 if (Body.isInvalid()) {
18294 getSema().ActOnCapturedRegionError();
18298 return getSema().ActOnCapturedRegionEnd(Body.get());
18301template <
typename Derived>
18307 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18311template <
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 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.
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 * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * 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 * 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.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
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.
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
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
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...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
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
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.
@ 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.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
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