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);
655 bool Uneval =
false);
682 bool Uneval =
false) {
701 template<
typename InputIterator>
705 bool Uneval =
false);
707 template <
typename InputIterator>
711 bool Uneval =
false);
732 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
736#define ABSTRACT_TYPELOC(CLASS, PARENT)
737#define TYPELOC(CLASS, PARENT) \
738 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
739#include "clang/AST/TypeLocNodes.def"
743 bool SuppressObjCLifetime);
747 bool SuppressObjCLifetime);
749 template<
typename Fn>
767 bool AllowInjectedClassName);
795 return getDerived().TransformFunctionTypeParams(
796 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
814 KWLoc, Params,
nullptr,
815 nullptr, PTypes, &TransParams, PInfos))
829 bool ExpectParameterPack);
858 bool IsAddressOfOperand,
866 bool IsAddressOfOperand);
874#define STMT(Node, Parent) \
875 LLVM_ATTRIBUTE_NOINLINE \
876 StmtResult Transform##Node(Node *S);
877#define VALUESTMT(Node, Parent) \
878 LLVM_ATTRIBUTE_NOINLINE \
879 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
880#define EXPR(Node, Parent) \
881 LLVM_ATTRIBUTE_NOINLINE \
882 ExprResult Transform##Node(Node *E);
883#define ABSTRACT_STMT(Stmt)
884#include "clang/AST/StmtNodes.inc"
886#define GEN_CLANG_CLAUSE_CLASS
887#define CLAUSE_CLASS(Enum, Str, Class) \
888 LLVM_ATTRIBUTE_NOINLINE \
889 OMPClause *Transform##Class(Class *S);
890#include "llvm/Frontend/OpenMP/OMP.inc"
968 const llvm::APInt *Size,
Expr *SizeExpr,
969 unsigned IndexTypeQuals,
SourceRange BracketsRange);
978 const llvm::APInt &Size,
Expr *SizeExpr,
979 unsigned IndexTypeQuals,
989 unsigned IndexTypeQuals,
999 unsigned IndexTypeQuals,
1010 unsigned IndexTypeQuals,
1048 unsigned NumColumns,
1066 Expr *AddrSpaceExpr,
1090 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1103 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1113 return SemaRef.Context.getCanonicalTagType(Tag);
1130 UnaryTransformType::UTTKind UKind,
1150 return SemaRef.Context.getAutoType(
1151 DK, DeducedAsType,
Keyword, TypeConstraintConcept, TypeConstraintArgs);
1159 return SemaRef.Context.getDeducedTemplateSpecializationType(
1178 return SemaRef.BuildParenType(InnerType);
1191 bool DeducedTSTContext) {
1193 SS.
Adopt(QualifierLoc);
1197 if (!
SemaRef.computeDeclContext(SS))
1205 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1206 *Id, IdLoc, DeducedTSTContext);
1219 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1224 switch (
Result.getResultKind()) {
1235 llvm_unreachable(
"Tag lookup cannot find non-tags");
1247 switch (
Result.getResultKind()) {
1253 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1254 << SomeDecl << NTK << Kind;
1259 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1265 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1267 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1268 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1324 bool AllowInjectedClassName);
1337 bool AllowInjectedClassName);
1343 bool AllowInjectedClassName);
1353 Decl *AssociatedDecl,
unsigned Index,
1356 ArgPack, AssociatedDecl, Index, Final);
1365 bool FullySubstituted,
1368 Pattern, IndexExpr, FullySubstituted, Expansions);
1422 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1432 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1434 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1446 Then, ElseLoc, Else);
1500 Inc, RParenLoc, Body);
1545 bool IsVolatile,
unsigned NumOutputs,
1552 NumInputs, Names, Constraints, Exprs,
1553 AsmString, Clobbers, NumLabels, RParenLoc);
1562 StringRef AsmString,
1563 unsigned NumOutputs,
unsigned NumInputs,
1569 NumOutputs, NumInputs,
1570 Constraints, Clobbers, Exprs, EndLoc);
1599 CoawaitLoc, Operand, OpCoawaitLookup);
1603 Suspend.
get(),
true);
1704 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1716 TraitInfos, Variants);
1728 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1742 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1769 VarList, PrescriptivenessModifier, PrescriptivenessModifierLoc,
1770 DimsModifier, DimsModifierExpr, DimsModifierLoc, StartLoc, LParenLoc,
1808 std::optional<unsigned> FillIdx,
1810 unsigned FillCount = FillIdx ? 1 : 0;
1812 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1851 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1887 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1900 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1907 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1920 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1982 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
2010 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
2011 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
2012 UnresolvedReductions);
2026 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2027 ReductionId, UnresolvedReductions);
2042 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2043 ReductionId, UnresolvedReductions);
2056 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2057 StepModifierLoc, EndLoc);
2070 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2130 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2143 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2158 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2159 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2160 ColonLoc, VarList, Locs,
2161 false, UnresolvedMappers);
2178 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2179 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2193 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2194 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2206 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2231 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2244 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2279 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2294 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2295 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2311 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2312 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2325 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2367 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2414 StartLoc, LParenLoc, EndLoc,
Data);
2427 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2439 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2452 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2463 LParenLoc, VarLoc, EndLoc);
2475 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2546 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2627 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2675 ForLoc, Element, Collection, RParenLoc);
2693 StartLoc, IdLoc, Id);
2730 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2731 if (RangeStmt->isSingleDecl()) {
2732 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2733 if (RangeVar->isInvalidDecl())
2736 Expr *RangeExpr = RangeVar->getInit();
2743 diag::err_objc_for_range_init_stmt)
2744 <<
Init->getSourceRange();
2747 ForLoc, LoopVar, RangeExpr, RParenLoc);
2754 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End, Cond, Inc,
2768 QualifierLoc, NameInfo, Nested);
2830 SS.
Adopt(QualifierLoc);
2884 UnaryExprOrTypeTrait ExprKind,
2895 UnaryExprOrTypeTrait ExprKind,
2950 if (IsOMPArraySection)
2952 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2953 Stride, RBracketLoc);
2955 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2956 "Stride/second colon not allowed for OpenACC");
2959 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2971 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2983 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2993 Expr *ExecConfig =
nullptr) {
2995 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
3002 nullptr, Callee, LParenLoc, Args, RParenLoc);
3020 if (!
Member->getDeclName()) {
3024 assert(
Member->getType()->isRecordType() &&
3025 "unnamed member not of record type?");
3038 if (!isArrow &&
Base->isPRValue()) {
3053 SS.
Adopt(QualifierLoc);
3056 if (
Base->containsErrors())
3061 if (isArrow && !BaseType->isPointerType())
3067 R.addDecl(FoundDecl);
3070 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3075 ->getAsCXXRecordDecl()) {
3079 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3087 FirstQualifierInScope,
3088 R, ExplicitTemplateArgs,
3098 bool ForFoldExpression =
false) {
3176 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3189 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3229 unsigned NumUserSpecifiedExprs,
3234 InitLoc, LParenLoc, RParenLoc);
3264 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3276 Expr *ControllingExpr,
3281 ControllingExpr, Types, Exprs);
3296 ControllingType, Types, Exprs);
3329 case Stmt::CXXStaticCastExprClass:
3330 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3331 RAngleLoc, LParenLoc,
3332 SubExpr, RParenLoc);
3334 case Stmt::CXXDynamicCastExprClass:
3335 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3336 RAngleLoc, LParenLoc,
3337 SubExpr, RParenLoc);
3339 case Stmt::CXXReinterpretCastExprClass:
3340 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3341 RAngleLoc, LParenLoc,
3345 case Stmt::CXXConstCastExprClass:
3346 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3347 RAngleLoc, LParenLoc,
3348 SubExpr, RParenLoc);
3350 case Stmt::CXXAddrspaceCastExprClass:
3351 return getDerived().RebuildCXXAddrspaceCastExpr(
3352 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3355 llvm_unreachable(
"Invalid C++ named cast");
3433 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3445 bool ListInitialization) {
3449 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3451 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3452 RParenLoc, ListInitialization);
3454 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3456 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3457 ListInitialization);
3461 ListInitialization);
3525 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3535 bool IsThrownVariableInScope) {
3545 Expr *RewrittenExpr) {
3547 RewrittenExpr,
getSema().CurContext);
3556 Expr *RewrittenInit) {
3558 getSema().CurContext, RewrittenInit);
3582 std::optional<Expr *> ArraySize,
3601 bool IsGlobalDelete,
3652 bool IsAddressOfOperand,
3655 SS.
Adopt(QualifierLoc);
3657 if (TemplateArgs || TemplateKWLoc.
isValid())
3659 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3662 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3684 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3685 bool ListInitialization,
bool StdInitListInitialization,
3692 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3695 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3702 HadMultipleCandidates,
3704 StdInitListInitialization,
3705 RequiresZeroInit, ConstructKind,
3713 bool ConstructsVBase,
3714 bool InheritedFromVBase) {
3716 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3727 bool ListInitialization) {
3729 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3740 bool ListInitialization) {
3742 RParenLoc, ListInitialization);
3759 SS.
Adopt(QualifierLoc);
3761 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3762 OperatorLoc, IsArrow,
3764 FirstQualifierInScope,
3766 TemplateArgs,
nullptr);
3782 SS.
Adopt(QualifierLoc);
3784 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3785 OperatorLoc, IsArrow,
3787 FirstQualifierInScope,
3788 R, TemplateArgs,
nullptr);
3796 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3809 RParenLoc, Length, PartialArgs);
3814 Expr *PackIdExpression,
Expr *IndexExpr,
3816 bool FullySubstituted =
false) {
3818 IndexExpr, RSquareLoc, ExpandedExprs,
3844 NamedConcept, TALI);
3862 LocalParameters, RParenLoc, Requirements,
3869 return SemaRef.BuildTypeRequirement(SubstDiag);
3873 return SemaRef.BuildTypeRequirement(
T);
3881 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3888 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3900 return SemaRef.BuildNestedRequirement(Constraint);
3916 Expr **Elements,
unsigned NumElements) {
3926 RB,
Base, Key, getterMethod, setterMethod);
3945 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3957 return SemaRef.ObjC().BuildClassMessage(
3958 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3971 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3974 SelectorLocs, RBracLoc, Args);
3986 return Method->isInstanceMethod()
3987 ?
SemaRef.ObjC().BuildInstanceMessage(
3988 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3989 SelectorLocs, RBracLoc, Args)
3990 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3992 SelectorLocs, RBracLoc, Args);
4001 bool IsArrow,
bool IsFreeIvar) {
4010 if (IsFreeIvar &&
Result.isUsable())
4047 PropertyLoc,
Base));
4076 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4079 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4087 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4088 CK_BuiltinFnToFnPtr).get();
4104 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4119 EllipsisLoc, NumExpansions);
4143 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4179 EllipsisLoc, RHS, RParenLoc,
4188 Init->containsUnexpandedParameterPack();
4189 else if (PVD->hasUninstantiatedDefaultArg())
4191 PVD->getUninstantiatedDefaultArg()
4192 ->containsUnexpandedParameterPack();
4346 Exprs.push_back(DevNumExpr);
4347 llvm::append_range(Exprs, QueueIdExprs);
4384 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4408 ObjectType, FirstQualifierInScope);
4414 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4415 DependentNameTypeLoc TL,
4416 bool DeducibleTSTContext,
4417 QualType ObjectType = QualType(),
4418 NamedDecl *UnqualLookup =
nullptr);
4421 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4426 OpenACCDirectiveKind DirKind,
4427 const OpenACCClause *OldClause);
4430template <
typename Derived>
4440#define STMT(Node, Parent) \
4441 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4442#define VALUESTMT(Node, Parent) \
4443 case Stmt::Node##Class: \
4444 return getDerived().Transform##Node(cast<Node>(S), SDK);
4445#define ABSTRACT_STMT(Node)
4446#define EXPR(Node, Parent)
4447#include "clang/AST/StmtNodes.inc"
4450#define STMT(Node, Parent)
4451#define ABSTRACT_STMT(Stmt)
4452#define EXPR(Node, Parent) case Stmt::Node##Class:
4453#include "clang/AST/StmtNodes.inc"
4458 E =
getSema().ActOnStmtExprResult(E);
4466template<
typename Derived>
4474#define GEN_CLANG_CLAUSE_CLASS
4475#define CLAUSE_CLASS(Enum, Str, Class) \
4477 return getDerived().Transform##Class(cast<Class>(S));
4478#include "llvm/Frontend/OpenMP/OMP.inc"
4485template<
typename Derived>
4492#define STMT(Node, Parent) case Stmt::Node##Class: break;
4493#define ABSTRACT_STMT(Stmt)
4494#define EXPR(Node, Parent) \
4495 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4496#include "clang/AST/StmtNodes.inc"
4502template<
typename Derived>
4510 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4511 Init = FE->getSubExpr();
4513 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4519 Init = MTE->getSubExpr();
4522 Init = Binder->getSubExpr();
4525 Init = ICE->getSubExprAsWritten();
4528 dyn_cast<CXXStdInitializerListExpr>(
Init))
4565 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4566 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4567 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4568 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4570 bool ArgChanged =
false;
4572 true, NewArgs, &ArgChanged))
4583 if (
Parens.isInvalid()) {
4586 assert(NewArgs.empty() &&
4587 "no parens or braces but have direct init with arguments?");
4594template<
typename Derived>
4600 for (
unsigned I = 0; I != NumInputs; ++I) {
4610 Expr *Pattern = Expansion->getPattern();
4613 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4614 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4619 bool RetainExpansion =
false;
4620 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4624 Unexpanded,
true, Expand,
4625 RetainExpansion, NumExpansions))
4638 Expansion->getEllipsisLoc(),
4640 if (Out.isInvalid())
4645 Outputs.push_back(Out.get());
4651 if (ArgChanged) *ArgChanged =
true;
4655 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4658 if (Out.isInvalid())
4661 if (Out.get()->containsUnexpandedParameterPack()) {
4663 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4664 if (Out.isInvalid())
4668 Outputs.push_back(Out.get());
4673 if (RetainExpansion) {
4674 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4677 if (Out.isInvalid())
4681 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4682 if (Out.isInvalid())
4685 Outputs.push_back(Out.get());
4692 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4697 if (
Result.get() != Inputs[I] && ArgChanged)
4700 Outputs.push_back(
Result.get());
4706template <
typename Derived>
4717 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4723 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4732 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4739template <
typename Derived>
4747 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4759 llvm_unreachable(
"unexpected null nested name specifier");
4790 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4791 QualifierLoc, ObjectType, FirstQualifierInScope);
4795 FirstQualifierInScope =
nullptr;
4797 SS.
Adopt(QualifierLoc);
4801 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4803 FirstQualifierInScope,
false))
4811 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4812 FirstQualifierInScope);
4818 if (
T->isDependentType() ||
T->isRecordType() ||
4819 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4820 if (
T->isEnumeralType())
4822 diag::warn_cxx98_compat_enum_nested_name_spec);
4829 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4853template<
typename Derived>
4873 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4880 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4890 NewTInfo =
getDerived().TransformType(OldTInfo);
4893 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4901 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4914 llvm_unreachable(
"Unknown name kind.");
4917template <
typename Derived>
4921 QualType ObjectType,
bool AllowInjectedClassName) {
4923 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4924 ObjectType, AllowInjectedClassName);
4925 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
IO.getOperator(),
4926 NameLoc, ObjectType,
4927 AllowInjectedClassName);
4930template <
typename Derived>
4934 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4936 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4939 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4940 QualifierLoc, ObjectType, FirstQualifierInScope);
4947 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4948 FirstQualifierInScope, AllowInjectedClassName);
4949 if (NewUnderlyingName.
isNull())
4951 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4955 NewUnderlyingName == UnderlyingName)
4958 SS.
Adopt(QualifierLoc);
4959 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4965 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4966 QualifierLoc, ObjectType, FirstQualifierInScope);
4980 SS.
Adopt(QualifierLoc);
4981 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4982 NameLoc, ObjectType,
4983 AllowInjectedClassName);
4988 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4995 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4999 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
5000 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
5003 Decl *AssociatedDecl =
5004 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
5006 AssociatedDecl == S->getAssociatedDecl())
5008 return SemaRef.Context.getSubstTemplateTemplateParm(
5009 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
5014 assert(!QualifierLoc &&
"Unexpected qualified pack-index-template-name");
5020 IndexExpr =
getDerived().TransformExpr(PI->getIndexExpr());
5028 NoQualifier, TemplateKWLoc, N, NameLoc, ObjectType,
5029 FirstQualifierInScope, AllowInjectedClassName);
5036 bool NotYetExpanded = Names.empty();
5037 bool FullySubstituted =
true;
5039 if (Names.empty() && !PI->expandsToEmptyPack())
5043 if (!N.containsUnexpandedParameterPack()) {
5045 if (Transformed.
isNull())
5047 SubstitutedNames.push_back(Transformed);
5052 getSema().collectUnexpandedParameterPacks(N, Unexpanded);
5053 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5055 bool ShouldExpand =
true;
5056 bool RetainExpansion =
false;
5061 RetainExpansion, NumExpansions))
5064 if (!ShouldExpand) {
5069 if (NotYetExpanded) {
5070 FullySubstituted =
false;
5071 return getDerived().RebuildPackIndexingTemplateName(
5072 Pack, IndexExpr.
get(), FullySubstituted);
5074 SubstitutedNames.push_back(Pack);
5078 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5083 SubstitutedNames.push_back(Out);
5084 FullySubstituted &= !Out.containsUnexpandedParameterPack();
5089 if (RetainExpansion) {
5090 FullySubstituted =
false;
5091 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5095 SubstitutedNames.push_back(Out);
5104 return getDerived().RebuildPackIndexingTemplateName(
5105 NewPattern, IndexExpr.
get(), FullySubstituted, SubstitutedNames);
5109 "DeducedTemplateName should not escape partial ordering");
5113 assert(!QualifierLoc &&
"Unexpected qualifier");
5120 assert(!QualifierLoc &&
5121 "Unexpected qualified SubstTemplateTemplateParmPack");
5123 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
5124 SubstPack->getIndex(), SubstPack->getFinal());
5128 llvm_unreachable(
"overloaded function decl survived to here");
5131template <
typename Derived>
5140template <
typename Derived>
5145 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5151template<
typename Derived>
5155 Output =
getSema().getTrivialTemplateArgumentLoc(
5159template <
typename Derived>
5167 llvm_unreachable(
"Unexpected TemplateArgument");
5190 if (NewT ==
T && D == NewD)
5207 llvm_unreachable(
"unexpected template argument kind");
5239 llvm_unreachable(
"Caller should expand pack expansions");
5255 E =
SemaRef.ActOnConstantExpression(E);
5270template<
typename Derived,
typename InputIterator>
5278 typedef typename std::iterator_traits<InputIterator>::difference_type
5293 : Self(Self), Iter(Iter) { }
5308 Self.InventTemplateArgumentLoc(*Iter,
Result);
5316 return X.Iter == Y.Iter;
5321 return X.Iter != Y.Iter;
5325template<
typename Derived>
5326template<
typename InputIterator>
5345 PackLocIterator(*
this, In.getArgument().pack_begin()),
5346 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5353 if (In.getArgument().isPackExpansion()) {
5365 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5375 if (Out.getArgument().containsUnexpandedParameterPack()) {
5378 if (Out.getArgument().isNull())
5388 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5396 if (Out.getArgument().isNull())
5415template <
typename Derived>
5416template <
typename InputIterator>
5425 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5437 PackLocIterator(*
this, In.getArgument().pack_begin()),
5438 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5444 if (!isNonDependentConceptArgument(In.getArgument())) {
5459template <
typename Derived>
5470 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5473 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5474 if (IsLateExpansionAttempt) {
5481 if (!SawPackTypes) {
5486 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5494 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5500 if (ComputeInfo(In,
false, Info, Pattern))
5512 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5513 std::in_place,
getSema(), std::nullopt);
5519 if (Out.getArgument().isNull())
5556 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5557 if (ComputeInfo(Out,
true, Info, OutPattern))
5570template<
typename Derived>
5588template <
typename Derived>
5608template<
typename Derived>
5611 switch (
T.getTypeLocClass()) {
5612#define ABSTRACT_TYPELOC(CLASS, PARENT)
5613#define TYPELOC(CLASS, PARENT) \
5614 case TypeLoc::CLASS: \
5615 return getDerived().Transform##CLASS##Type(TLB, \
5616 T.castAs<CLASS##TypeLoc>());
5617#include "clang/AST/TypeLocNodes.def"
5620 llvm_unreachable(
"unhandled type loc!");
5623template<
typename Derived>
5636template <
typename Derived>
5674template<
typename Derived>
5679 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5680 auto SuppressObjCLifetime =
5681 T.getType().getLocalQualifiers().hasObjCLifetime();
5683 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5684 SuppressObjCLifetime);
5685 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5686 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5687 TLB, STTP, SuppressObjCLifetime);
5689 Result = getDerived().TransformType(TLB, UnqualTL);
5708template <
typename Derived>
5718 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5725 if (
T.getPointerAuth().isPresent()) {
5726 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5729 if (!
T->isDependentType()) {
5730 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5731 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5739 if (
T->isFunctionType()) {
5740 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5750 if (
T->isReferenceType()) {
5760 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5762 else if (
T.getObjCLifetime()) {
5766 const AutoType *AutoTy;
5767 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5773 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5775 AutoTy->getKeyword(),
5776 AutoTy->getTypeConstraintConcept(),
5777 AutoTy->getTypeConstraintArguments());
5782 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5788 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5791template <
typename Derived>
5792QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5795 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5798 case TypeLoc::TemplateSpecialization:
5799 return getDerived().TransformTemplateSpecializationType(
5801 FirstQualifierInScope,
true);
5802 case TypeLoc::DependentName:
5803 return getDerived().TransformDependentNameType(
5805 ObjectType, FirstQualifierInScope);
5809 return getDerived().TransformType(TLB, TL);
5813template <
class TyLoc>
static inline
5815 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5816 NewT.setNameLoc(
T.getNameLoc());
5820template<
typename Derived>
5821QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5823 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5824 NewT.setBuiltinLoc(T.getBuiltinLoc());
5825 if (T.needsExtraLocalData())
5826 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5830template<
typename Derived>
5837template <
typename Derived>
5841 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5844template<
typename Derived>
5847 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5848 if (OriginalType.isNull())
5852 if (getDerived().AlwaysRebuild() ||
5853 OriginalType != TL.getOriginalLoc().getType())
5860template <
typename Derived>
5864 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5865 if (OriginalType.isNull())
5869 if (getDerived().AlwaysRebuild() ||
5870 OriginalType != TL.getElementLoc().getType())
5877template<
typename Derived>
5881 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5882 if (PointeeType.isNull())
5886 if (PointeeType->getAs<ObjCObjectType>()) {
5898 if (getDerived().AlwaysRebuild() ||
5899 PointeeType != TL.getPointeeLoc().getType()) {
5900 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5907 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5914template<
typename Derived>
5919 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5920 if (PointeeType.isNull())
5924 if (getDerived().AlwaysRebuild() ||
5925 PointeeType != TL.getPointeeLoc().getType()) {
5926 Result = getDerived().RebuildBlockPointerType(PointeeType,
5941template<
typename Derived>
5949 if (PointeeType.
isNull())
5954 PointeeType !=
T->getPointeeTypeAsWritten()) {
5956 T->isSpelledAsLValue(),
5978template<
typename Derived>
5982 return TransformReferenceType(TLB, TL);
5985template<
typename Derived>
5987TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5988 RValueReferenceTypeLoc TL) {
5989 return TransformReferenceType(TLB, TL);
5992template<
typename Derived>
5996 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5997 if (PointeeType.isNull())
6004 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
6005 if (!NewQualifierLoc)
6008 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
6010 NewCls = cast_or_null<CXXRecordDecl>(
6011 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
6017 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
6018 NewQualifierLoc.getNestedNameSpecifier() !=
6019 OldQualifierLoc.getNestedNameSpecifier() ||
6022 SS.
Adopt(NewQualifierLoc);
6023 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
6032 if (MPT && PointeeType != MPT->getPointeeType()) {
6039 NewTL.setQualifierLoc(NewQualifierLoc);
6044template<
typename Derived>
6049 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6050 if (ElementType.isNull())
6054 Expr *OldSize = TL.getSizeExpr();
6056 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
6057 Expr *NewSize =
nullptr;
6061 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
6066 if (getDerived().AlwaysRebuild() ||
6067 ElementType !=
T->getElementType() ||
6068 (
T->getSizeExpr() && NewSize != OldSize)) {
6069 Result = getDerived().RebuildConstantArrayType(ElementType,
6070 T->getSizeModifier(),
6071 T->getSize(), NewSize,
6072 T->getIndexTypeCVRQualifiers(),
6073 TL.getBracketsRange());
6084 NewTL.setRBracketLoc(TL.getRBracketLoc());
6085 NewTL.setSizeExpr(NewSize);
6090template<
typename Derived>
6095 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6096 if (ElementType.isNull())
6100 if (getDerived().AlwaysRebuild() ||
6101 ElementType !=
T->getElementType()) {
6102 Result = getDerived().RebuildIncompleteArrayType(ElementType,
6103 T->getSizeModifier(),
6104 T->getIndexTypeCVRQualifiers(),
6105 TL.getBracketsRange());
6112 NewTL.setRBracketLoc(TL.getRBracketLoc());
6113 NewTL.setSizeExpr(
nullptr);
6118template<
typename Derived>
6123 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6124 if (ElementType.isNull())
6131 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
6133 if (SizeResult.isInvalid())
6137 if (SizeResult.isInvalid())
6143 if (getDerived().AlwaysRebuild() ||
6144 ElementType !=
T->getElementType() ||
6145 Size !=
T->getSizeExpr()) {
6146 Result = getDerived().RebuildVariableArrayType(ElementType,
6147 T->getSizeModifier(),
6149 T->getIndexTypeCVRQualifiers(),
6150 TL.getBracketsRange());
6159 NewTL.setRBracketLoc(TL.getRBracketLoc());
6160 NewTL.setSizeExpr(Size);
6165template<
typename Derived>
6170 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6171 if (ElementType.isNull())
6179 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6182 Expr *origSize = TL.getSizeExpr();
6183 if (!origSize) origSize =
T->getSizeExpr();
6186 = getDerived().TransformExpr(origSize);
6188 if (sizeResult.isInvalid())
6191 Expr *size = sizeResult.get();
6194 if (getDerived().AlwaysRebuild() ||
6195 ElementType !=
T->getElementType() ||
6197 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6198 T->getSizeModifier(),
6200 T->getIndexTypeCVRQualifiers(),
6201 TL.getBracketsRange());
6210 NewTL.setRBracketLoc(TL.getRBracketLoc());
6211 NewTL.setSizeExpr(size);
6216template <
typename Derived>
6220 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6221 if (ElementType.isNull())
6227 Expr *OrigSize = TL.getSizeExpr();
6230 if (
Size.isInvalid())
6234 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6235 Size.get() != OrigSize) {
6236 Result = getDerived().RebuildDependentVectorType(
6237 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6247 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6248 NewTL.setSizeExpr(
Size.get());
6252 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6253 NewTL.setSizeExpr(
Size.get());
6259template<
typename Derived>
6265 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6266 if (ElementType.isNull())
6273 Expr *OrigSize = TL.getSizeExpr();
6276 if (
Size.isInvalid())
6280 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6281 Size.get() != OrigSize) {
6282 Result = getDerived().RebuildDependentSizedExtVectorType(
6283 ElementType,
Size.get(),
T->getAttributeLoc());
6293 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6294 NewTL.setSizeExpr(
Size.get());
6298 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6299 NewTL.setSizeExpr(
Size.get());
6305template <
typename Derived>
6310 QualType ElementType = getDerived().TransformType(
T->getElementType());
6311 if (ElementType.isNull())
6315 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6316 Result = getDerived().RebuildConstantMatrixType(
6317 ElementType,
T->getNumRows(),
T->getNumColumns(), TL.getAttrNameLoc());
6324 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6325 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6326 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6331template <
typename Derived>
6336 QualType ElementType = getDerived().TransformType(
T->getElementType());
6337 if (ElementType.isNull()) {
6345 Expr *origRows = TL.getAttrRowOperand();
6347 origRows =
T->getRowExpr();
6348 Expr *origColumns = TL.getAttrColumnOperand();
6350 origColumns =
T->getColumnExpr();
6352 ExprResult rowResult = getDerived().TransformExpr(origRows);
6354 if (rowResult.isInvalid())
6357 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6359 if (columnResult.isInvalid())
6362 Expr *rows = rowResult.get();
6363 Expr *columns = columnResult.get();
6366 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6367 rows != origRows || columns != origColumns) {
6368 Result = getDerived().RebuildDependentSizedMatrixType(
6369 ElementType, rows, columns,
T->getAttributeLoc());
6379 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6380 NewTL.setAttrRowOperand(rows);
6381 NewTL.setAttrColumnOperand(columns);
6385template <
typename Derived>
6391 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6400 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6402 if (AddrSpace.isInvalid())
6406 if (getDerived().AlwaysRebuild() ||
pointeeType !=
T->getPointeeType() ||
6407 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6408 Result = getDerived().RebuildDependentAddressSpaceType(
6420 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6421 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6424 TLB.TypeWasModifiedSafely(
Result);
6430template <
typename Derived>
6434 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6435 if (ElementType.isNull())
6439 if (getDerived().AlwaysRebuild() ||
6440 ElementType !=
T->getElementType()) {
6441 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6442 T->getVectorKind());
6449 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6450 NewTL.setSizeExpr(TL.getSizeExpr());
6455template<
typename Derived>
6459 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6460 if (ElementType.isNull())
6464 if (getDerived().AlwaysRebuild() ||
6465 ElementType !=
T->getElementType()) {
6466 Result = getDerived().RebuildExtVectorType(ElementType,
T->getNumElements(),
6467 TL.getAttrNameLoc());
6474 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6475 NewTL.setSizeExpr(TL.getSizeExpr());
6480template <
typename Derived>
6483 bool ExpectParameterPack) {
6518 if (NewTSI == OldTSI && indexAdjustment == 0)
6528 getDerived().transformedLocalDecl(OldParm, {newParm});
6532template <
typename Derived>
6540 unsigned *LastParamTransformed) {
6541 int indexAdjustment = 0;
6543 unsigned NumParams = Params.size();
6544 for (
unsigned i = 0; i != NumParams; ++i) {
6545 if (LastParamTransformed)
6546 *LastParamTransformed = i;
6548 assert(OldParm->getFunctionScopeIndex() == i);
6552 if (OldParm->isParameterPack()) {
6557 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6560 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6563 bool ShouldExpand =
false;
6564 bool RetainExpansion =
false;
6566 if (Unexpanded.size() > 0) {
6567 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6568 NumExpansions = OrigNumExpansions;
6572 ShouldExpand, RetainExpansion, NumExpansions)) {
6577 const AutoType *AT =
6578 Pattern.getType().getTypePtr()->getContainedAutoType();
6579 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6580 "Could not find parameter packs or undeduced auto type!");
6587 getDerived().ExpandingFunctionParameterPack(OldParm);
6588 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6591 =
getDerived().TransformFunctionTypeParam(OldParm,
6599 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6600 OutParamTypes.push_back(NewParm->
getType());
6602 PVars->push_back(NewParm);
6607 if (RetainExpansion) {
6608 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6610 =
getDerived().TransformFunctionTypeParam(OldParm,
6618 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6619 OutParamTypes.push_back(NewParm->
getType());
6621 PVars->push_back(NewParm);
6637 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6642 "Parameter pack no longer a parameter pack after "
6645 NewParm =
getDerived().TransformFunctionTypeParam(
6646 OldParm, indexAdjustment, std::nullopt,
6654 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6655 OutParamTypes.push_back(NewParm->
getType());
6657 PVars->push_back(NewParm);
6665 bool IsPackExpansion =
false;
6668 if (
const PackExpansionType *Expansion
6669 = dyn_cast<PackExpansionType>(OldType)) {
6671 QualType Pattern = Expansion->getPattern();
6673 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6676 bool ShouldExpand =
false;
6677 bool RetainExpansion =
false;
6681 RetainExpansion, NumExpansions)) {
6688 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6695 NewType =
getSema().getASTContext().getPackExpansionType(
6696 NewType, std::nullopt);
6703 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6704 OutParamTypes.push_back(NewType);
6706 PVars->push_back(
nullptr);
6715 if (RetainExpansion) {
6716 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6722 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6723 OutParamTypes.push_back(NewType);
6725 PVars->push_back(
nullptr);
6730 OldType = Expansion->getPattern();
6731 IsPackExpansion =
true;
6733 NewType =
getDerived().TransformType(OldType);
6735 NewType =
getDerived().TransformType(OldType);
6741 if (IsPackExpansion)
6742 NewType =
getSema().Context.getPackExpansionType(NewType,
6746 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6747 OutParamTypes.push_back(NewType);
6749 PVars->push_back(
nullptr);
6754 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6756 assert(parm->getFunctionScopeIndex() == i);
6763template<
typename Derived>
6768 return getDerived().TransformFunctionProtoType(
6772 ExceptionStorage, Changed);
6776template<
typename Derived>
template<
typename Fn>
6795 if (
T->hasTrailingReturn()) {
6799 T->getExtParameterInfosOrNull(),
6800 ParamTypes, &ParamDecls, ExtParamInfos))
6810 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6812 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6827 T->getExtParameterInfosOrNull(),
6828 ParamTypes, &ParamDecls, ExtParamInfos))
6834 bool EPIChanged =
false;
6839 if (
auto NewExtParamInfos =
6855 std::optional<FunctionEffectSet> NewFX;
6867 std::optional<FunctionEffectMode> Mode =
6887 "FunctionEffectMode::None shouldn't be possible here");
6890 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6893 NewFX->insert(NewEC, Errs);
6894 assert(Errs.empty());
6904 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6915 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6921template<
typename Derived>
6944 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6959 if (
const PackExpansionType *PackExpansion =
6960 T->getAs<PackExpansionType>()) {
6965 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6967 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6972 bool Expand =
false;
6973 bool RetainExpansion =
false;
6974 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6979 true, Expand, RetainExpansion,
6992 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6993 Exceptions.push_back(
U);
6999 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7003 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
7006 Exceptions.push_back(
U);
7010 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
7015 Exceptions.push_back(
U);
7025template<
typename Derived>
7035 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
7036 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
7047template <
typename Derived>
7048QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
7049 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
7051 const UnresolvedUsingType *T = TL.getTypePtr();
7052 bool Changed =
false;
7054 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7055 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
7056 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7059 Changed |= QualifierLoc != OldQualifierLoc;
7062 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
7068 if (getDerived().AlwaysRebuild() || Changed) {
7069 Result = getDerived().RebuildUnresolvedUsingType(
7070 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
7078 QualifierLoc, TL.getNameLoc());
7081 QualifierLoc, TL.getNameLoc());
7085template <
typename Derived>
7093 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7096 Changed |= QualifierLoc != OldQualifierLoc;
7099 auto *D = cast_or_null<UsingShadowDecl>(
7100 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7105 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
7106 if (UnderlyingType.isNull())
7108 Changed |= UnderlyingType !=
T->desugar();
7111 if (getDerived().AlwaysRebuild() || Changed) {
7112 Result = getDerived().RebuildUsingType(
7113 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
7123template<
typename Derived>
7131 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7134 Changed |= QualifierLoc != OldQualifierLoc;
7137 auto *
Typedef = cast_or_null<TypedefNameDecl>(
7138 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7146 if (getDerived().AlwaysRebuild() || Changed) {
7147 Result = getDerived().RebuildTypedefType(
7148 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7154 QualifierLoc, TL.getNameLoc());
7158template<
typename Derived>
7166 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7176 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7178 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7185 NewTL.setLParenLoc(TL.getLParenLoc());
7186 NewTL.setRParenLoc(TL.getRParenLoc());
7191template<
typename Derived>
7195 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7201 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7202 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7209 NewTL.setLParenLoc(TL.getLParenLoc());
7210 NewTL.setRParenLoc(TL.getRParenLoc());
7211 NewTL.setUnmodifiedTInfo(New_Under_TI);
7216template<
typename Derived>
7219 const DecltypeType *
T = TL.getTypePtr();
7226 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7230 E = getSema().ActOnDecltypeExpression(E.get());
7235 if (getDerived().AlwaysRebuild() ||
7236 E.get() !=
T->getUnderlyingExpr()) {
7237 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7245 NewTL.setRParenLoc(TL.getRParenLoc());
7249template <
typename Derived>
7259 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7260 if (IndexExpr.isInvalid())
7263 QualType Pattern = TL.getPattern();
7265 const PackIndexingType *PIT = TL.getTypePtr();
7269 bool NotYetExpanded = Types.empty();
7270 bool FullySubstituted =
true;
7272 if (Types.empty() && !PIT->expandsToEmptyPack())
7276 if (!
T->containsUnexpandedParameterPack()) {
7277 QualType Transformed = getDerived().TransformType(
T);
7278 if (Transformed.isNull())
7280 SubtitutedTypes.push_back(Transformed);
7285 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7286 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7289 bool ShouldExpand =
true;
7290 bool RetainExpansion =
false;
7292 if (getDerived().TryExpandParameterPacks(
7295 RetainExpansion, NumExpansions))
7297 if (!ShouldExpand) {
7303 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7306 if (NotYetExpanded) {
7307 FullySubstituted =
false;
7308 QualType Out = getDerived().RebuildPackIndexingType(
7309 Pack, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted);
7317 SubtitutedTypes.push_back(Pack);
7320 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7325 SubtitutedTypes.push_back(Out);
7326 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7330 if (RetainExpansion) {
7331 FullySubstituted =
false;
7332 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7336 SubtitutedTypes.push_back(Out);
7344 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7346 QualType Out = getDerived().RebuildPackIndexingType(
7347 Result, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted,
7357template<
typename Derived>
7363 if (
Result->isDependentType()) {
7364 const UnaryTransformType *
T = TL.getTypePtr();
7366 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7369 QualType NewBase = NewBaseTSI->getType();
7371 Result = getDerived().RebuildUnaryTransformType(NewBase,
7380 NewTL.setParensRange(TL.getParensRange());
7381 NewTL.setUnderlyingTInfo(NewBaseTSI);
7385template<
typename Derived>
7388 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7393 TL.getTemplateNameLoc());
7397 QualType OldDeduced =
T->getDeducedType();
7399 if (!OldDeduced.isNull()) {
7400 NewDeduced = getDerived().TransformType(OldDeduced);
7401 if (NewDeduced.isNull())
7405 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7413 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7414 NewTL.setQualifierLoc(QualifierLoc);
7418template <
typename Derived>
7425 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7430 auto *TD = cast_or_null<TagDecl>(
7437 TD !=
T->getDecl()) {
7438 if (
T->isCanonicalUnqualified())
7455template <
typename Derived>
7461template <
typename Derived>
7462QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7464 return getDerived().TransformTagType(TLB, TL);
7467template<
typename Derived>
7474template<
typename Derived>
7478 return getDerived().TransformTemplateTypeParmType(
7483template <
typename Derived>
7489template<
typename Derived>
7490QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7491 TypeLocBuilder &TLB,
7492 SubstTemplateTypeParmTypeLoc TL) {
7493 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7496 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7501 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7502 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7503 if (Replacement.isNull())
7507 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7511 SubstTemplateTypeParmTypeLoc NewTL
7512 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7513 NewTL.setNameLoc(TL.getNameLoc());
7517template <
typename Derived>
7523template<
typename Derived>
7527 return getDerived().TransformSubstTemplateTypeParmPackType(
7531template <
typename Derived>
7537template<
typename Derived>
7538QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7540 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7541 if (ValueType.isNull())
7544 QualType
Result = TL.getType();
7545 if (getDerived().AlwaysRebuild() ||
7546 ValueType != TL.getValueLoc().getType()) {
7547 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7554 NewTL.setLParenLoc(TL.getLParenLoc());
7555 NewTL.setRParenLoc(TL.getRParenLoc());
7560template <
typename Derived>
7563 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7564 if (ValueType.isNull())
7568 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7571 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7582template <
typename Derived>
7588 if (getDerived().AlwaysRebuild()) {
7589 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7590 EIT->getNumBits(), TL.getNameLoc());
7600template <
typename Derived>
7607 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7610 if (BitsExpr.isInvalid())
7615 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7616 Result = getDerived().RebuildDependentBitIntType(
7617 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7633template <
typename Derived>
7636 llvm_unreachable(
"This type does not need to be transformed.");
7644 template<
typename ArgLocContainer>
7646 ArgLocContainer *Container;
7671 : Container(&Container), Index(Index) { }
7685 return Container->getArgLoc(Index);
7689 return pointer(Container->getArgLoc(Index));
7694 return X.Container == Y.Container &&
X.Index == Y.Index;
7703template<
typename Derived>
7704QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7706 const AutoType *T = TL.getTypePtr();
7707 QualType OldDeduced = T->getDeducedType();
7708 QualType NewDeduced;
7709 if (!OldDeduced.isNull()) {
7710 NewDeduced = getDerived().TransformType(OldDeduced);
7711 if (NewDeduced.isNull())
7718 if (
T->isConstrained()) {
7719 assert(TL.getConceptReference());
7720 NewCD = getDerived().TransformConceptTemplateName(
7721 T->getTypeConstraintConcept(), TL.getConceptNameLoc());
7725 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7726 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7728 if (getDerived().TransformTemplateArguments(
7729 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7733 if (TL.getNestedNameSpecifierLoc()) {
7735 = getDerived().TransformNestedNameSpecifierLoc(
7736 TL.getNestedNameSpecifierLoc());
7737 if (!NewNestedNameSpec)
7743 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7744 T->isDependentType() ||
T->isConstrained()) {
7747 NewArgList.reserve(NewTemplateArgs.size());
7748 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7749 NewArgList.push_back(ArgLoc.getArgument());
7750 Result = getDerived().RebuildAutoType(
7752 NewDeduced,
T->getKeyword(), NewCD, NewArgList);
7759 NewTL.setRParenLoc(TL.getRParenLoc());
7760 NewTL.setConceptReference(
nullptr);
7762 if (
T->isConstrained()) {
7766 TL.getConceptNameLoc())
7771 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7772 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7774 NewTL.setConceptReference(CR);
7780template <
typename Derived>
7783 return getDerived().TransformTemplateSpecializationType(
7788template <
typename Derived>
7791 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7792 const TemplateSpecializationType *
T = TL.
getTypePtr();
7798 AllowInjectedClassName);
7807 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7816 QualType Result = getDerived().RebuildTemplateSpecializationType(
7829template <
typename Derived>
7833 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7834 if (modifiedType.isNull())
7841 oldType->getAttrKind(), modifiedType,
7842 TL.getAttr() ? TL.getAttr()->getLocation()
7843 : TL.getModifiedLoc().getBeginLoc()))
7847 const Attr *oldAttr = TL.getAttr();
7848 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7849 if (oldAttr && !newAttr)
7855 if (getDerived().AlwaysRebuild() ||
7856 modifiedType != oldType->getModifiedType()) {
7869 QualType equivalentType = modifiedType;
7870 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7872 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7874 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7875 if (equivalentType.isNull())
7880 if (oldType->getAttrKind() == attr::HLSLRowMajor)
7883 else if (oldType->getAttrKind() == attr::HLSLColumnMajor)
7890 if (
auto nullability = oldType->getImmediateNullability()) {
7891 if (!modifiedType->canHaveNullability()) {
7892 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7893 : TL.getModifiedLoc().getBeginLoc()),
7894 diag::err_nullability_nonpointer)
7911template <
typename Derived>
7915 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7916 if (InnerTy.isNull())
7919 Expr *OldCount = TL.getCountExpr();
7920 Expr *NewCount =
nullptr;
7922 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7923 if (CountResult.isInvalid())
7925 NewCount = CountResult.get();
7929 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7930 OldCount != NewCount) {
7933 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7940template <
typename Derived>
7945 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7946 if (InnerTy.isNull())
7950 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7952 InnerTy, OldTy->getLateParsedAttribute());
7960template <
typename Derived>
7964 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7967template <
typename Derived>
7970 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7971 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7972 if (InnerTy.isNull())
7976 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7988template <
typename Derived>
7992 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7994 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7995 if (WrappedTy.isNull())
7999 QualType OldContainedTy = oldType->getContainedType();
8001 if (!OldContainedTy.isNull()) {
8002 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
8003 if (!oldContainedTSI)
8004 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
8006 ContainedTSI = getDerived().TransformType(oldContainedTSI);
8009 ContainedTy = ContainedTSI->getType();
8012 HLSLAttributedResourceType::Attributes Attrs = oldType->getAttrs();
8013 if (Attrs.SampleCountExpr) {
8015 getDerived().TransformExpr(Attrs.SampleCountExpr);
8016 if (SampleCountResult.isInvalid())
8018 Attrs.SampleCountExpr = SampleCountResult.get();
8022 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
8023 ContainedTy != oldType->getContainedType() ||
8024 Attrs.SampleCountExpr != oldType->getSampleCountExpr()) {
8026 ContainedTy, Attrs);
8032 NewTL.setContainedTypeSourceInfo(ContainedTSI);
8036template <
typename Derived>
8040 return TL.getType();
8043template<
typename Derived>
8047 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8052 if (getDerived().AlwaysRebuild() ||
8053 Inner != TL.getInnerLoc().getType()) {
8054 Result = getDerived().RebuildParenType(Inner);
8061 NewTL.setRParenLoc(TL.getRParenLoc());
8065template <
typename Derived>
8069 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8074 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
8076 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
8086template<
typename Derived>
8087QualType TreeTransform<Derived>::TransformDependentNameType(
8089 return TransformDependentNameType(TLB, TL,
false);
8092template <
typename Derived>
8093QualType TreeTransform<Derived>::TransformDependentNameType(
8096 const DependentNameType *
T = TL.getTypePtr();
8100 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
8101 QualifierLoc, ObjectType, UnqualLookup);
8105 assert((ObjectType.isNull() && !UnqualLookup) &&
8106 "must be transformed by TransformNestedNameSpecifierLoc");
8110 = getDerived().RebuildDependentNameType(
T->getKeyword(),
8111 TL.getElaboratedKeywordLoc(),
8122 NewTL.setQualifierLoc(QualifierLoc);
8123 NewTL.setNameLoc(TL.getNameLoc());
8127 NewTL.setTemplateNameLoc(TL.getNameLoc());
8128 NewTL.setQualifierLoc(QualifierLoc);
8131 QualifierLoc, TL.getNameLoc());
8134 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
8138 NewTL.setQualifierLoc(QualifierLoc);
8139 NewTL.setNameLoc(TL.getNameLoc());
8144template<
typename Derived>
8148 = getDerived().TransformType(TLB, TL.getPatternLoc());
8149 if (Pattern.isNull())
8153 if (getDerived().AlwaysRebuild() ||
8154 Pattern != TL.getPatternLoc().getType()) {
8155 Result = getDerived().RebuildPackExpansionType(Pattern,
8156 TL.getPatternLoc().getSourceRange(),
8157 TL.getEllipsisLoc(),
8158 TL.getTypePtr()->getNumExpansions());
8168template<
typename Derived>
8173 TLB.pushFullCopy(TL);
8174 return TL.getType();
8177template<
typename Derived>
8181 const ObjCTypeParamType *
T = TL.getTypePtr();
8183 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
8188 if (getDerived().AlwaysRebuild() ||
8189 OTP !=
T->getDecl()) {
8190 Result = getDerived().RebuildObjCTypeParamType(
8191 OTP, TL.getProtocolLAngleLoc(),
8192 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8193 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8199 if (TL.getNumProtocols()) {
8200 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8201 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8202 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8203 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8208template<
typename Derived>
8213 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8214 if (BaseType.isNull())
8217 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8221 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8223 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8224 QualType TypeArg = TypeArgInfo->getType();
8229 const auto *PackExpansion = PackExpansionLoc.getType()
8230 ->castAs<PackExpansionType>();
8234 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8238 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8239 bool Expand =
false;
8240 bool RetainExpansion =
false;
8241 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8242 if (getDerived().TryExpandParameterPacks(
8243 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8244 Unexpanded,
true, Expand,
8245 RetainExpansion, NumExpansions))
8255 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8256 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8258 if (NewPatternType.isNull())
8262 NewPatternType, NumExpansions);
8264 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8265 NewTypeArgInfos.push_back(
8266 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8272 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8276 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8278 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8280 if (NewTypeArg.isNull())
8283 NewTypeArgInfos.push_back(
8284 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8291 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8293 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8294 if (NewTypeArg.isNull())
8298 if (NewTypeArg == TypeArg) {
8299 NewTypeArgInfos.push_back(TypeArgInfo);
8303 NewTypeArgInfos.push_back(
8304 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8309 if (getDerived().AlwaysRebuild() || AnyChanged) {
8311 Result = getDerived().RebuildObjCObjectType(
8312 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8313 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8314 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8315 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8323 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8324 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8325 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8326 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8327 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8328 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8329 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8330 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8334template<
typename Derived>
8338 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8339 if (PointeeType.isNull())
8343 if (getDerived().AlwaysRebuild() ||
8344 PointeeType != TL.getPointeeLoc().getType()) {
8345 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8359template<
typename Derived>
8365template<
typename Derived>
8368 return getDerived().TransformCompoundStmt(S,
false);
8371template<
typename Derived>
8378 getSema().resetFPOptions(
8381 bool SubStmtInvalid =
false;
8382 bool SubStmtChanged =
false;
8384 for (
auto *B : S->
body()) {
8386 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8387 : StmtDiscardKind::Discarded);
8389 if (
Result.isInvalid()) {
8396 SubStmtInvalid =
true;
8400 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8401 Statements.push_back(
Result.getAs<Stmt>());
8407 if (!getDerived().AlwaysRebuild() &&
8411 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8417template<
typename Derived>
8426 LHS = getDerived().TransformExpr(S->getLHS());
8428 if (LHS.isInvalid())
8432 RHS = getDerived().TransformExpr(S->getRHS());
8434 if (RHS.isInvalid())
8441 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8443 S->getEllipsisLoc(),
8446 if (Case.isInvalid())
8451 getDerived().TransformStmt(S->getSubStmt());
8452 if (SubStmt.isInvalid())
8456 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8459template <
typename Derived>
8463 getDerived().TransformStmt(S->getSubStmt());
8464 if (SubStmt.isInvalid())
8468 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8472template<
typename Derived>
8475 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8476 if (SubStmt.isInvalid())
8479 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8487 if (LD == S->getDecl())
8488 S->getDecl()->setStmt(
nullptr);
8491 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8496template <
typename Derived>
8501 switch (R->getKind()) {
8505 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8506#include "clang/Basic/AttrList.inc"
8511template <
typename Derived>
8518 switch (R->getKind()) {
8522 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8523#include "clang/Basic/AttrList.inc"
8528template <
typename Derived>
8531 StmtDiscardKind SDK) {
8536 bool AttrsChanged =
false;
8540 for (
const auto *I : S->
getAttrs()) {
8542 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8543 AttrsChanged |= (I != R);
8556 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8560template<
typename Derived>
8565 if (
Init.isInvalid())
8569 if (!S->isConsteval()) {
8571 Cond = getDerived().TransformCondition(
8572 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8575 if (Cond.isInvalid())
8580 std::optional<bool> ConstexprConditionValue;
8581 if (S->isConstexpr())
8586 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8590 S->isNonNegatedConsteval());
8592 Then = getDerived().TransformStmt(S->getThen());
8593 if (Then.isInvalid())
8599 Then =
new (getSema().Context)
8600 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8605 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8609 S->isNegatedConsteval());
8611 Else = getDerived().TransformStmt(S->getElse());
8612 if (Else.isInvalid())
8614 }
else if (S->getElse() && ConstexprConditionValue &&
8615 *ConstexprConditionValue) {
8619 Else =
new (getSema().Context)
8620 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8623 if (!getDerived().AlwaysRebuild() &&
8624 Init.get() == S->getInit() &&
8625 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8626 Then.get() == S->getThen() &&
8627 Else.get() == S->getElse())
8630 return getDerived().RebuildIfStmt(
8631 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8632 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8635template<
typename Derived>
8640 if (
Init.isInvalid())
8645 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8647 if (Cond.isInvalid())
8652 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8653 Init.get(), Cond, S->getRParenLoc());
8658 StmtResult Body = getDerived().TransformStmt(S->getBody());
8661 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8665template<
typename Derived>
8670 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8672 if (Cond.isInvalid())
8681 StmtResult Body = getDerived().TransformStmt(S->getBody());
8682 if (Body.isInvalid())
8685 if (!getDerived().AlwaysRebuild() &&
8686 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8687 Body.get() == S->getBody())
8690 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8691 Cond, S->getRParenLoc(), Body.get());
8694template<
typename Derived>
8703 StmtResult Body = getDerived().TransformStmt(S->getBody());
8704 if (Body.isInvalid())
8708 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8709 if (Cond.isInvalid())
8712 if (!getDerived().AlwaysRebuild() &&
8713 Cond.get() == S->getCond() &&
8714 Body.get() == S->getBody())
8717 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8718 S->getWhileLoc(), Cond.get(),
8722template<
typename Derived>
8725 if (getSema().getLangOpts().getOpenMPVersion())
8726 getSema().OpenMP().startOpenMPLoop();
8730 if (
Init.isInvalid())
8735 if (getSema().getLangOpts().getOpenMPVersion() &&
Init.isUsable())
8736 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8741 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8743 if (Cond.isInvalid())
8748 if (
Inc.isInvalid())
8752 if (S->getInc() && !FullInc.get())
8759 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8760 Cond.get().second, S->getInc(),
Inc.get());
8763 StmtResult Body = getDerived().TransformStmt(S->getBody());
8764 if (Body.isInvalid())
8769 if (!getDerived().AlwaysRebuild() &&
8770 Init.get() == S->getInit() &&
8771 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8772 Inc.get() == S->getInc() &&
8773 Body.get() == S->getBody())
8776 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8777 Init.get(), Cond, FullInc,
8778 S->getRParenLoc(), Body.get());
8781template<
typename Derived>
8784 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8790 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8794template<
typename Derived>
8802 if (!getDerived().AlwaysRebuild() &&
8803 Target.get() == S->getTarget())
8806 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8810template<
typename Derived>
8816 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8825template<
typename Derived>
8831 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8840template <
typename Derived>
8848template<
typename Derived>
8858 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8861template<
typename Derived>
8864 bool DeclChanged =
false;
8867 for (
auto *D : S->decls()) {
8868 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8872 if (Transformed != D)
8876 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8877 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8878 LSI->ContainsUnexpandedParameterPack |=
8879 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8881 LSI->ContainsUnexpandedParameterPack |=
8884 .getTypeDeclType(TD)
8885 ->containsUnexpandedParameterPack();
8888 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8889 LSI->ContainsUnexpandedParameterPack |=
8890 VD->getType()->containsUnexpandedParameterPack();
8893 Decls.push_back(Transformed);
8896 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8899 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8902template<
typename Derived>
8912 bool ExprsChanged =
false;
8914 auto RebuildString = [&](
Expr *E) {
8919 ExprsChanged =
true;
8926 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8927 Names.push_back(S->getOutputIdentifier(I));
8933 Constraints.push_back(
Result.get());
8936 Expr *OutputExpr = S->getOutputExpr(I);
8937 Result = getDerived().TransformExpr(OutputExpr);
8941 ExprsChanged |=
Result.get() != OutputExpr;
8943 Exprs.push_back(
Result.get());
8947 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8948 Names.push_back(S->getInputIdentifier(I));
8954 Constraints.push_back(
Result.get());
8957 Expr *InputExpr = S->getInputExpr(I);
8958 Result = getDerived().TransformExpr(InputExpr);
8962 ExprsChanged |=
Result.get() != InputExpr;
8964 Exprs.push_back(
Result.get());
8968 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8969 Names.push_back(S->getLabelIdentifier(I));
8974 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8975 Exprs.push_back(
Result.get());
8979 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8983 Clobbers.push_back(
Result.get());
8986 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8987 if (AsmString.isInvalid())
8990 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8993 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8994 S->isVolatile(), S->getNumOutputs(),
8995 S->getNumInputs(), Names.data(),
8996 Constraints, Exprs, AsmString.get(),
8997 Clobbers, S->getNumLabels(),
9001template<
typename Derived>
9006 bool HadError =
false, HadChange =
false;
9010 TransformedExprs.reserve(SrcExprs.size());
9011 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
9013 if (!
Result.isUsable()) {
9016 HadChange |= (
Result.get() != SrcExprs[i]);
9017 TransformedExprs.push_back(
Result.get());
9022 if (!HadChange && !getDerived().AlwaysRebuild())
9025 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
9026 AsmToks, S->getAsmString(),
9027 S->getNumOutputs(), S->getNumInputs(),
9028 S->getAllConstraints(), S->getClobbers(),
9029 TransformedExprs, S->getEndLoc());
9033template<
typename Derived>
9038 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
9039 ScopeInfo->NeedsCoroutineSuspends &&
9040 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
9041 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
9042 "expected clean scope info");
9046 ScopeInfo->setNeedsCoroutineSuspends(
false);
9059 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
9060 ScopeInfo->CoroutinePromise = Promise;
9065 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
9066 if (InitSuspend.isInvalid())
9069 getDerived().TransformStmt(S->getFinalSuspendStmt());
9070 if (FinalSuspend.isInvalid() ||
9073 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
9076 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
9077 if (BodyRes.isInvalid())
9081 if (Builder.isInvalid())
9084 Expr *ReturnObject = S->getReturnValueInit();
9085 assert(ReturnObject &&
"the return object is expected to be valid");
9086 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
9088 if (Res.isInvalid())
9090 Builder.ReturnValue = Res.get();
9095 if (S->hasDependentPromiseType()) {
9098 if (!Promise->getType()->isDependentType()) {
9099 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
9100 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
9101 "these nodes should not have been built yet");
9102 if (!Builder.buildDependentStatements())
9106 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
9107 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
9108 if (Res.isInvalid())
9110 Builder.OnFallthrough = Res.get();
9113 if (
auto *OnException = S->getExceptionHandler()) {
9114 StmtResult Res = getDerived().TransformStmt(OnException);
9115 if (Res.isInvalid())
9117 Builder.OnException = Res.get();
9120 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
9121 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
9122 if (Res.isInvalid())
9124 Builder.ReturnStmtOnAllocFailure = Res.get();
9128 assert(S->getAllocate() && S->getDeallocate() &&
9129 "allocation and deallocation calls must already be built");
9130 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
9131 if (AllocRes.isInvalid())
9133 Builder.Allocate = AllocRes.get();
9135 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
9136 if (DeallocRes.isInvalid())
9138 Builder.Deallocate = DeallocRes.get();
9140 if (
auto *ResultDecl = S->getResultDecl()) {
9141 StmtResult Res = getDerived().TransformStmt(ResultDecl);
9142 if (Res.isInvalid())
9144 Builder.ResultDecl = Res.get();
9149 if (Res.isInvalid())
9151 Builder.ReturnStmt = Res.get();
9155 return getDerived().RebuildCoroutineBodyStmt(Builder);
9158template<
typename Derived>
9168 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9172template <
typename Derived>
9185 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9186 getSema().getCurScope(), E->getKeywordLoc());
9190 return getDerived().RebuildCoawaitExpr(
9191 E->getKeywordLoc(),
Operand.get(),
9195template <
typename Derived>
9198 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9200 if (OperandResult.isInvalid())
9204 E->getOperatorCoawaitLookup());
9211 return getDerived().RebuildDependentCoawaitExpr(
9212 E->getKeywordLoc(), OperandResult.get(),
9216template<
typename Derived>
9226 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9231template<
typename Derived>
9235 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9236 if (TryBody.isInvalid())
9240 bool AnyCatchChanged =
false;
9242 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9243 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9244 if (Catch.isInvalid())
9246 if (Catch.get() != S->getCatchStmt(I))
9247 AnyCatchChanged =
true;
9248 CatchStmts.push_back(Catch.get());
9253 if (S->getFinallyStmt()) {
9254 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9255 if (Finally.isInvalid())
9260 if (!getDerived().AlwaysRebuild() &&
9261 TryBody.get() == S->getTryBody() &&
9263 Finally.get() == S->getFinallyStmt())
9267 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9268 CatchStmts, Finally.get());
9271template<
typename Derived>
9276 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9278 if (FromVar->getTypeSourceInfo()) {
9279 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9286 T = TSInfo->getType();
9288 T = getDerived().TransformType(FromVar->getType());
9293 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9298 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9299 if (Body.isInvalid())
9302 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9307template<
typename Derived>
9311 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9312 if (Body.isInvalid())
9316 if (!getDerived().AlwaysRebuild() &&
9317 Body.get() == S->getFinallyBody())
9321 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9325template<
typename Derived>
9329 if (S->getThrowExpr()) {
9330 Operand = getDerived().TransformExpr(S->getThrowExpr());
9335 if (!getDerived().AlwaysRebuild() &&
9336 Operand.get() == S->getThrowExpr())
9339 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9342template<
typename Derived>
9351 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9357 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9358 if (Body.isInvalid())
9362 if (!getDerived().AlwaysRebuild() &&
9363 Object.get() == S->getSynchExpr() &&
9364 Body.get() == S->getSynchBody())
9368 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9369 Object.get(), Body.get());
9372template<
typename Derived>
9377 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9378 if (Body.isInvalid())
9382 if (!getDerived().AlwaysRebuild() &&
9383 Body.get() == S->getSubStmt())
9387 return getDerived().RebuildObjCAutoreleasePoolStmt(
9388 S->getAtLoc(), Body.get());
9391template<
typename Derived>
9396 StmtResult Element = getDerived().TransformStmt(
9397 S->getElement(), StmtDiscardKind::NotDiscarded);
9398 if (Element.isInvalid())
9402 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9403 if (Collection.isInvalid())
9407 StmtResult Body = getDerived().TransformStmt(S->getBody());
9408 if (Body.isInvalid())
9412 if (!getDerived().AlwaysRebuild() &&
9413 Element.get() == S->getElement() &&
9414 Collection.get() == S->getCollection() &&
9415 Body.get() == S->getBody())
9419 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9426template <
typename Derived>
9430 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9432 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9436 Var = getDerived().RebuildExceptionDecl(
9437 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9438 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9439 if (!Var || Var->isInvalidDecl())
9444 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9445 if (Handler.isInvalid())
9448 if (!getDerived().AlwaysRebuild() && !Var &&
9449 Handler.get() == S->getHandlerBlock())
9452 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9455template <
typename Derived>
9458 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9459 if (TryBlock.isInvalid())
9463 bool HandlerChanged =
false;
9465 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9466 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9467 if (Handler.isInvalid())
9470 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9471 Handlers.push_back(Handler.getAs<
Stmt>());
9474 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9476 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9480 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9484template<
typename Derived>
9495 auto &LastRecord = getSema().currentEvaluationContext();
9496 LastRecord.InLifetimeExtendingContext =
true;
9497 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9500 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9501 if (
Init.isInvalid())
9505 if (
Range.isInvalid())
9510 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9511 auto ForRangeLifetimeExtendTemps =
9512 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9514 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9515 if (Begin.isInvalid())
9517 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9518 if (End.isInvalid())
9521 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9522 if (Cond.isInvalid())
9526 if (Cond.isInvalid())
9532 if (
Inc.isInvalid())
9537 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9538 if (LoopVar.isInvalid())
9542 if (getDerived().AlwaysRebuild() ||
9543 Init.get() != S->getInit() ||
9544 Range.get() != S->getRangeStmt() ||
9545 Begin.get() != S->getBeginStmt() ||
9546 End.get() != S->getEndStmt() ||
9547 Cond.get() != S->getCond() ||
9548 Inc.get() != S->getInc() ||
9549 LoopVar.get() != S->getLoopVarStmt()) {
9550 NewStmt = getDerived().RebuildCXXForRangeStmt(
9551 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9552 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9553 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9554 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9556 getSema().ActOnInitializerError(
9567 StmtResult Body = getDerived().TransformStmt(S->getBody());
9568 if (Body.isInvalid())
9575 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9576 NewStmt = getDerived().RebuildCXXForRangeStmt(
9577 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9578 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9579 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9580 if (NewStmt.isInvalid())
9584 if (NewStmt.get() == S)
9587 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9590template <
typename Derived>
9596 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9597 if (!ESD || ESD->isInvalidDecl())
9604 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9607 return getDerived().TransformStmt(SubStmt);
9626 if (S->isDependent() || S->isIterating()) {
9632 if (S->isDependent()) {
9638 ExpansionInitializer =
9639 getDerived().TransformExpr(S->getExpansionInitializer());
9640 if (ExpansionInitializer.isInvalid())
9642 }
else if (S->isIterating()) {
9643 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9644 if (
Range.isInvalid())
9648 ExpansionInitializer =
9651 LifetimeExtendTemps =
9656 if (S->isEnumerating()) {
9658 getDerived().TransformStmt(S->getExpansionVarStmt());
9659 if (ExpansionVar.isInvalid())
9664 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9665 }
else if (S->isIterating()) {
9666 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9667 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9668 if (Begin.isInvalid() || Iter.isInvalid())
9675 getDerived().TransformStmt(S->getExpansionVarStmt());
9676 if (ExpansionVar.isInvalid())
9682 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9686 NewPattern->getRangeVar(), LifetimeExtendTemps);
9687 }
else if (S->isDependent()) {
9689 getDerived().TransformStmt(S->getExpansionVarStmt());
9690 if (ExpansionVar.isInvalid())
9695 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9696 S->getRParenLoc(), LifetimeExtendTemps);
9698 if (Res.isInvalid())
9708 llvm_unreachable(
"destructuring pattern should never be instantiated");
9711 StmtResult Body = getDerived().TransformStmt(S->getBody());
9712 if (Body.isInvalid())
9718template <
typename Derived>
9721 bool SubStmtChanged =
false;
9724 for (
Stmt *OldDS : OldStmts) {
9725 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9726 if (NewDS.isInvalid())
9729 SubStmtChanged |= NewDS.get() != OldDS;
9730 NewStmts.push_back(NewDS.get());
9737 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9738 if (!ESD || ESD->isInvalidDecl())
9752 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9755 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9763 if (TransformStmts(Instantiations, S->getInstantiations()))
9766 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9770 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9771 S->shouldApplyLifetimeExtensionToPreamble());
9774template <
typename Derived>
9778 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9779 if (
Range.isInvalid() || Idx.isInvalid())
9782 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9783 Idx.get() == E->getIndexExpr())
9790template<
typename Derived>
9796 if (S->getQualifierLoc()) {
9798 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9805 if (NameInfo.getName()) {
9806 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9807 if (!NameInfo.getName())
9812 if (!getDerived().AlwaysRebuild() &&
9813 QualifierLoc == S->getQualifierLoc() &&
9814 NameInfo.getName() == S->getNameInfo().getName())
9819 SS.
Adopt(QualifierLoc);
9821 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9823 if (S->isIfExists())
9826 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9829 if (S->isIfNotExists())
9832 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9843 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9844 if (SubStmt.isInvalid())
9852 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9859template<
typename Derived>
9863 if (E->getQualifierLoc()) {
9865 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9871 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9876 if (
Base.isInvalid())
9882 QualifierLoc, E->getMemberLoc());
9885template <
typename Derived>
9889 if (BaseRes.isInvalid())
9891 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9892 if (IdxRes.isInvalid())
9895 if (!getDerived().AlwaysRebuild() &&
9896 BaseRes.get() == E->getBase() &&
9897 IdxRes.get() == E->getIdx())
9900 return getDerived().RebuildArraySubscriptExpr(
9901 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9904template <
typename Derived>
9906 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9907 if (TryBlock.isInvalid())
9910 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9911 if (Handler.isInvalid())
9914 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9915 Handler.get() == S->getHandler())
9918 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9919 TryBlock.get(), Handler.get());
9922template <
typename Derived>
9925 if (
Block.isInvalid())
9928 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9931template <
typename Derived>
9933 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9934 if (FilterExpr.isInvalid())
9938 if (
Block.isInvalid())
9941 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9945template <
typename Derived>
9953template<
typename Derived>
9963template <
typename Derived>
9965TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9969 return getDerived().TransformStmt(L->getLoopStmt());
9972template <
typename Derived>
9979 TClauses.reserve(Clauses.size());
9983 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9985 getDerived().getSema().OpenMP().EndOpenMPClause();
9987 TClauses.push_back(Clause);
9989 TClauses.push_back(
nullptr);
9993 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9994 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9995 D->getDirectiveKind(),
10001 if (D->getDirectiveKind() == OMPD_atomic ||
10002 D->getDirectiveKind() == OMPD_critical ||
10003 D->getDirectiveKind() == OMPD_section ||
10004 D->getDirectiveKind() == OMPD_master)
10005 CS = D->getAssociatedStmt();
10007 CS = D->getRawStmt();
10010 getSema().getLangOpts().OpenMPIRBuilder)
10014 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10019 if (TClauses.size() != Clauses.size()) {
10025 if (D->getDirectiveKind() == OMPD_critical) {
10027 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
10030 if (D->getDirectiveKind() == OMPD_cancellation_point) {
10032 }
else if (D->getDirectiveKind() == OMPD_cancel) {
10036 return getDerived().RebuildOMPExecutableDirective(
10037 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
10038 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
10046template <
typename Derived>
10053 TClauses.reserve(Clauses.size());
10056 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
10058 getDerived().getSema().OpenMP().EndOpenMPClause();
10060 TClauses.push_back(Clause);
10062 TClauses.push_back(
nullptr);
10066 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10067 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10068 D->getDirectiveKind(),
10073 assert(D->getDirectiveKind() == OMPD_assume &&
10074 "Unexpected informational directive");
10075 Stmt *CS = D->getAssociatedStmt();
10079 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10083 if (TClauses.size() != Clauses.size())
10088 return getDerived().RebuildOMPInformationalDirective(
10089 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
10090 D->getBeginLoc(), D->getEndLoc());
10093template <
typename Derived>
10103 Variants.push_back(NewV.
get());
10110 OldTraitInfos = OldTraitInfos.drop_back();
10113 OMPTraitInfo &TI = getSema().getASTContext().getNewOMPTraitInfo();
10115 auto TransformScoreOrCondition = [&](Expr *&E,
bool IsScore) {
10118 EnterExpressionEvaluationContext Ctx(
10122 ExprResult ER = getDerived().TransformExpr(E);
10123 if (!ER.isUsable())
10130 TraitInfos.push_back(&TI);
10133 return getDerived().RebuildOMPMetaDirective(D->getBeginLoc(), D->getEndLoc(),
10134 TraitInfos, Variants);
10137template <
typename Derived>
10141 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10142 OMPD_parallel, 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_simd, DirName,
nullptr, D->getBeginLoc());
10154 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10155 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159template <
typename Derived>
10163 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10164 D->getDirectiveKind(), 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 D->getDirectiveKind(), 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 D->getDirectiveKind(), 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 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10198 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10199 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10203template <
typename Derived>
10205 OMPInterchangeDirective *D) {
10207 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10208 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10209 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10210 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10214template <
typename Derived>
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10219 D->getDirectiveKind(), 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 D->getDirectiveKind(), 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 D->getDirectiveKind(), 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_for, 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_for_simd, 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_sections, 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_section, DirName,
nullptr, D->getBeginLoc());
10286 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10287 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10291template <
typename Derived>
10295 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10296 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10297 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10298 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10302template <
typename Derived>
10306 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10307 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10308 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10309 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10313template <
typename Derived>
10317 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10318 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10319 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10320 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10324template <
typename Derived>
10329 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10330 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10334template <
typename Derived>
10336 OMPParallelForDirective *D) {
10338 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10339 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10340 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10341 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10345template <
typename Derived>
10347 OMPParallelForSimdDirective *D) {
10349 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10350 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10351 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10352 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10356template <
typename Derived>
10358 OMPParallelMasterDirective *D) {
10360 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10361 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10362 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10363 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10367template <
typename Derived>
10369 OMPParallelMaskedDirective *D) {
10371 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10372 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10373 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10374 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10378template <
typename Derived>
10380 OMPParallelSectionsDirective *D) {
10382 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10383 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10384 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10385 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10389template <
typename Derived>
10393 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10394 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10395 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10396 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10400template <
typename Derived>
10402 OMPTaskyieldDirective *D) {
10404 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10405 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10406 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10407 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10411template <
typename Derived>
10415 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10416 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10417 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10418 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10422template <
typename Derived>
10426 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10427 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10428 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10429 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10433template <
typename Derived>
10437 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10438 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10439 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10440 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10444template <
typename Derived>
10448 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10449 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10450 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10451 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10455template <
typename Derived>
10457 OMPTaskgroupDirective *D) {
10459 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10460 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10461 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10462 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10466template <
typename Derived>
10470 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10471 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10472 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10473 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10477template <
typename Derived>
10481 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10482 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10483 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10484 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10488template <
typename Derived>
10492 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10493 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10494 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10495 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10499template <
typename Derived>
10501 OMPOrderedStandaloneDirective *D) {
10503 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10504 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10505 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10506 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10510template <
typename Derived>
10512 OMPOrderedBlockAssocDirective *D) {
10514 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10515 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10516 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10517 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10521template <
typename Derived>
10525 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10526 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10527 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10528 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10532template <
typename Derived>
10536 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10537 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10538 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10539 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10543template <
typename Derived>
10545 OMPTargetDataDirective *D) {
10547 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10548 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10549 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10550 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10554template <
typename Derived>
10556 OMPTargetEnterDataDirective *D) {
10558 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10559 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10560 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10561 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10565template <
typename Derived>
10567 OMPTargetExitDataDirective *D) {
10569 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10570 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10571 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10572 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10576template <
typename Derived>
10578 OMPTargetParallelDirective *D) {
10580 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10581 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10582 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10583 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10587template <
typename Derived>
10589 OMPTargetParallelForDirective *D) {
10591 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10592 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10593 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10594 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10598template <
typename Derived>
10600 OMPTargetUpdateDirective *D) {
10602 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10603 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10604 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10605 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10609template <
typename Derived>
10613 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10614 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10615 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10616 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10620template <
typename Derived>
10622 OMPCancellationPointDirective *D) {
10624 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10625 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10626 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10627 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10631template <
typename Derived>
10635 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10636 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10637 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10638 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10642template <
typename Derived>
10646 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10647 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10648 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10649 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10653template <
typename Derived>
10655 OMPTaskLoopSimdDirective *D) {
10657 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10658 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10659 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10660 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10664template <
typename Derived>
10666 OMPMasterTaskLoopDirective *D) {
10668 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10669 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10670 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10671 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10675template <
typename Derived>
10677 OMPMaskedTaskLoopDirective *D) {
10679 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10680 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10681 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10682 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10686template <
typename Derived>
10688 OMPMasterTaskLoopSimdDirective *D) {
10690 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10691 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10692 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10693 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10697template <
typename Derived>
10699 OMPMaskedTaskLoopSimdDirective *D) {
10701 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10702 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10703 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10704 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10708template <
typename Derived>
10710 OMPParallelMasterTaskLoopDirective *D) {
10712 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10713 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10714 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10715 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10719template <
typename Derived>
10721 OMPParallelMaskedTaskLoopDirective *D) {
10723 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10724 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10725 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10726 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10730template <
typename Derived>
10733 OMPParallelMasterTaskLoopSimdDirective *D) {
10735 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10736 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10737 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10738 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10742template <
typename Derived>
10745 OMPParallelMaskedTaskLoopSimdDirective *D) {
10747 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10748 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10749 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10750 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10754template <
typename Derived>
10756 OMPDistributeDirective *D) {
10758 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10759 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10760 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10761 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10765template <
typename Derived>
10767 OMPDistributeParallelForDirective *D) {
10769 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10770 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10771 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10772 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10776template <
typename Derived>
10779 OMPDistributeParallelForSimdDirective *D) {
10781 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10782 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10783 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10784 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10788template <
typename Derived>
10790 OMPDistributeSimdDirective *D) {
10792 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10793 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10794 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10795 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10799template <
typename Derived>
10801 OMPTargetParallelForSimdDirective *D) {
10803 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10804 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10805 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10806 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10810template <
typename Derived>
10812 OMPTargetSimdDirective *D) {
10814 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10815 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10816 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10817 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10821template <
typename Derived>
10823 OMPTeamsDistributeDirective *D) {
10825 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10826 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10827 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10828 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10832template <
typename Derived>
10834 OMPTeamsDistributeSimdDirective *D) {
10836 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10837 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10838 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10839 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10843template <
typename Derived>
10845 OMPTeamsDistributeParallelForSimdDirective *D) {
10847 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10848 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10850 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10851 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10855template <
typename Derived>
10857 OMPTeamsDistributeParallelForDirective *D) {
10859 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10860 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10861 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10862 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10866template <
typename Derived>
10868 OMPTargetTeamsDirective *D) {
10870 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10871 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10872 auto Res = getDerived().TransformOMPExecutableDirective(D);
10873 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10877template <
typename Derived>
10879 OMPTargetTeamsDistributeDirective *D) {
10881 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10882 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10883 auto Res = getDerived().TransformOMPExecutableDirective(D);
10884 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10888template <
typename Derived>
10891 OMPTargetTeamsDistributeParallelForDirective *D) {
10893 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10894 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10896 auto Res = getDerived().TransformOMPExecutableDirective(D);
10897 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10901template <
typename Derived>
10904 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10906 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10907 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10909 auto Res = getDerived().TransformOMPExecutableDirective(D);
10910 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10914template <
typename Derived>
10917 OMPTargetTeamsDistributeSimdDirective *D) {
10919 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10920 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10921 auto Res = getDerived().TransformOMPExecutableDirective(D);
10922 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10926template <
typename Derived>
10930 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10931 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10932 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10933 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10937template <
typename Derived>
10941 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10942 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10943 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10944 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10948template <
typename Derived>
10952 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10953 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10954 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10955 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10959template <
typename Derived>
10961 OMPGenericLoopDirective *D) {
10963 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10964 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10965 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10966 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10970template <
typename Derived>
10972 OMPTeamsGenericLoopDirective *D) {
10974 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10975 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10976 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10977 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10981template <
typename Derived>
10983 OMPTargetTeamsGenericLoopDirective *D) {
10985 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10986 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10987 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10988 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10992template <
typename Derived>
10994 OMPParallelGenericLoopDirective *D) {
10996 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10997 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10998 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10999 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11003template <
typename Derived>
11006 OMPTargetParallelGenericLoopDirective *D) {
11008 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11009 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
11010 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11011 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11015template <
typename Derived>
11017 OMPTargetGenericLoopDirective *D) {
11019 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
11020 OMPD_target_loop, DirName,
nullptr, D->getBeginLoc());
11021 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
11022 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
11029template <
typename Derived>
11031 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11032 if (Cond.isInvalid())
11034 return getDerived().RebuildOMPIfClause(
11035 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11036 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
11039template <
typename Derived>
11041 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11042 if (Cond.isInvalid())
11044 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
11045 C->getLParenLoc(),
C->getEndLoc());
11048template <
typename Derived>
11052 Vars.reserve(
C->varlist_size());
11053 for (
auto *
VE :
C->varlist()) {
11055 if (EVar.isInvalid())
11057 Vars.push_back(EVar.get());
11059 Expr *DimsModifierExpr =
C->getDimsModifierExpr();
11060 if (DimsModifierExpr) {
11062 if (EVar.isInvalid())
11064 DimsModifierExpr = EVar.get();
11066 return getDerived().RebuildOMPNumThreadsClause(
11067 Vars,
C->getPrescriptivenessModifier(),
11068 C->getPrescriptivenessModifierLoc(),
C->getDimsModifier(),
11069 DimsModifierExpr,
C->getDimsModifierLoc(),
C->getBeginLoc(),
11070 C->getLParenLoc(),
C->getEndLoc());
11073template <
typename Derived>
11076 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
11079 return getDerived().RebuildOMPSafelenClause(
11080 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11083template <
typename Derived>
11086 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
11089 return getDerived().RebuildOMPAllocatorClause(
11090 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11093template <
typename Derived>
11096 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
11099 return getDerived().RebuildOMPSimdlenClause(
11100 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11103template <
typename Derived>
11106 TransformedSizes.reserve(
C->getNumSizes());
11108 for (
Expr *E :
C->getSizesRefs()) {
11110 TransformedSizes.push_back(
nullptr);
11119 TransformedSizes.push_back(
T.get());
11122 if (!Changed && !getDerived().AlwaysRebuild())
11124 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
11125 C->getLParenLoc(),
C->getEndLoc());
11128template <
typename Derived>
11132 TransformedCounts.reserve(
C->getNumCounts());
11133 for (
Expr *E :
C->getCountsRefs()) {
11135 TransformedCounts.push_back(
nullptr);
11142 TransformedCounts.push_back(
T.get());
11145 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
11146 C->getLParenLoc(),
C->getEndLoc(),
11147 C->getOmpFillIndex(),
C->getOmpFillLoc());
11150template <
typename Derived>
11154 TransformedArgs.reserve(
C->getNumLoops());
11156 for (
Expr *E :
C->getArgsRefs()) {
11158 TransformedArgs.push_back(
nullptr);
11167 TransformedArgs.push_back(
T.get());
11170 if (!Changed && !getDerived().AlwaysRebuild())
11172 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
11173 C->getLParenLoc(),
C->getEndLoc());
11176template <
typename Derived>
11178 if (!getDerived().AlwaysRebuild())
11180 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
11183template <
typename Derived>
11186 ExprResult T = getDerived().TransformExpr(
C->getFactor());
11189 Expr *Factor =
T.get();
11190 bool Changed = Factor !=
C->getFactor();
11192 if (!Changed && !getDerived().AlwaysRebuild())
11194 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
11198template <
typename Derived>
11200 ExprResult T = getDerived().TransformExpr(
C->getDepth());
11203 Expr *Depth =
T.get();
11204 bool Changed = Depth !=
C->getDepth();
11206 if (!Changed && !getDerived().AlwaysRebuild())
11208 return RebuildOMPDepthClause(Depth,
C->getBeginLoc(),
C->getLParenLoc(),
11212template <
typename Derived>
11215 ExprResult F = getDerived().TransformExpr(
C->getFirst());
11219 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
11220 if (Cn.isInvalid())
11224 Expr *Count = Cn.get();
11226 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
11229 if (!Changed && !getDerived().AlwaysRebuild())
11232 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
11233 C->getLParenLoc(),
C->getFirstLoc(),
11234 C->getCountLoc(),
C->getEndLoc());
11237template <
typename Derived>
11240 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
11243 return getDerived().RebuildOMPCollapseClause(
11244 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11247template <
typename Derived>
11251 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
11252 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11256template <
typename Derived>
11263template <
typename Derived>
11266 Expr *Impex =
C->getImpexType();
11267 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11269 if (TransformedImpex.isInvalid())
11272 return getDerived().RebuildOMPTransparentClause(
11273 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11277template <
typename Derived>
11281 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11282 C->getLParenLoc(),
C->getEndLoc());
11285template <
typename Derived>
11288 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11291 return getDerived().RebuildOMPScheduleClause(
11292 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11293 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11294 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11295 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11298template <
typename Derived>
11302 if (
auto *
Num =
C->getNumForLoops()) {
11303 E = getDerived().TransformExpr(
Num);
11307 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11308 C->getLParenLoc(), E.get());
11311template <
typename Derived>
11315 if (
Expr *Evt =
C->getEventHandler()) {
11316 E = getDerived().TransformExpr(Evt);
11320 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11321 C->getLParenLoc(),
C->getEndLoc());
11324template <
typename Derived>
11329 Cond = getDerived().TransformExpr(
Condition);
11330 if (Cond.isInvalid())
11333 return getDerived().RebuildOMPNowaitClause(Cond.get(),
C->getBeginLoc(),
11334 C->getLParenLoc(),
C->getEndLoc());
11337template <
typename Derived>
11344template <
typename Derived>
11351template <
typename Derived>
11357template <
typename Derived>
11363template <
typename Derived>
11370template <
typename Derived>
11372 OMPUpdateDependObjectsClause *
C) {
11377template <
typename Derived>
11384template <
typename Derived>
11391template <
typename Derived>
11397template <
typename Derived>
11403template <
typename Derived>
11405 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11408 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11409 C->getLParenLoc(),
C->getEndLoc());
11412template <
typename Derived>
11418template <
typename Derived>
11423template <
typename Derived>
11425 OMPNoOpenMPRoutinesClause *
C) {
11428template <
typename Derived>
11430 OMPNoOpenMPConstructsClause *
C) {
11433template <
typename Derived>
11435 OMPNoParallelismClause *
C) {
11439template <
typename Derived>
11446template <
typename Derived>
11453template <
typename Derived>
11460template <
typename Derived>
11467template <
typename Derived>
11474template <
typename Derived>
11480template <
typename Derived>
11487template <
typename Derived>
11493template <
typename Derived>
11500template <
typename Derived>
11502 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11503 if (IVR.isInvalid())
11507 for (OMPInitClause::PrefView P :
C->prefs()) {
11508 Expr *NewFr =
nullptr;
11510 ExprResult ER = getDerived().TransformExpr(P.Fr);
11511 if (ER.isInvalid())
11516 NewAttrs.reserve(P.Attrs.size());
11517 for (
Expr *A : P.Attrs) {
11518 ExprResult ER = getDerived().TransformExpr(A);
11519 if (ER.isInvalid())
11521 NewAttrs.push_back(ER.get());
11523 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11525 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11526 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11527 C->getBeginLoc(),
C->getLParenLoc(),
11528 C->getVarLoc(),
C->getEndLoc());
11531template <
typename Derived>
11533 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11534 if (ER.isInvalid())
11536 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11537 C->getLParenLoc(),
C->getVarLoc(),
11541template <
typename Derived>
11545 if (
Expr *IV =
C->getInteropVar()) {
11546 ER = getDerived().TransformExpr(IV);
11547 if (ER.isInvalid())
11550 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11551 C->getLParenLoc(),
C->getVarLoc(),
11555template <
typename Derived>
11558 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11559 if (Cond.isInvalid())
11561 return getDerived().RebuildOMPNovariantsClause(
11562 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11565template <
typename Derived>
11568 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11569 if (Cond.isInvalid())
11571 return getDerived().RebuildOMPNocontextClause(
11572 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11575template <
typename Derived>
11578 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11579 if (ThreadID.isInvalid())
11581 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11582 C->getLParenLoc(),
C->getEndLoc());
11585template <
typename Derived>
11587 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11590 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11591 C->getLParenLoc(),
C->getEndLoc());
11594template <
typename Derived>
11596 OMPUnifiedAddressClause *
C) {
11597 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11600template <
typename Derived>
11602 OMPUnifiedSharedMemoryClause *
C) {
11604 "unified_shared_memory clause cannot appear in dependent context");
11607template <
typename Derived>
11609 OMPReverseOffloadClause *
C) {
11610 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11613template <
typename Derived>
11615 OMPDynamicAllocatorsClause *
C) {
11617 "dynamic_allocators clause cannot appear in dependent context");
11620template <
typename Derived>
11622 OMPAtomicDefaultMemOrderClause *
C) {
11624 "atomic_default_mem_order clause cannot appear in dependent context");
11627template <
typename Derived>
11630 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11633template <
typename Derived>
11636 C->getBeginLoc(),
C->getLParenLoc(),
11640template <
typename Derived>
11644 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11645 C->getLParenLoc(),
C->getEndLoc());
11648template <
typename Derived>
11651 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11654 return getDerived().RebuildOMPMessageClause(
11655 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11658template <
typename Derived>
11662 Vars.reserve(
C->varlist_size());
11663 for (
auto *
VE :
C->varlist()) {
11665 if (EVar.isInvalid())
11667 Vars.push_back(EVar.get());
11669 return getDerived().RebuildOMPPrivateClause(
11670 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11673template <
typename Derived>
11675 OMPFirstprivateClause *
C) {
11677 Vars.reserve(
C->varlist_size());
11678 for (
auto *
VE :
C->varlist()) {
11680 if (EVar.isInvalid())
11682 Vars.push_back(EVar.get());
11684 return getDerived().RebuildOMPFirstprivateClause(
11685 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11688template <
typename Derived>
11692 Vars.reserve(
C->varlist_size());
11693 for (
auto *
VE :
C->varlist()) {
11695 if (EVar.isInvalid())
11697 Vars.push_back(EVar.get());
11699 return getDerived().RebuildOMPLastprivateClause(
11700 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11701 C->getLParenLoc(),
C->getEndLoc());
11704template <
typename Derived>
11708 Vars.reserve(
C->varlist_size());
11709 for (
auto *
VE :
C->varlist()) {
11711 if (EVar.isInvalid())
11713 Vars.push_back(EVar.get());
11715 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11716 C->getLParenLoc(),
C->getEndLoc());
11719template <
typename Derived>
11723 Vars.reserve(
C->varlist_size());
11724 for (
auto *
VE :
C->varlist()) {
11726 if (EVar.isInvalid())
11728 Vars.push_back(EVar.get());
11731 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11734 if (NameInfo.getName()) {
11735 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11736 if (!NameInfo.getName())
11742 for (
auto *E :
C->reduction_ops()) {
11747 for (
auto *D : ULE->decls()) {
11750 Decls.addDecl(InstD, InstD->getAccess());
11754 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11755 true, Decls.begin(), Decls.end(),
11758 UnresolvedReductions.push_back(
nullptr);
11760 return getDerived().RebuildOMPReductionClause(
11761 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11762 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11763 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11766template <
typename Derived>
11768 OMPTaskReductionClause *
C) {
11770 Vars.reserve(
C->varlist_size());
11771 for (
auto *
VE :
C->varlist()) {
11773 if (EVar.isInvalid())
11775 Vars.push_back(EVar.get());
11778 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11781 if (NameInfo.getName()) {
11782 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11783 if (!NameInfo.getName())
11789 for (
auto *E :
C->reduction_ops()) {
11794 for (
auto *D : ULE->decls()) {
11797 Decls.addDecl(InstD, InstD->getAccess());
11801 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11802 true, Decls.begin(), Decls.end(),
11805 UnresolvedReductions.push_back(
nullptr);
11807 return getDerived().RebuildOMPTaskReductionClause(
11808 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11809 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11812template <
typename Derived>
11816 Vars.reserve(
C->varlist_size());
11817 for (
auto *
VE :
C->varlist()) {
11819 if (EVar.isInvalid())
11821 Vars.push_back(EVar.get());
11824 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11827 if (NameInfo.getName()) {
11828 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11829 if (!NameInfo.getName())
11835 for (
auto *E :
C->reduction_ops()) {
11840 for (
auto *D : ULE->decls()) {
11843 Decls.addDecl(InstD, InstD->getAccess());
11847 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11848 true, Decls.begin(), Decls.end(),
11851 UnresolvedReductions.push_back(
nullptr);
11853 return getDerived().RebuildOMPInReductionClause(
11854 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11855 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11858template <
typename Derived>
11862 Vars.reserve(
C->varlist_size());
11863 for (
auto *
VE :
C->varlist()) {
11865 if (EVar.isInvalid())
11867 Vars.push_back(EVar.get());
11869 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11870 if (Step.isInvalid())
11872 return getDerived().RebuildOMPLinearClause(
11873 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11874 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11878template <
typename Derived>
11882 Vars.reserve(
C->varlist_size());
11883 for (
auto *
VE :
C->varlist()) {
11885 if (EVar.isInvalid())
11887 Vars.push_back(EVar.get());
11889 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11890 if (Alignment.isInvalid())
11892 return getDerived().RebuildOMPAlignedClause(
11893 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11894 C->getColonLoc(),
C->getEndLoc());
11897template <
typename Derived>
11901 Vars.reserve(
C->varlist_size());
11902 for (
auto *
VE :
C->varlist()) {
11904 if (EVar.isInvalid())
11906 Vars.push_back(EVar.get());
11908 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11909 C->getLParenLoc(),
C->getEndLoc());
11912template <
typename Derived>
11916 Vars.reserve(
C->varlist_size());
11917 for (
auto *
VE :
C->varlist()) {
11919 if (EVar.isInvalid())
11921 Vars.push_back(EVar.get());
11923 return getDerived().RebuildOMPCopyprivateClause(
11924 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11927template <
typename Derived>
11930 Vars.reserve(
C->varlist_size());
11931 for (
auto *
VE :
C->varlist()) {
11933 if (EVar.isInvalid())
11935 Vars.push_back(EVar.get());
11937 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11938 C->getLParenLoc(),
C->getEndLoc());
11941template <
typename Derived>
11944 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11947 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11948 C->getLParenLoc(),
C->getEndLoc());
11951template <
typename Derived>
11955 Expr *DepModifier =
C->getModifier();
11957 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11958 if (DepModRes.isInvalid())
11960 DepModifier = DepModRes.get();
11962 Vars.reserve(
C->varlist_size());
11963 for (
auto *
VE :
C->varlist()) {
11965 if (EVar.isInvalid())
11967 Vars.push_back(EVar.get());
11969 return getDerived().RebuildOMPDependClause(
11970 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11971 C->getOmpAllMemoryLoc()},
11972 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11975template <
typename Derived>
11978 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11981 return getDerived().RebuildOMPDeviceClause(
11982 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11983 C->getModifierLoc(),
C->getEndLoc());
11986template <
typename Derived,
class T>
11993 Vars.reserve(
C->varlist_size());
11994 for (
auto *
VE :
C->varlist()) {
11998 Vars.push_back(EVar.
get());
12002 if (
C->getMapperQualifierLoc()) {
12003 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
12004 C->getMapperQualifierLoc());
12008 MapperIdScopeSpec.
Adopt(QualifierLoc);
12009 MapperIdInfo =
C->getMapperIdInfo();
12010 if (MapperIdInfo.
getName()) {
12011 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
12017 for (
auto *E :
C->mapperlists()) {
12022 for (
auto *D : ULE->decls()) {
12025 Decls.addDecl(InstD, InstD->
getAccess());
12030 MapperIdInfo,
true, Decls.begin(), Decls.end(),
12033 UnresolvedMappers.push_back(
nullptr);
12039template <
typename Derived>
12041 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12043 Expr *IteratorModifier =
C->getIteratorModifier();
12044 if (IteratorModifier) {
12045 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12046 if (MapModRes.isInvalid())
12048 IteratorModifier = MapModRes.
get();
12054 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12056 return getDerived().RebuildOMPMapClause(
12057 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
12058 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
12059 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
12062template <
typename Derived>
12065 Expr *Allocator =
C->getAllocator();
12067 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
12068 if (AllocatorRes.isInvalid())
12070 Allocator = AllocatorRes.get();
12072 Expr *Alignment =
C->getAlignment();
12074 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
12075 if (AlignmentRes.isInvalid())
12077 Alignment = AlignmentRes.get();
12080 Vars.reserve(
C->varlist_size());
12081 for (
auto *
VE :
C->varlist()) {
12083 if (EVar.isInvalid())
12085 Vars.push_back(EVar.get());
12087 return getDerived().RebuildOMPAllocateClause(
12088 Allocator, Alignment,
C->getFirstAllocateModifier(),
12089 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
12090 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
12091 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
12094template <
typename Derived>
12098 Vars.reserve(
C->varlist_size());
12099 for (
auto *
VE :
C->varlist()) {
12101 if (EVar.isInvalid())
12103 Vars.push_back(EVar.get());
12105 Expr *ModifierExpr =
C->getModifierExpr();
12106 if (ModifierExpr) {
12108 if (EVar.isInvalid())
12110 ModifierExpr = EVar.get();
12112 return getDerived().RebuildOMPNumTeamsClause(
12113 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12115 C->getLParenLoc(),
C->getEndLoc());
12118template <
typename Derived>
12122 Vars.reserve(
C->varlist_size());
12123 for (
auto *
VE :
C->varlist()) {
12125 if (EVar.isInvalid())
12127 Vars.push_back(EVar.get());
12129 Expr *ModifierExpr =
C->getModifierExpr();
12130 if (ModifierExpr) {
12132 if (EVar.isInvalid())
12134 ModifierExpr = EVar.get();
12136 return getDerived().RebuildOMPThreadLimitClause(
12137 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12138 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12141template <
typename Derived>
12144 ExprResult E = getDerived().TransformExpr(
C->getPriority());
12147 return getDerived().RebuildOMPPriorityClause(
12148 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12151template <
typename Derived>
12154 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
12157 return getDerived().RebuildOMPGrainsizeClause(
12158 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12159 C->getModifierLoc(),
C->getEndLoc());
12162template <
typename Derived>
12165 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
12168 return getDerived().RebuildOMPNumTasksClause(
12169 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12170 C->getModifierLoc(),
C->getEndLoc());
12173template <
typename Derived>
12175 ExprResult E = getDerived().TransformExpr(
C->getHint());
12178 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
12179 C->getLParenLoc(),
C->getEndLoc());
12182template <
typename Derived>
12184 OMPDistScheduleClause *
C) {
12185 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
12188 return getDerived().RebuildOMPDistScheduleClause(
12189 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12190 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
12193template <
typename Derived>
12199 C->getDefaultmapKind(),
12202 C->getDefaultmapModifierLoc(),
12203 C->getDefaultmapKindLoc(),
12207template <
typename Derived>
12211 Expr *IteratorModifier =
C->getIteratorModifier();
12212 if (IteratorModifier) {
12213 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12214 if (MapModRes.isInvalid())
12216 IteratorModifier = MapModRes.get();
12222 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12224 return getDerived().RebuildOMPToClause(
12225 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12226 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12227 UnresolvedMappers);
12230template <
typename Derived>
12234 Expr *IteratorModifier =
C->getIteratorModifier();
12235 if (IteratorModifier) {
12236 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12237 if (MapModRes.isInvalid())
12239 IteratorModifier = MapModRes.get();
12245 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12247 return getDerived().RebuildOMPFromClause(
12248 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12249 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12250 UnresolvedMappers);
12253template <
typename Derived>
12255 OMPUseDevicePtrClause *
C) {
12257 Vars.reserve(
C->varlist_size());
12258 for (
auto *
VE :
C->varlist()) {
12260 if (EVar.isInvalid())
12262 Vars.push_back(EVar.get());
12265 return getDerived().RebuildOMPUseDevicePtrClause(
12266 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12269template <
typename Derived>
12271 OMPUseDeviceAddrClause *
C) {
12273 Vars.reserve(
C->varlist_size());
12274 for (
auto *
VE :
C->varlist()) {
12276 if (EVar.isInvalid())
12278 Vars.push_back(EVar.get());
12281 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12284template <
typename Derived>
12288 Vars.reserve(
C->varlist_size());
12289 for (
auto *
VE :
C->varlist()) {
12291 if (EVar.isInvalid())
12293 Vars.push_back(EVar.get());
12296 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12299template <
typename Derived>
12301 OMPHasDeviceAddrClause *
C) {
12303 Vars.reserve(
C->varlist_size());
12304 for (
auto *
VE :
C->varlist()) {
12306 if (EVar.isInvalid())
12308 Vars.push_back(EVar.get());
12311 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12314template <
typename Derived>
12318 Vars.reserve(
C->varlist_size());
12319 for (
auto *
VE :
C->varlist()) {
12321 if (EVar.isInvalid())
12323 Vars.push_back(EVar.get());
12325 return getDerived().RebuildOMPNontemporalClause(
12326 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12329template <
typename Derived>
12333 Vars.reserve(
C->varlist_size());
12334 for (
auto *
VE :
C->varlist()) {
12336 if (EVar.isInvalid())
12338 Vars.push_back(EVar.get());
12340 return getDerived().RebuildOMPInclusiveClause(
12341 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12344template <
typename Derived>
12348 Vars.reserve(
C->varlist_size());
12349 for (
auto *
VE :
C->varlist()) {
12351 if (EVar.isInvalid())
12353 Vars.push_back(EVar.get());
12355 return getDerived().RebuildOMPExclusiveClause(
12356 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12359template <
typename Derived>
12361 OMPUsesAllocatorsClause *
C) {
12363 Data.reserve(
C->getNumberOfAllocators());
12364 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12365 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12367 if (Allocator.isInvalid())
12371 AllocatorTraits = getDerived().TransformExpr(AT);
12372 if (AllocatorTraits.isInvalid())
12376 NewD.Allocator = Allocator.get();
12377 NewD.AllocatorTraits = AllocatorTraits.get();
12381 return getDerived().RebuildOMPUsesAllocatorsClause(
12382 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12385template <
typename Derived>
12389 Locators.reserve(
C->varlist_size());
12391 if (
Expr *Modifier =
C->getModifier()) {
12392 ModifierRes = getDerived().TransformExpr(Modifier);
12393 if (ModifierRes.isInvalid())
12396 for (
Expr *E :
C->varlist()) {
12397 ExprResult Locator = getDerived().TransformExpr(E);
12398 if (Locator.isInvalid())
12400 Locators.push_back(Locator.get());
12402 return getDerived().RebuildOMPAffinityClause(
12403 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12404 ModifierRes.get(), Locators);
12407template <
typename Derived>
12410 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12411 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12414template <
typename Derived>
12417 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12418 C->getLParenLoc(),
C->getEndLoc());
12421template <
typename Derived>
12423 OMPXDynCGroupMemClause *
C) {
12425 if (
Size.isInvalid())
12427 return getDerived().RebuildOMPXDynCGroupMemClause(
12428 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12431template <
typename Derived>
12433 OMPDynGroupprivateClause *
C) {
12435 if (
Size.isInvalid())
12437 return getDerived().RebuildOMPDynGroupprivateClause(
12438 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12439 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12440 C->getDynGroupprivateModifierLoc(),
12441 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12444template <
typename Derived>
12448 Vars.reserve(
C->varlist_size());
12449 for (
auto *
VE :
C->varlist()) {
12451 if (EVar.isInvalid())
12453 Vars.push_back(EVar.get());
12455 return getDerived().RebuildOMPDoacrossClause(
12456 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12457 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12460template <
typename Derived>
12464 for (
auto *A :
C->getAttrs())
12465 NewAttrs.push_back(getDerived().TransformAttr(A));
12466 return getDerived().RebuildOMPXAttributeClause(
12467 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12470template <
typename Derived>
12479template <
typename Derived>
12480class OpenACCClauseTransform final
12482 TreeTransform<Derived> &Self;
12483 ArrayRef<const OpenACCClause *> ExistingClauses;
12484 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12485 OpenACCClause *NewClause =
nullptr;
12488 ExprResult Res = Self.TransformExpr(VarRef);
12490 if (!Res.isUsable())
12493 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12494 ParsedClause.getClauseKind(),
12500 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12501 llvm::SmallVector<Expr *> InstantiatedVarList;
12502 for (Expr *CurVar : VarList) {
12505 if (VarRef.isUsable())
12506 InstantiatedVarList.push_back(VarRef.get());
12509 return InstantiatedVarList;
12513 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12514 ArrayRef<const OpenACCClause *> ExistingClauses,
12515 SemaOpenACC::OpenACCParsedClause &PC)
12516 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12518 OpenACCClause *CreatedClause()
const {
return NewClause; }
12520#define VISIT_CLAUSE(CLAUSE_NAME) \
12521 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12522#include "clang/Basic/OpenACCClauses.def"
12525template <
typename Derived>
12526void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12528 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12531 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12532 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12533 ParsedClause.getEndLoc());
12536template <
typename Derived>
12537void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12538 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12539 assert(Cond &&
"If constructed with invalid Condition");
12543 if (Res.isInvalid() || !Res.get().second)
12546 ParsedClause.setConditionDetails(Res.get().second);
12549 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12550 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12551 ParsedClause.getEndLoc());
12554template <
typename Derived>
12555void OpenACCClauseTransform<Derived>::VisitSelfClause(
12561 for (
Expr *CurVar :
C.getVarList()) {
12564 if (!Res.isUsable())
12567 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12568 ParsedClause.getClauseKind(),
12571 if (Res.isUsable())
12572 InstantiatedVarList.push_back(Res.get());
12575 ParsedClause.setVarListDetails(InstantiatedVarList,
12579 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12580 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12581 ParsedClause.getEndLoc());
12584 if (
C.hasConditionExpr()) {
12585 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12587 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
12590 if (Res.isInvalid() || !Res.get().second)
12593 ParsedClause.setConditionDetails(Res.get().second);
12597 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12598 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12599 ParsedClause.getEndLoc());
12603template <
typename Derived>
12604void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12608 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12611 if (!Res.isUsable())
12616 C.getBeginLoc(), Res.get());
12617 if (!Res.isUsable())
12620 InstantiatedIntExprs.push_back(Res.get());
12623 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12625 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12626 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12627 ParsedClause.getEndLoc());
12630template <
typename Derived>
12631void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12636 for (
const auto [RefExpr, InitRecipe] :
12637 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12640 if (VarRef.isUsable()) {
12641 InstantiatedVarList.push_back(VarRef.get());
12645 if (InitRecipe.isSet())
12646 InitRecipes.push_back(InitRecipe);
12648 InitRecipes.push_back(
12649 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12652 ParsedClause.setVarListDetails(InstantiatedVarList,
12656 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12657 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12658 ParsedClause.getEndLoc());
12661template <
typename Derived>
12662void OpenACCClauseTransform<Derived>::VisitHostClause(
12664 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12668 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12669 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12670 ParsedClause.getEndLoc());
12673template <
typename Derived>
12674void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12676 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12680 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12681 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12682 ParsedClause.getEndLoc());
12685template <
typename Derived>
12686void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12691 for (
const auto [RefExpr, InitRecipe] :
12692 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12695 if (VarRef.isUsable()) {
12696 InstantiatedVarList.push_back(VarRef.get());
12700 if (InitRecipe.isSet())
12701 InitRecipes.push_back(InitRecipe);
12703 InitRecipes.push_back(
12704 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12708 ParsedClause.setVarListDetails(InstantiatedVarList,
12712 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12713 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12714 ParsedClause.getEndLoc());
12717template <
typename Derived>
12718void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12720 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12724 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12725 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12726 ParsedClause.getEndLoc());
12729template <
typename Derived>
12730void OpenACCClauseTransform<Derived>::VisitPresentClause(
12732 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12736 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12737 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12738 ParsedClause.getEndLoc());
12741template <
typename Derived>
12742void OpenACCClauseTransform<Derived>::VisitCopyClause(
12744 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12745 C.getModifierList());
12748 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12749 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12750 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12751 ParsedClause.getEndLoc());
12754template <
typename Derived>
12755void OpenACCClauseTransform<Derived>::VisitLinkClause(
12757 llvm_unreachable(
"link clause not valid unless a decl transform");
12760template <
typename Derived>
12761void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12763 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12765template <
typename Derived>
12766void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12768 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12770template <
typename Derived>
12771void OpenACCClauseTransform<Derived>::VisitBindClause(
12773 llvm_unreachable(
"bind clause not valid unless a decl transform");
12776template <
typename Derived>
12777void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12779 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12780 C.getModifierList());
12783 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12784 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12785 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12786 ParsedClause.getEndLoc());
12789template <
typename Derived>
12790void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12792 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12793 C.getModifierList());
12796 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12797 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12798 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12799 ParsedClause.getEndLoc());
12802template <
typename Derived>
12803void OpenACCClauseTransform<Derived>::VisitCreateClause(
12805 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12806 C.getModifierList());
12809 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12810 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12811 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12812 ParsedClause.getEndLoc());
12814template <
typename Derived>
12815void OpenACCClauseTransform<Derived>::VisitAttachClause(
12820 llvm::erase_if(VarList, [&](
Expr *E) {
12821 return Self.getSema().OpenACC().CheckVarIsPointerType(
12827 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12828 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12829 ParsedClause.getEndLoc());
12832template <
typename Derived>
12833void OpenACCClauseTransform<Derived>::VisitDetachClause(
12838 llvm::erase_if(VarList, [&](
Expr *E) {
12839 return Self.getSema().OpenACC().CheckVarIsPointerType(
12845 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12846 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12847 ParsedClause.getEndLoc());
12850template <
typename Derived>
12851void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12853 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12856 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12857 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12858 ParsedClause.getEndLoc());
12861template <
typename Derived>
12862void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12864 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12867 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12868 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12869 ParsedClause.getEndLoc());
12872template <
typename Derived>
12873void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12878 llvm::erase_if(VarList, [&](
Expr *E) {
12879 return Self.getSema().OpenACC().CheckVarIsPointerType(
12885 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12886 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12887 ParsedClause.getEndLoc());
12890template <
typename Derived>
12891void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12893 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12894 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12897 if (!Res.isUsable())
12902 C.getBeginLoc(), Res.get());
12903 if (!Res.isUsable())
12906 ParsedClause.setIntExprDetails(Res.get());
12908 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12909 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12910 ParsedClause.getEndLoc());
12913template <
typename Derived>
12914void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12916 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12917 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12920 if (!Res.isUsable())
12925 C.getBeginLoc(), Res.get());
12926 if (!Res.isUsable())
12929 ParsedClause.setIntExprDetails(Res.get());
12931 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12932 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12933 ParsedClause.getEndLoc());
12936template <
typename Derived>
12937void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12939 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12940 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12943 if (!Res.isUsable())
12948 C.getBeginLoc(), Res.get());
12949 if (!Res.isUsable())
12952 ParsedClause.setIntExprDetails(Res.get());
12954 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12955 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12956 ParsedClause.getEndLoc());
12959template <
typename Derived>
12960void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12962 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12963 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12966 if (!Res.isUsable())
12971 C.getBeginLoc(), Res.get());
12972 if (!Res.isUsable())
12975 ParsedClause.setIntExprDetails(Res.get());
12977 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12978 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12979 ParsedClause.getEndLoc());
12982template <
typename Derived>
12983void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12985 if (
C.hasIntExpr()) {
12987 if (!Res.isUsable())
12992 C.getBeginLoc(), Res.get());
12993 if (!Res.isUsable())
12995 ParsedClause.setIntExprDetails(Res.get());
12999 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13000 ParsedClause.getLParenLoc(),
13001 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13003 ParsedClause.getEndLoc());
13006template <
typename Derived>
13007void OpenACCClauseTransform<Derived>::VisitWorkerClause(
13009 if (
C.hasIntExpr()) {
13014 if (!Res.isUsable())
13019 C.getBeginLoc(), Res.get());
13020 if (!Res.isUsable())
13022 ParsedClause.setIntExprDetails(Res.get());
13026 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13027 ParsedClause.getLParenLoc(),
13028 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13030 ParsedClause.getEndLoc());
13033template <
typename Derived>
13034void OpenACCClauseTransform<Derived>::VisitVectorClause(
13036 if (
C.hasIntExpr()) {
13041 if (!Res.isUsable())
13046 C.getBeginLoc(), Res.get());
13047 if (!Res.isUsable())
13049 ParsedClause.setIntExprDetails(Res.get());
13053 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13054 ParsedClause.getLParenLoc(),
13055 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
13057 ParsedClause.getEndLoc());
13060template <
typename Derived>
13061void OpenACCClauseTransform<Derived>::VisitWaitClause(
13063 if (
C.hasExprs()) {
13064 Expr *DevNumExpr =
nullptr;
13068 if (
C.getDevNumExpr()) {
13070 if (!Res.isUsable())
13074 C.getBeginLoc(), Res.get());
13075 if (!Res.isUsable())
13078 DevNumExpr = Res.get();
13082 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
13084 if (!Res.isUsable())
13088 C.getBeginLoc(), Res.get());
13089 if (!Res.isUsable())
13092 InstantiatedQueueIdExprs.push_back(Res.get());
13095 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
13096 std::move(InstantiatedQueueIdExprs));
13100 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13101 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
13102 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
13103 ParsedClause.getEndLoc());
13106template <
typename Derived>
13107void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
13111 Self.getSema().getASTContext(),
C.getClauseKind(),
13112 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13113 C.getArchitectures(), ParsedClause.getEndLoc());
13116template <
typename Derived>
13117void OpenACCClauseTransform<Derived>::VisitAutoClause(
13121 ParsedClause.getBeginLoc(),
13122 ParsedClause.getEndLoc());
13125template <
typename Derived>
13126void OpenACCClauseTransform<Derived>::VisitIndependentClause(
13129 ParsedClause.getBeginLoc(),
13130 ParsedClause.getEndLoc());
13133template <
typename Derived>
13134void OpenACCClauseTransform<Derived>::VisitSeqClause(
13137 ParsedClause.getBeginLoc(),
13138 ParsedClause.getEndLoc());
13140template <
typename Derived>
13141void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
13144 ParsedClause.getBeginLoc(),
13145 ParsedClause.getEndLoc());
13148template <
typename Derived>
13149void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
13152 ParsedClause.getBeginLoc(),
13153 ParsedClause.getEndLoc());
13156template <
typename Derived>
13157void OpenACCClauseTransform<Derived>::VisitReductionClause(
13163 for (
const auto [Var, OrigRecipe] :
13164 llvm::zip(TransformedVars,
C.getRecipes())) {
13166 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
13167 if (Res.isUsable()) {
13168 ValidVars.push_back(Res.get());
13170 if (OrigRecipe.isSet())
13171 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
13173 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
13174 C.getReductionOp(), Res.get()));
13178 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
13179 ExistingClauses, ParsedClause.getDirectiveKind(),
13180 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13181 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
13184template <
typename Derived>
13185void OpenACCClauseTransform<Derived>::VisitCollapseClause(
13187 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
13188 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
13192 if (!NewLoopCount.isUsable())
13195 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
13197 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
13201 if (!NewLoopCount.isUsable())
13205 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
13209 if (!NewLoopCount.isUsable())
13212 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
13214 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13215 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
13216 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
13219template <
typename Derived>
13220void OpenACCClauseTransform<Derived>::VisitTileClause(
13225 for (
Expr *E :
C.getSizeExprs()) {
13228 if (!NewSizeExpr.isUsable())
13231 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
13233 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
13237 if (!NewSizeExpr.isUsable())
13240 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
13242 if (!NewSizeExpr.isUsable())
13244 TransformedExprs.push_back(NewSizeExpr.get());
13247 ParsedClause.setIntExprDetails(TransformedExprs);
13249 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13250 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
13251 ParsedClause.getEndLoc());
13253template <
typename Derived>
13254void OpenACCClauseTransform<Derived>::VisitGangClause(
13259 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13261 if (!ER.isUsable())
13264 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13265 ParsedClause.getDirectiveKind(),
13266 C.getExpr(I).first, ER.get());
13267 if (!ER.isUsable())
13269 TransformedGangKinds.push_back(
C.getExpr(I).first);
13270 TransformedIntExprs.push_back(ER.get());
13273 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13274 ParsedClause.getDirectiveKind(), ExistingClauses,
13275 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13276 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13279template <
typename Derived>
13280OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13285 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13286 ParsedClause.setEndLoc(OldClause->getEndLoc());
13288 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13289 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13291 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13293 Transform.Visit(OldClause);
13295 return Transform.CreatedClause();
13298template <
typename Derived>
13300TreeTransform<Derived>::TransformOpenACCClauseList(
13303 for (
const auto *Clause : OldClauses) {
13304 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13305 TransformedClauses, DirKind, Clause))
13306 TransformedClauses.push_back(TransformedClause);
13308 return TransformedClauses;
13311template <
typename Derived>
13314 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13317 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13320 if (getSema().OpenACC().ActOnStartStmtDirective(
13321 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13326 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13327 C->clauses(), TransformedClauses);
13328 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13329 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13330 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13332 return getDerived().RebuildOpenACCComputeConstruct(
13333 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13334 C->getEndLoc(), TransformedClauses, StrBlock);
13337template <
typename Derived>
13341 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13344 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13347 if (getSema().OpenACC().ActOnStartStmtDirective(
13348 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13353 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13354 C->clauses(), TransformedClauses);
13356 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13357 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13359 return getDerived().RebuildOpenACCLoopConstruct(
13360 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13361 TransformedClauses,
Loop);
13364template <
typename Derived>
13366 OpenACCCombinedConstruct *
C) {
13367 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13370 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13373 if (getSema().OpenACC().ActOnStartStmtDirective(
13374 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13379 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13380 C->clauses(), TransformedClauses);
13382 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13383 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13385 return getDerived().RebuildOpenACCCombinedConstruct(
13386 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13387 C->getEndLoc(), TransformedClauses,
Loop);
13390template <
typename Derived>
13393 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13396 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13398 if (getSema().OpenACC().ActOnStartStmtDirective(
13399 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13403 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13404 C->clauses(), TransformedClauses);
13405 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13406 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13407 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13409 return getDerived().RebuildOpenACCDataConstruct(
13410 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13411 TransformedClauses, StrBlock);
13414template <
typename Derived>
13416 OpenACCEnterDataConstruct *
C) {
13417 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13420 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13422 if (getSema().OpenACC().ActOnStartStmtDirective(
13423 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13426 return getDerived().RebuildOpenACCEnterDataConstruct(
13427 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13428 TransformedClauses);
13431template <
typename Derived>
13433 OpenACCExitDataConstruct *
C) {
13434 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13437 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13439 if (getSema().OpenACC().ActOnStartStmtDirective(
13440 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13443 return getDerived().RebuildOpenACCExitDataConstruct(
13444 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13445 TransformedClauses);
13448template <
typename Derived>
13450 OpenACCHostDataConstruct *
C) {
13451 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13454 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13456 if (getSema().OpenACC().ActOnStartStmtDirective(
13457 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13461 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13462 C->clauses(), TransformedClauses);
13463 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13464 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13465 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13467 return getDerived().RebuildOpenACCHostDataConstruct(
13468 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13469 TransformedClauses, StrBlock);
13472template <
typename Derived>
13475 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13478 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13480 if (getSema().OpenACC().ActOnStartStmtDirective(
13481 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13484 return getDerived().RebuildOpenACCInitConstruct(
13485 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13486 TransformedClauses);
13489template <
typename Derived>
13491 OpenACCShutdownConstruct *
C) {
13492 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13495 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13497 if (getSema().OpenACC().ActOnStartStmtDirective(
13498 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13501 return getDerived().RebuildOpenACCShutdownConstruct(
13502 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13503 TransformedClauses);
13505template <
typename Derived>
13508 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13511 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13513 if (getSema().OpenACC().ActOnStartStmtDirective(
13514 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13517 return getDerived().RebuildOpenACCSetConstruct(
13518 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13519 TransformedClauses);
13522template <
typename Derived>
13524 OpenACCUpdateConstruct *
C) {
13525 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13528 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13530 if (getSema().OpenACC().ActOnStartStmtDirective(
13531 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13534 return getDerived().RebuildOpenACCUpdateConstruct(
13535 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13536 TransformedClauses);
13539template <
typename Derived>
13542 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13545 if (
C->hasDevNumExpr()) {
13546 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13548 if (DevNumExpr.isUsable())
13549 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13551 C->getBeginLoc(), DevNumExpr.get());
13556 for (
Expr *QE :
C->getQueueIdExprs()) {
13557 assert(QE &&
"Null queue id expr?");
13558 ExprResult NewEQ = getDerived().TransformExpr(QE);
13560 if (!NewEQ.isUsable())
13564 C->getBeginLoc(), NewEQ.get());
13565 if (NewEQ.isUsable())
13566 QueueIdExprs.push_back(NewEQ.get());
13570 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13573 if (getSema().OpenACC().ActOnStartStmtDirective(
13574 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13577 return getDerived().RebuildOpenACCWaitConstruct(
13578 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13579 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13580 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13582template <
typename Derived>
13584 OpenACCCacheConstruct *
C) {
13585 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13588 for (
Expr *Var :
C->getVarList()) {
13589 assert(Var &&
"Null var listexpr?");
13591 ExprResult NewVar = getDerived().TransformExpr(Var);
13593 if (!NewVar.isUsable())
13596 NewVar = getSema().OpenACC().ActOnVar(
13598 if (!NewVar.isUsable())
13601 TransformedVarList.push_back(NewVar.get());
13604 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13605 C->getBeginLoc(), {}))
13608 return getDerived().RebuildOpenACCCacheConstruct(
13609 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13610 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13614template <
typename Derived>
13616 OpenACCAtomicConstruct *
C) {
13617 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13620 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13623 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13624 C->getBeginLoc(), {}))
13629 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13631 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13632 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13633 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13636 return getDerived().RebuildOpenACCAtomicConstruct(
13637 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13638 C->getEndLoc(), TransformedClauses, AssocStmt);
13641template <
typename Derived>
13644 if (getDerived().AlwaysRebuild())
13653template<
typename Derived>
13656 return TransformExpr(E->getSubExpr());
13659template <
typename Derived>
13662 if (!E->isTypeDependent())
13665 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13670 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13673 return getDerived().RebuildSYCLUniqueStableNameExpr(
13674 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13677template <
typename Derived>
13681 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13682 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13685 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13686 if (IdExpr.isInvalid())
13689 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13690 if (Body.isInvalid())
13696 if (SR.isInvalid())
13702template <
typename Derived>
13706 switch (E->getKind()) {
13715 llvm_unreachable(
"A null reflection should not reach here");
13718 assert(
false &&
"unknown or unimplemented reflection entities");
13722template<
typename Derived>
13725 if (!E->isTypeDependent())
13729 E->getIdentKind());
13732template<
typename Derived>
13736 if (E->getQualifierLoc()) {
13738 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13744 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13746 if (!ND || ND->isInvalidDecl())
13750 if (E->getFoundDecl() != E->getDecl()) {
13751 Found = cast_or_null<NamedDecl>(
13752 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13758 if (NameInfo.getName()) {
13759 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13760 if (!NameInfo.getName())
13764 if (!getDerived().AlwaysRebuild() &&
13765 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13766 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13767 Found == E->getFoundDecl() &&
13768 NameInfo.getName() == E->getDecl()->getDeclName() &&
13769 !E->hasExplicitTemplateArgs()) {
13779 if (E->hasExplicitTemplateArgs()) {
13780 TemplateArgs = &TransArgs;
13781 TransArgs.setLAngleLoc(E->getLAngleLoc());
13782 TransArgs.setRAngleLoc(E->getRAngleLoc());
13783 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13784 E->getNumTemplateArgs(),
13789 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13790 Found, TemplateArgs);
13793template<
typename Derived>
13799template <
typename Derived>
13805template<
typename Derived>
13811template<
typename Derived>
13817template<
typename Derived>
13823template<
typename Derived>
13829template<
typename Derived>
13832 return getDerived().TransformCallExpr(E);
13835template<
typename Derived>
13840 if (E->isExprPredicate())
13841 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13843 ControllingType = getDerived().TransformType(E->getControllingType());
13845 if (ControllingExpr.isInvalid() && !ControllingType)
13856 AssocTypes.push_back(AssocType);
13858 AssocTypes.push_back(
nullptr);
13862 getDerived().TransformExpr(Assoc.getAssociationExpr());
13863 if (AssocExpr.isInvalid())
13865 AssocExprs.push_back(AssocExpr.get());
13868 if (!ControllingType)
13869 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13870 E->getDefaultLoc(),
13872 ControllingExpr.get(),
13875 return getDerived().RebuildGenericSelectionExpr(
13876 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13877 ControllingType, AssocTypes, AssocExprs);
13880template<
typename Derived>
13883 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13884 if (SubExpr.isInvalid())
13887 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13890 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13897template<
typename Derived>
13901 return getDerived().TransformDependentScopeDeclRefExpr(
13902 DRE,
true,
nullptr);
13904 return getDerived().TransformUnresolvedLookupExpr(
13910template<
typename Derived>
13915 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13921 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13929template<
typename Derived>
13931TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13933 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13943 bool ExprChanged =
false;
13945 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13946 const OffsetOfNode &ON = E->getComponent(I);
13947 switch (ON.getKind()) {
13949 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13950 ExprResult Index = getDerived().TransformExpr(FromIndex);
13951 if (Index.isInvalid())
13954 ExprChanged = ExprChanged || Index.get() != FromIndex;
13957 AD.setRBracketLoc(ON.getEndLoc());
13958 Desig.AddDesignator(AD);
13970 Desig.AddDesignator(
13982 if (!getDerived().AlwaysRebuild() &&
13983 Type == E->getTypeSourceInfo() &&
13988 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13989 E->getRParenLoc());
13992template<
typename Derived>
13995 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13996 "opaque value expression requires transformation");
14000template <
typename Derived>
14004 for (
Expr *
C : E->subExpressions()) {
14006 if (NewC.isInvalid())
14012 if (!getDerived().AlwaysRebuild() && !Changed)
14014 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
14018template<
typename Derived>
14028 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
14029 if (result.isInvalid())
return ExprError();
14034 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
14040template<
typename Derived>
14044 if (E->isArgumentType()) {
14051 if (!getDerived().AlwaysRebuild() && OldT == NewT)
14054 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
14056 E->getSourceRange());
14070 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
14072 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
14073 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
14074 PE, DRE,
false, &RecoveryTSI);
14076 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
14079 return getDerived().RebuildUnaryExprOrTypeTrait(
14080 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
14081 }
else if (SubExpr.isInvalid())
14084 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
14087 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
14088 E->getOperatorLoc(),
14090 E->getSourceRange());
14093template<
typename Derived>
14096 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14097 if (LHS.isInvalid())
14100 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14101 if (RHS.isInvalid())
14105 if (!getDerived().AlwaysRebuild() &&
14106 LHS.get() == E->getLHS() &&
14107 RHS.get() == E->getRHS())
14110 return getDerived().RebuildArraySubscriptExpr(
14112 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
14115template <
typename Derived>
14119 if (
Base.isInvalid())
14122 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14123 if (RowIdx.isInvalid())
14126 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14127 RowIdx.get() == E->getRowIdx())
14130 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
14131 E->getRBracketLoc());
14134template <
typename Derived>
14138 if (
Base.isInvalid())
14141 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14142 if (RowIdx.isInvalid())
14145 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
14146 if (ColumnIdx.isInvalid())
14149 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14150 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
14153 return getDerived().RebuildMatrixSubscriptExpr(
14154 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
14157template <
typename Derived>
14161 if (
Base.isInvalid())
14165 if (E->getLowerBound()) {
14166 LowerBound = getDerived().TransformExpr(E->getLowerBound());
14167 if (LowerBound.isInvalid())
14172 if (E->getLength()) {
14173 Length = getDerived().TransformExpr(E->getLength());
14174 if (Length.isInvalid())
14179 if (E->isOMPArraySection()) {
14180 if (
Expr *Str = E->getStride()) {
14181 Stride = getDerived().TransformExpr(Str);
14182 if (Stride.isInvalid())
14187 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14188 LowerBound.get() == E->getLowerBound() &&
14189 Length.get() == E->getLength() &&
14190 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
14193 return getDerived().RebuildArraySectionExpr(
14194 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
14195 LowerBound.get(), E->getColonLocFirst(),
14196 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
14197 Length.get(), Stride.get(), E->getRBracketLoc());
14200template <
typename Derived>
14204 if (
Base.isInvalid())
14208 bool ErrorFound =
false;
14209 for (
Expr *
Dim : E->getDimensions()) {
14211 if (DimRes.isInvalid()) {
14215 Dims.push_back(DimRes.get());
14220 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
14221 E->getRParenLoc(), Dims,
14222 E->getBracketsRanges());
14225template <
typename Derived>
14228 unsigned NumIterators = E->numOfIterators();
14231 bool ErrorFound =
false;
14232 bool NeedToRebuild = getDerived().AlwaysRebuild();
14233 for (
unsigned I = 0; I < NumIterators; ++I) {
14235 Data[I].DeclIdent = D->getIdentifier();
14236 Data[I].DeclIdentLoc = D->getLocation();
14237 if (D->getLocation() == D->getBeginLoc()) {
14239 "Implicit type must be int.");
14241 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
14242 QualType DeclTy = getDerived().TransformType(D->getType());
14249 ErrorFound = ErrorFound ||
14250 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
14251 !
Data[I].Type.get().isNull())) ||
14252 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
14255 Data[I].Range.Begin = Begin.get();
14256 Data[I].Range.End = End.get();
14257 Data[I].Range.Step = Step.get();
14258 Data[I].AssignLoc = E->getAssignLoc(I);
14259 Data[I].ColonLoc = E->getColonLoc(I);
14260 Data[I].SecColonLoc = E->getSecondColonLoc(I);
14263 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
14264 D->getType().getTypePtrOrNull()) ||
14270 if (!NeedToRebuild)
14273 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14274 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14275 if (!Res.isUsable())
14278 for (
unsigned I = 0; I < NumIterators; ++I)
14279 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14280 IE->getIteratorDecl(I));
14284template<
typename Derived>
14293 bool ArgChanged =
false;
14295 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14299 if (!getDerived().AlwaysRebuild() &&
14300 Callee.get() == E->getCallee() &&
14306 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14309 if (E->hasStoredFPFeatures()) {
14311 getSema().CurFPFeatures =
14313 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14316 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14318 E->getRParenLoc());
14321template<
typename Derived>
14325 if (
Base.isInvalid())
14329 if (E->hasQualifier()) {
14331 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14339 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14340 E->getMemberDecl()));
14344 NamedDecl *FoundDecl = E->getFoundDecl();
14345 if (FoundDecl == E->getMemberDecl()) {
14348 FoundDecl = cast_or_null<NamedDecl>(
14349 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14354 if (!getDerived().AlwaysRebuild() &&
14355 Base.get() == E->getBase() &&
14356 QualifierLoc == E->getQualifierLoc() &&
14357 Member == E->getMemberDecl() &&
14358 FoundDecl == E->getFoundDecl() &&
14359 !E->hasExplicitTemplateArgs()) {
14364 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14374 if (E->hasExplicitTemplateArgs()) {
14375 TransArgs.setLAngleLoc(E->getLAngleLoc());
14376 TransArgs.setRAngleLoc(E->getRAngleLoc());
14377 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14378 E->getNumTemplateArgs(),
14391 NamedDecl *FirstQualifierInScope =
nullptr;
14393 if (MemberNameInfo.getName()) {
14394 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14395 if (!MemberNameInfo.getName())
14399 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14406 (E->hasExplicitTemplateArgs()
14407 ? &TransArgs :
nullptr),
14408 FirstQualifierInScope);
14411template<
typename Derived>
14414 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14415 if (LHS.isInvalid())
14419 getDerived().TransformInitializer(E->getRHS(),
false);
14420 if (RHS.isInvalid())
14423 if (!getDerived().AlwaysRebuild() &&
14424 LHS.get() == E->getLHS() &&
14425 RHS.get() == E->getRHS())
14428 if (E->isCompoundAssignmentOp())
14430 return getDerived().RebuildBinaryOperator(
14431 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14434 getSema().CurFPFeatures =
14435 NewOverrides.applyOverrides(getSema().getLangOpts());
14436 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14437 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14438 LHS.get(), RHS.get());
14441template <
typename Derived>
14446 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14447 if (LHS.isInvalid())
14450 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14451 if (RHS.isInvalid())
14457 bool ChangedAnyLookups =
false;
14458 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14459 const_cast<Expr *
>(Decomp.InnerBinOp)};
14460 for (
Expr *PossibleBinOp : PossibleBinOps) {
14461 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14464 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14470 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14471 E->getOperatorLoc(),
Callee->getFoundDecl()));
14475 ChangedAnyLookups =
true;
14476 UnqualLookups.addDecl(
Found);
14479 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14480 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14486 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14491 return getDerived().RebuildCXXRewrittenBinaryOperator(
14492 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14495template<
typename Derived>
14501 getSema().CurFPFeatures =
14502 NewOverrides.applyOverrides(getSema().getLangOpts());
14503 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14504 return getDerived().TransformBinaryOperator(E);
14507template<
typename Derived>
14513 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14514 if (commonExpr.isInvalid())
14517 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14518 if (rhs.isInvalid())
14521 if (!getDerived().AlwaysRebuild() &&
14522 commonExpr.get() == e->getCommon() &&
14523 rhs.get() == e->getFalseExpr())
14526 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14527 e->getQuestionLoc(),
14533template<
typename Derived>
14536 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14537 if (Cond.isInvalid())
14540 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14541 if (LHS.isInvalid())
14544 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14545 if (RHS.isInvalid())
14548 if (!getDerived().AlwaysRebuild() &&
14549 Cond.get() == E->getCond() &&
14550 LHS.get() == E->getLHS() &&
14551 RHS.get() == E->getRHS())
14554 return getDerived().RebuildConditionalOperator(Cond.get(),
14555 E->getQuestionLoc(),
14561template<
typename Derived>
14566 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14569template<
typename Derived>
14577 = getDerived().TransformExpr(E->getSubExprAsWritten());
14578 if (SubExpr.isInvalid())
14581 if (!getDerived().AlwaysRebuild() &&
14582 Type == E->getTypeInfoAsWritten() &&
14583 SubExpr.get() == E->getSubExpr())
14586 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14592template<
typename Derived>
14600 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14601 if (
Init.isInvalid())
14604 if (!getDerived().AlwaysRebuild() &&
14606 Init.get() == E->getInitializer())
14613 return getDerived().RebuildCompoundLiteralExpr(
14614 E->getLParenLoc(), NewT,
14615 E->getInitializer()->getEndLoc(),
Init.get());
14618template<
typename Derived>
14622 if (
Base.isInvalid())
14625 if (!getDerived().AlwaysRebuild() &&
14626 Base.get() == E->getBase())
14632 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14633 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14637template <
typename Derived>
14641 if (
Base.isInvalid())
14644 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14650 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14651 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14655template<
typename Derived>
14661 bool InitChanged =
false;
14667 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14668 Inits, &InitChanged))
14671 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14678 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14679 E->getRBraceLoc(), E->isExplicit());
14682template<
typename Derived>
14689 if (
Init.isInvalid())
14694 bool ExprChanged =
false;
14696 if (D.isFieldDesignator()) {
14697 if (D.getFieldDecl()) {
14699 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14700 if (Field != D.getFieldDecl())
14703 ExprChanged =
true;
14704 if (
Field->isAnonymousStructOrUnion())
14710 ExprChanged =
true;
14713 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14717 if (D.isArrayDesignator()) {
14718 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14719 if (Index.isInvalid())
14722 Desig.AddDesignator(
14725 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14726 ArrayExprs.push_back(Index.get());
14730 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14732 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14733 if (Start.isInvalid())
14736 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14737 if (End.isInvalid())
14741 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14743 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14744 End.get() != E->getArrayRangeEnd(D);
14746 ArrayExprs.push_back(Start.get());
14747 ArrayExprs.push_back(End.get());
14750 if (!getDerived().AlwaysRebuild() &&
14751 Init.get() == E->getInit() &&
14755 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14756 E->getEqualOrColonLoc(),
14757 E->usesGNUSyntax(),
Init.get());
14762template<
typename Derived>
14766 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14771template<
typename Derived>
14775 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14779template<
typename Derived>
14782 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14786template<
typename Derived>
14789 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14793template<
typename Derived>
14801 QualType T = getDerived().TransformType(E->getType());
14805 if (!getDerived().AlwaysRebuild() &&
14809 return getDerived().RebuildImplicitValueInitExpr(
T);
14812template<
typename Derived>
14815 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14819 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14820 if (SubExpr.isInvalid())
14823 if (!getDerived().AlwaysRebuild() &&
14824 TInfo == E->getWrittenTypeInfo() &&
14825 SubExpr.get() == E->getSubExpr())
14828 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14829 TInfo, E->getRParenLoc());
14832template<
typename Derived>
14835 bool ArgumentChanged =
false;
14837 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14841 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14843 E->getRParenLoc());
14851template<
typename Derived>
14854 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14859 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14863template<
typename Derived>
14868 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14869 if (SubStmt.isInvalid()) {
14874 unsigned OldDepth = E->getTemplateDepth();
14875 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14877 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14878 SubStmt.get() == E->getSubStmt()) {
14884 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14885 E->getRParenLoc(), NewDepth);
14888template<
typename Derived>
14891 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14892 if (Cond.isInvalid())
14895 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14896 if (LHS.isInvalid())
14899 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14900 if (RHS.isInvalid())
14903 if (!getDerived().AlwaysRebuild() &&
14904 Cond.get() == E->getCond() &&
14905 LHS.get() == E->getLHS() &&
14906 RHS.get() == E->getRHS())
14909 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14910 Cond.get(), LHS.get(), RHS.get(),
14911 E->getRParenLoc());
14914template<
typename Derived>
14920template<
typename Derived>
14923 switch (E->getOperator()) {
14927 case OO_Array_Delete:
14928 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14933 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14946 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14947 FakeLParenLoc = EndLoc;
14951 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14955 if (E->getOperator() == OO_Subscript)
14956 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14957 Args, E->getEndLoc());
14959 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14963#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14967#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14968#include "clang/Basic/OperatorKinds.def"
14970 case OO_Conditional:
14971 llvm_unreachable(
"conditional operator is not actually overloadable");
14975 llvm_unreachable(
"not an overloaded operator?");
14979 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14980 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14982 First = getDerived().TransformExpr(E->getArg(0));
14983 if (
First.isInvalid())
14987 if (E->getNumArgs() == 2) {
14989 getDerived().TransformInitializer(E->getArg(1),
false);
14990 if (Second.isInvalid())
14996 getSema().CurFPFeatures =
14997 NewOverrides.applyOverrides(getSema().getLangOpts());
14998 getSema().FpPragmaStack.CurrentValue = NewOverrides;
15004 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
15007 return getDerived().RebuildCXXOperatorCallExpr(
15008 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
15009 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
15014 Callee = ICE->getSubExprAsWritten();
15016 ValueDecl *VD = cast_or_null<ValueDecl>(
15017 getDerived().TransformDecl(DR->getLocation(), DR));
15022 Functions.addDecl(VD);
15024 return getDerived().RebuildCXXOperatorCallExpr(
15025 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
15026 false, Functions,
First.get(), Second.get());
15029template<
typename Derived>
15032 return getDerived().TransformCallExpr(E);
15035template <
typename Derived>
15038 getSema().CurContext != E->getParentContext();
15040 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
15043 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
15044 E->getBeginLoc(), E->getEndLoc(),
15045 getSema().CurContext);
15048template <
typename Derived>
15053template<
typename Derived>
15062 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
15063 if (EC.isInvalid())
15067 bool ArgChanged =
false;
15069 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15073 if (!getDerived().AlwaysRebuild() &&
15074 Callee.get() == E->getCallee() &&
15080 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
15081 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
15083 E->getRParenLoc(), EC.get());
15086template<
typename Derived>
15102 return getDerived().RebuildCXXNamedCastExpr(
15109template<
typename Derived>
15118 if (Sub.isInvalid())
15121 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
15125template<
typename Derived>
15127TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
15128 return getDerived().TransformCXXNamedCastExpr(E);
15131template<
typename Derived>
15137template<
typename Derived>
15144template<
typename Derived>
15150template<
typename Derived>
15156template<
typename Derived>
15161 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
15166 = getDerived().TransformExpr(E->getSubExprAsWritten());
15167 if (SubExpr.isInvalid())
15170 if (!getDerived().AlwaysRebuild() &&
15171 Type == E->getTypeInfoAsWritten() &&
15172 SubExpr.get() == E->getSubExpr())
15175 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
15179 E->isListInitialization());
15182template<
typename Derived>
15185 if (E->isTypeOperand()) {
15187 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15191 if (!getDerived().AlwaysRebuild() &&
15192 TInfo == E->getTypeOperandSourceInfo())
15195 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15196 TInfo, E->getEndLoc());
15202 Expr *Op = E->getExprOperand();
15204 if (E->isGLValue()) {
15206 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
15208 diag::err_incomplete_typeid))
15211 if (RD->isPolymorphic())
15219 ExprResult SubExpr = getDerived().TransformExpr(Op);
15220 if (SubExpr.isInvalid())
15223 if (!getDerived().AlwaysRebuild() &&
15224 SubExpr.get() == E->getExprOperand())
15227 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15228 SubExpr.get(), E->getEndLoc());
15231template<
typename Derived>
15234 if (E->isTypeOperand()) {
15236 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15240 if (!getDerived().AlwaysRebuild() &&
15241 TInfo == E->getTypeOperandSourceInfo())
15244 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15245 TInfo, E->getEndLoc());
15251 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
15252 if (SubExpr.isInvalid())
15255 if (!getDerived().AlwaysRebuild() &&
15256 SubExpr.get() == E->getExprOperand())
15259 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15260 SubExpr.get(), E->getEndLoc());
15263template<
typename Derived>
15269template<
typename Derived>
15276template<
typename Derived>
15292 auto &S = getSema();
15293 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15294 return S.getCurrentThisType();
15295 if (S.getCurLambda())
15296 return getDerived().TransformType(E->getType());
15297 return S.getCurrentThisType();
15300 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15301 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15304 getSema().MarkThisReferenced(E);
15308 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15311template<
typename Derived>
15314 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15315 if (SubExpr.isInvalid())
15318 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15320 if (!getDerived().AlwaysRebuild() &&
15321 SubExpr.get() == E->getSubExpr())
15324 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15325 E->isThrownVariableInScope());
15328template<
typename Derived>
15332 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15337 if (E->hasRewrittenInit()) {
15338 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15339 if (InitRes.isInvalid())
15343 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15344 E->getUsedContext() == SemaRef.
CurContext &&
15345 InitRes.get() == E->getRewrittenExpr())
15348 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15352template<
typename Derived>
15356 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15361 if (E->hasRewrittenInit()) {
15365 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15366 if (InitRes.isInvalid())
15370 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15371 E->getUsedContext() == SemaRef.
CurContext &&
15372 InitRes.get() == E->getExpr())
15375 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field,
15379template<
typename Derived>
15383 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15387 if (!getDerived().AlwaysRebuild() &&
15388 T == E->getTypeSourceInfo())
15391 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15392 T->getTypeLoc().getEndLoc(),
15393 E->getRParenLoc());
15396template<
typename Derived>
15401 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15402 if (!AllocTypeInfo)
15406 std::optional<Expr *> ArraySize;
15407 if (E->isArray()) {
15409 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15410 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15411 if (NewArraySize.isInvalid())
15414 ArraySize = NewArraySize.get();
15418 bool ArgumentChanged =
false;
15420 if (getDerived().TransformExprs(E->getPlacementArgs(),
15421 E->getNumPlacementArgs(),
true,
15422 PlacementArgs, &ArgumentChanged))
15426 Expr *OldInit = E->getInitializer();
15429 NewInit = getDerived().TransformInitializer(OldInit,
true);
15430 if (NewInit.isInvalid())
15435 if (E->getOperatorNew()) {
15436 OperatorNew = cast_or_null<FunctionDecl>(
15437 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15443 if (E->getOperatorDelete()) {
15444 OperatorDelete = cast_or_null<FunctionDecl>(
15445 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15446 if (!OperatorDelete)
15450 if (!getDerived().AlwaysRebuild() &&
15451 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15452 ArraySize == E->getArraySize() &&
15453 NewInit.get() == OldInit &&
15454 OperatorNew == E->getOperatorNew() &&
15455 OperatorDelete == E->getOperatorDelete() &&
15456 !ArgumentChanged) {
15461 if (OperatorDelete)
15464 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15476 QualType AllocType = AllocTypeInfo->getType();
15487 = dyn_cast<ConstantArrayType>(ArrayT)) {
15491 AllocType = ConsArrayT->getElementType();
15493 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15494 if (DepArrayT->getSizeExpr()) {
15495 ArraySize = DepArrayT->getSizeExpr();
15496 AllocType = DepArrayT->getElementType();
15501 return getDerived().RebuildCXXNewExpr(
15502 E->getBeginLoc(), E->isGlobalNew(),
15503 E->getBeginLoc(), PlacementArgs,
15504 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15505 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15508template<
typename Derived>
15517 if (E->getOperatorDelete()) {
15518 OperatorDelete = cast_or_null<FunctionDecl>(
15519 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15520 if (!OperatorDelete)
15524 if (!getDerived().AlwaysRebuild() &&
15525 Operand.get() == E->getArgument() &&
15526 OperatorDelete == E->getOperatorDelete()) {
15529 if (OperatorDelete)
15532 if (!E->getArgument()->isTypeDependent()) {
15534 E->getDestroyedType());
15543 return getDerived().RebuildCXXDeleteExpr(
15544 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15547template<
typename Derived>
15552 if (
Base.isInvalid())
15556 bool MayBePseudoDestructor =
false;
15558 E->getOperatorLoc(),
15559 E->isArrow()? tok::arrow : tok::period,
15561 MayBePseudoDestructor);
15562 if (
Base.isInvalid())
15565 QualType ObjectType = ObjectTypePtr.get();
15567 if (QualifierLoc) {
15569 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15574 SS.
Adopt(QualifierLoc);
15577 if (E->getDestroyedTypeInfo()) {
15578 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15579 E->getDestroyedTypeInfo(), ObjectType,
15581 if (!DestroyedTypeInfo)
15584 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15588 E->getDestroyedTypeLoc());
15592 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15593 nullptr, SS, ObjectTypePtr,
false);
15599 E->getDestroyedTypeLoc());
15603 if (E->getScopeTypeInfo()) {
15604 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15605 E->getScopeTypeInfo(), ObjectType,
nullptr);
15606 if (!ScopeTypeInfo)
15610 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15611 E->getOperatorLoc(),
15615 E->getColonColonLoc(),
15620template <
typename Derived>
15625 bool AllEmptyPacks =
true;
15626 for (
auto *OldD : Old->
decls()) {
15642 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15643 Decls = UPD->expansions();
15646 for (
auto *D : Decls) {
15647 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15648 for (
auto *SD : UD->shadows())
15655 AllEmptyPacks &= Decls.empty();
15664 if (AllEmptyPacks && !RequiresADL) {
15675 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15676 getSema().FilterAcceptableTemplateNames(R,
15682 getSema().Diag(R.getNameLoc(),
15683 diag::err_template_kw_refers_to_non_template)
15687 diag::note_template_kw_refers_to_non_template)
15688 << R.getLookupName();
15696template <
typename Derived>
15702template <
typename Derived>
15705 bool IsAddressOfOperand) {
15710 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15717 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15721 SS.
Adopt(QualifierLoc);
15725 CXXRecordDecl *NamingClass
15726 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15729 if (!NamingClass) {
15734 R.setNamingClass(NamingClass);
15755 SS, TemplateKWLoc, R,
15762 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15765 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15769template<
typename Derived>
15772 bool ArgChanged =
false;
15774 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15776 TypeLoc FromTL = From->getTypeLoc();
15779 TLB.
reserve(FromTL.getFullDataSize());
15780 QualType To = getDerived().TransformType(TLB, FromTL);
15784 if (To == From->getType())
15785 Args.push_back(From);
15787 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15797 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15803 bool Expand =
true;
15804 bool RetainExpansion =
false;
15806 ExpansionTL.getTypePtr()->getNumExpansions();
15808 if (getDerived().TryExpandParameterPacks(
15809 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15810 Unexpanded,
true, Expand,
15811 RetainExpansion, NumExpansions))
15821 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15823 QualType To = getDerived().TransformType(TLB, PatternTL);
15827 To = getDerived().RebuildPackExpansionType(To,
15828 PatternTL.getSourceRange(),
15829 ExpansionTL.getEllipsisLoc(),
15837 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15843 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15846 TLB.
reserve(PatternTL.getFullDataSize());
15847 QualType To = getDerived().TransformType(TLB, PatternTL);
15851 if (To->containsUnexpandedParameterPack()) {
15852 To = getDerived().RebuildPackExpansionType(To,
15853 PatternTL.getSourceRange(),
15854 ExpansionTL.getEllipsisLoc(),
15864 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15867 if (!RetainExpansion)
15872 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15875 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15877 QualType To = getDerived().TransformType(TLB, PatternTL);
15881 To = getDerived().RebuildPackExpansionType(To,
15882 PatternTL.getSourceRange(),
15883 ExpansionTL.getEllipsisLoc(),
15891 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15894 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15897 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15901template<
typename Derived>
15907 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15908 Old->NumTemplateArgs, TransArgs))
15911 return getDerived().RebuildConceptSpecializationExpr(
15912 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15913 E->getConceptNameInfo(), E->getFoundDecl(), E->getConceptDecl(),
15917template<
typename Derived>
15931 getSema().Context, getSema().CurContext,
15932 E->getBody()->getBeginLoc());
15936 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15937 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15938 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15942 Param->setDeclContext(Body);
15948 if (!TypeParamResult.isUnset())
15949 return TypeParamResult;
15952 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15957 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15958 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15959 ER->getReturnTypeRequirement()
15960 .getTypeConstraintTemplateParameterList()->getParam(0)
15961 ->setDeclContext(Body);
15966 return getDerived().RebuildRequiresExpr(
15967 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15968 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15971template<
typename Derived>
15977 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15978 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15979 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15980 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15982 TransReq =
getDerived().TransformNestedRequirement(
15986 Transformed.push_back(TransReq);
15991template<
typename Derived>
16004 return getDerived().RebuildTypeRequirement(TransType);
16007template<
typename Derived>
16010 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
16016 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
16019 TransExpr = TransExprRes.
get();
16022 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
16024 if (RetReq.isEmpty())
16025 TransRetReq.emplace();
16026 else if (RetReq.isSubstitutionFailure())
16027 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
16028 else if (RetReq.isTypeConstraint()) {
16030 RetReq.getTypeConstraintTemplateParameterList();
16032 getDerived().TransformTemplateParameterList(OrigTPL);
16035 TransRetReq.emplace(TPL);
16037 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
16038 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
16041 std::move(*TransRetReq));
16047template<
typename Derived>
16053 return getDerived().RebuildNestedRequirement(
16061 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
16064template<
typename Derived>
16071 if (!getDerived().AlwaysRebuild() &&
16088template<
typename Derived>
16095 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
16096 if (SubExpr.isInvalid())
16099 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
16103 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
16104 SubExpr.get(), E->getEndLoc());
16107template <
typename Derived>
16112 DRE, AddrTaken, RecoveryTSI);
16125template <
typename Derived>
16132template <
typename Derived>
16148 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
16153 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
16159 return getDerived().RebuildDependentScopeDeclRefExpr(
16160 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
16161 IsAddressOfOperand, RecoveryTSI);
16165 if (getDerived().TransformTemplateArguments(
16169 return getDerived().RebuildDependentScopeDeclRefExpr(
16170 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
16174template<
typename Derived>
16180 if (getDerived().AllowSkippingCXXConstructExpr() &&
16181 ((E->getNumArgs() == 1 ||
16182 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
16183 (!getDerived().DropCallArgument(E->getArg(0))) &&
16184 !E->isListInitialization()))
16190 QualType T = getDerived().TransformType(E->getType());
16195 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16199 bool ArgumentChanged =
false;
16204 E->isListInitialization());
16205 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16210 if (!getDerived().AlwaysRebuild() &&
16211 T == E->getType() &&
16213 !ArgumentChanged) {
16220 return getDerived().RebuildCXXConstructExpr(
16221 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
16222 E->hadMultipleCandidates(), E->isListInitialization(),
16223 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
16224 E->getConstructionKind(), E->getParenOrBraceRange());
16227template<
typename Derived>
16230 QualType T = getDerived().TransformType(E->getType());
16235 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16239 if (!getDerived().AlwaysRebuild() &&
16240 T == E->getType() &&
16248 return getDerived().RebuildCXXInheritedCtorInitExpr(
16250 E->constructsVBase(), E->inheritedFromVBase());
16257template<
typename Derived>
16260 if (
auto *Dtor = E->getTemporary()->getDestructor())
16263 return getDerived().TransformExpr(E->getSubExpr());
16271template<
typename Derived>
16277template<
typename Derived>
16282 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16287 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16291 bool ArgumentChanged =
false;
16293 Args.reserve(E->getNumArgs());
16297 E->isListInitialization());
16298 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16302 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16303 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16305 if (Res.isInvalid())
16307 Args = {Res.get()};
16311 if (!getDerived().AlwaysRebuild() &&
16312 T == E->getTypeSourceInfo() &&
16314 !ArgumentChanged) {
16321 return getDerived().RebuildCXXTemporaryObjectExpr(
16322 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16325template<
typename Derived>
16330 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16331 struct TransformedInitCapture {
16333 SourceLocation EllipsisLoc;
16335 SmallVector<InitCaptureInfoTy, 4> Expansions;
16338 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16340 CEnd = E->capture_end();
16342 if (!E->isInitCapture(
C))
16345 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16350 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16353 if (NewExprInitResult.isInvalid()) {
16357 Expr *NewExprInit = NewExprInitResult.get();
16360 getSema().buildLambdaInitCaptureInitialization(
16361 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16362 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16366 Result.Expansions.push_back(
16367 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16371 if (OldVD->isParameterPack()) {
16380 bool Expand =
true;
16381 bool RetainExpansion =
false;
16383 ExpansionTL.getTypePtr()->getNumExpansions();
16385 if (getDerived().TryExpandParameterPacks(
16386 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16387 Unexpanded,
true, Expand,
16388 RetainExpansion, NumExpansions))
16390 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16391 "capture since it cannot be extended");
16393 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16398 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16399 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16438 if ((getSema().isUnevaluatedContext() ||
16439 getSema().isConstantEvaluatedContext()) &&
16440 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16442 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16447 E->getIntroducerRange(),
nullptr, DependencyKind,
16448 E->getCaptureDefault());
16449 getDerived().transformedLocalDecl(OldClass, {
Class});
16452 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16455 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16456 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16457 E->hasExplicitParameters(), E->isMutable());
16467 CEnd = E->capture_end();
16471 if (
C->isImplicit())
16475 if (
C->capturesThis()) {
16483 dyn_cast_if_present<CXXRecordDecl>(
16484 getSema().getFunctionLevelDeclContext()),
16486 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16493 if (
C->capturesVLAType())
16497 if (E->isInitCapture(
C)) {
16498 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16503 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16505 QualType InitQualType = Info.second;
16506 if (
Init.isInvalid() || InitQualType.isNull()) {
16510 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16511 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16512 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16513 getSema().CurContext);
16518 NewVDs.push_back(NewVD);
16519 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16524 if (NewC.EllipsisLoc.isInvalid())
16525 LSI->ContainsUnexpandedParameterPack |=
16526 Init.get()->containsUnexpandedParameterPack();
16532 getDerived().transformedLocalDecl(OldVD, NewVDs);
16536 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16544 if (
C->isPackExpansion()) {
16546 bool ShouldExpand =
false;
16547 bool RetainExpansion =
false;
16549 if (getDerived().TryExpandParameterPacks(
16550 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16551 true, ShouldExpand,
16552 RetainExpansion, NumExpansions)) {
16557 if (ShouldExpand) {
16562 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16564 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16565 getDerived().TransformDecl(
C->getLocation(), Pack));
16566 if (!CapturedVar) {
16572 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16580 EllipsisLoc =
C->getEllipsisLoc();
16584 auto *CapturedVar = cast_or_null<ValueDecl>(
16585 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16586 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16593 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16594 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16597 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16600 getSema().finishLambdaExplicitCaptures(LSI);
16604 auto TPL = getDerived().TransformTemplateParameterList(
16605 E->getTemplateParameterList());
16606 LSI->GLTemplateParameterList = TPL;
16608 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16610 LSI->ContainsUnexpandedParameterPack |=
16611 TPL->containsUnexpandedParameterPack();
16616 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16618 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16619 if (NewCallOpType.isNull())
16621 LSI->ContainsUnexpandedParameterPack |=
16622 NewCallOpType->containsUnexpandedParameterPack();
16624 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16629 assert(FPTL &&
"Not a FunctionProtoType?");
16633 ExprResult E = getDerived().TransformLambdaConstraint(
16634 const_cast<Expr *
>(TRC.ConstraintExpr));
16637 TRC.ConstraintExpr = E.get();
16640 LSI->BeforeCompoundStatement =
false;
16641 getSema().CompleteLambdaCallOperator(
16642 NewCallOperator, E->getCallOperator()->getLocation(),
16643 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16644 E->getCallOperator()->getConstexprKind(),
16645 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16646 E->hasExplicitResultType());
16648 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16649 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16655 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16656 if (getDerived().ReplacingOriginal()) {
16657 Numbering = OldClass->getLambdaNumbering();
16660 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16665 getSema().PushExpressionEvaluationContextForFunction(
16667 E->getCallOperator());
16674 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16675 getSema().pushCodeSynthesisContext(
C);
16679 : getDerived().TransformLambdaBody(E, E->getBody());
16681 getSema().popCodeSynthesisContext();
16685 FuncScopeCleanup.disable();
16687 if (Body.isInvalid()) {
16688 SavedContext.pop();
16689 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16694 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16697 SavedContext.pop();
16732 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16733 Class->setLambdaDependencyKind(DependencyKind);
16735 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16736 Body.get()->getEndLoc(), LSI);
16739template<
typename Derived>
16745template<
typename Derived>
16754 if (!
C->isImplicit())
16758 if (
C->capturesThis()) {
16759 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16766 if (
C->capturesVLAType())
16769 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16773 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16779 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16785template<
typename Derived>
16794 bool ArgumentChanged =
false;
16806 if (!getDerived().AlwaysRebuild() &&
16812 return getDerived().RebuildCXXUnresolvedConstructExpr(
16816template <
typename Derived>
16820 TemplateName Name = getDerived().TransformConceptTemplateName(
16821 E->getTemplateName(), E->getNameLoc());
16826 if (getDerived().TransformTemplateArguments(
16827 E->template_arguments().data(), E->getNumTemplateArgs(), TransArgs))
16840 return getDerived().RebuildTemplateIdExpr(
16842 false, &TransArgs);
16845template<
typename Derived>
16854 if (!E->isImplicitAccess()) {
16855 OldBase = E->getBase();
16856 Base = getDerived().TransformExpr(OldBase);
16857 if (
Base.isInvalid())
16862 bool MayBePseudoDestructor =
false;
16864 E->getOperatorLoc(),
16865 E->isArrow()? tok::arrow : tok::period,
16867 MayBePseudoDestructor);
16868 if (
Base.isInvalid())
16871 ObjectType = ObjectTy.get();
16872 BaseType = ((
Expr*)
Base.get())->getType();
16875 BaseType = getDerived().TransformType(E->getBaseType());
16882 = getDerived().TransformFirstQualifierInScope(
16883 E->getFirstQualifierFoundInScope(),
16884 E->getQualifierLoc().getBeginLoc());
16887 if (E->getQualifier()) {
16889 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16891 FirstQualifierInScope);
16903 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16904 if (!NameInfo.getName())
16907 if (!E->hasExplicitTemplateArgs()) {
16910 if (!getDerived().AlwaysRebuild() &&
16911 Base.get() == OldBase &&
16912 BaseType == E->getBaseType() &&
16913 QualifierLoc == E->getQualifierLoc() &&
16914 NameInfo.getName() == E->getMember() &&
16915 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16918 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16921 E->getOperatorLoc(),
16924 FirstQualifierInScope,
16930 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16931 E->getNumTemplateArgs(),
16935 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16938 E->getOperatorLoc(),
16941 FirstQualifierInScope,
16946template <
typename Derived>
16952 if (!Old->isImplicitAccess()) {
16953 Base = getDerived().TransformExpr(Old->getBase());
16954 if (
Base.isInvalid())
16957 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16958 if (
Base.isInvalid())
16960 BaseType =
Base.get()->getType();
16962 BaseType = getDerived().TransformType(Old->getBaseType());
16966 if (Old->getQualifierLoc()) {
16968 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16978 if (TransformOverloadExprDecls(Old,
false, R))
16982 if (Old->getNamingClass()) {
16984 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16988 R.setNamingClass(NamingClass);
16992 if (Old->hasExplicitTemplateArgs()) {
16993 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16994 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16995 if (getDerived().TransformTemplateArguments(
16996 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
17004 NamedDecl *FirstQualifierInScope =
nullptr;
17006 return getDerived().RebuildUnresolvedMemberExpr(
17007 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
17008 TemplateKWLoc, FirstQualifierInScope, R,
17009 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
17012template<
typename Derived>
17017 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
17018 if (SubExpr.isInvalid())
17021 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
17024 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
17027template<
typename Derived>
17030 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
17031 if (Pattern.isInvalid())
17034 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
17037 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
17038 E->getNumExpansions());
17041template <
typename Derived>
17046 if (!Arg.isPackExpansion()) {
17058 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
17059 OrigNumExpansions);
17071 if (!NumExpansions) {
17083template<
typename Derived>
17102 bool ShouldExpand =
false;
17103 bool RetainExpansion =
false;
17105 if (getDerived().TryExpandParameterPacks(
17107 true, ShouldExpand,
17108 RetainExpansion, NumExpansions))
17113 if (ShouldExpand) {
17115 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
17116 ArgStorage = getSema().Context.getPackExpansionType(
17117 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
17118 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
17122 ExprResult DRE = getSema().BuildDeclRefExpr(
17123 VD, VD->getType().getNonLValueExprType(getSema().Context),
17126 if (DRE.isInvalid())
17129 new (getSema().Context)
17133 PackArgs = ArgStorage;
17138 if (!PackArgs.size()) {
17139 auto *Pack = cast_or_null<NamedDecl>(
17143 return getDerived().RebuildSizeOfPackExpr(
17150 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
17162 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
17165 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
17166 PackLocIterator(*
this, PackArgs.end()),
17167 TransformedPackArgs,
true))
17174 bool PartialSubstitution =
false;
17175 for (
auto &Loc : TransformedPackArgs.arguments()) {
17176 Args.push_back(Loc.getArgument());
17177 if (Loc.getArgument().isPackExpansion())
17178 PartialSubstitution =
true;
17181 if (PartialSubstitution)
17182 return getDerived().RebuildSizeOfPackExpr(
17184 std::nullopt, Args);
17186 return getDerived().RebuildSizeOfPackExpr(
17188 static_cast<unsigned>(Args.size()),
17192template <
typename Derived>
17195 if (!E->isValueDependent())
17203 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
17204 if (IndexExpr.isInvalid())
17209 bool FullySubstituted =
true;
17210 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
17211 Expr *Pattern = E->getPackIdExpression();
17213 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
17215 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17219 bool ShouldExpand =
true;
17220 bool RetainExpansion =
false;
17222 NumExpansions = std::nullopt;
17223 if (getDerived().TryExpandParameterPacks(
17224 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17225 true, ShouldExpand,
17226 RetainExpansion, NumExpansions))
17228 if (!ShouldExpand) {
17230 ExprResult Pack = getDerived().TransformExpr(Pattern);
17231 if (Pack.isInvalid())
17233 return getDerived().RebuildPackIndexingExpr(
17234 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
17237 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17240 if (
Out.isInvalid())
17242 if (
Out.get()->containsUnexpandedParameterPack()) {
17243 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17244 OrigNumExpansions);
17245 if (
Out.isInvalid())
17247 FullySubstituted =
false;
17249 ExpandedExprs.push_back(
Out.get());
17253 if (RetainExpansion) {
17254 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17257 if (
Out.isInvalid())
17260 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17261 OrigNumExpansions);
17262 if (
Out.isInvalid())
17264 FullySubstituted =
false;
17265 ExpandedExprs.push_back(
Out.get());
17267 }
else if (!E->expandsToEmptyPack()) {
17268 if (getDerived().TransformExprs(E->getExpressions().data(),
17269 E->getExpressions().size(),
false,
17274 return getDerived().RebuildPackIndexingExpr(
17275 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
17276 IndexExpr.get(), ExpandedExprs, FullySubstituted);
17279template <
typename Derived>
17282 if (!getSema().ArgPackSubstIndex)
17288 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17289 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
17290 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
17294template <
typename Derived>
17311 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17312 if (Replacement.isInvalid())
17315 Decl *AssociatedDecl =
17316 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17317 if (!AssociatedDecl)
17320 QualType ParamType = TransformType(E->getParameterType());
17321 if (ParamType.isNull())
17324 if (Replacement.get() == OrigReplacement &&
17325 AssociatedDecl == E->getAssociatedDecl() &&
17326 ParamType == E->getParameterType())
17329 if (Replacement.get() != OrigReplacement ||
17330 ParamType != E->getParameterType()) {
17339 Param, ParamType, Replacement.get(), SugaredConverted,
17340 CanonicalConverted,
17342 if (Replacement.isInvalid())
17346 Replacement = E->getReplacement();
17349 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17350 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17352 E->getPackIndex(), E->getFinal());
17355template<
typename Derived>
17362template<
typename Derived>
17369template<
typename Derived>
17373 if (
Expr *OldCallee = E->getCallee()) {
17374 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17375 if (CalleeResult.isInvalid())
17380 Expr *Pattern = E->getPattern();
17383 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17384 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17388 bool Expand =
true;
17389 bool RetainExpansion =
false;
17391 NumExpansions = OrigNumExpansions;
17392 if (getDerived().TryExpandParameterPacks(
17393 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17394 true, Expand, RetainExpansion,
17404 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17405 if (LHS.isInvalid())
17409 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17410 if (RHS.isInvalid())
17413 if (!getDerived().AlwaysRebuild() &&
17414 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17417 return getDerived().RebuildCXXFoldExpr(
17418 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17419 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17425 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17426 SemaRef.
Diag(E->getEllipsisLoc(),
17427 clang::diag::err_fold_expression_limit_exceeded)
17428 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17429 << E->getSourceRange();
17430 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17439 bool LeftFold = E->isLeftFold();
17443 if (!LeftFold && RetainExpansion) {
17444 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17447 if (
Out.isInvalid())
17450 Result = getDerived().RebuildCXXFoldExpr(
17451 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17452 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17457 bool WarnedOnComparison =
false;
17458 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17460 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17462 if (
Out.isInvalid())
17465 if (
Out.get()->containsUnexpandedParameterPack()) {
17467 Result = getDerived().RebuildCXXFoldExpr(
17468 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17469 E->getOperator(), E->getEllipsisLoc(),
17470 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17471 OrigNumExpansions);
17472 }
else if (
Result.isUsable()) {
17479 Result = getDerived().RebuildCXXOperatorCallExpr(
17481 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17482 Functions, LHS, RHS);
17484 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17485 E->getOperator(), LHS, RHS,
17487 if (!WarnedOnComparison &&
Result.isUsable()) {
17488 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17489 BO && BO->isComparisonOp()) {
17490 WarnedOnComparison =
true;
17491 SemaRef.
Diag(BO->getBeginLoc(),
17492 diag::warn_comparison_in_fold_expression)
17493 << BO->getOpcodeStr();
17506 if (LeftFold && RetainExpansion) {
17507 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17510 if (
Out.isInvalid())
17513 Result = getDerived().RebuildCXXFoldExpr(
17514 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17515 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17521 PE->setIsProducedByFoldExpansion();
17526 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17531template <
typename Derived>
17537 QualType T = getDerived().TransformType(E->getType());
17539 bool ArgChanged =
false;
17541 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17542 TransformedInits, &ArgChanged))
17545 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17548 return getDerived().RebuildCXXParenListInitExpr(
17549 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17550 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17553template<
typename Derived>
17560template<
typename Derived>
17566template<
typename Derived>
17572template<
typename Derived>
17575 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17576 if (SubExpr.isInvalid())
17579 if (!getDerived().AlwaysRebuild() &&
17580 SubExpr.get() == E->getSubExpr())
17583 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17586template<
typename Derived>
17591 bool ArgChanged =
false;
17592 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17593 false, Elements, &ArgChanged))
17596 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17599 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17604template<
typename Derived>
17610 bool ArgChanged =
false;
17611 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17614 if (OrigElement.isPackExpansion()) {
17617 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17618 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17619 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17623 bool Expand =
true;
17624 bool RetainExpansion =
false;
17627 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17628 OrigElement.Value->getEndLoc());
17629 if (getDerived().TryExpandParameterPacks(
17630 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17631 true, Expand, RetainExpansion,
17640 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17641 if (Key.isInvalid())
17644 if (Key.get() != OrigElement.Key)
17648 if (
Value.isInvalid())
17655 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17657 Elements.push_back(Expansion);
17667 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17669 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17670 if (Key.isInvalid())
17674 if (
Value.isInvalid())
17684 if (Key.get()->containsUnexpandedParameterPack() ||
17685 Value.get()->containsUnexpandedParameterPack())
17686 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17688 Elements.push_back(Element);
17698 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17699 if (Key.isInvalid())
17702 if (Key.get() != OrigElement.Key)
17707 = getDerived().TransformExpr(OrigElement.Value);
17708 if (
Value.isInvalid())
17716 Elements.push_back(Element);
17719 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17722 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17726template<
typename Derived>
17730 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17731 if (!EncodedTypeInfo)
17734 if (!getDerived().AlwaysRebuild() &&
17735 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17738 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17740 E->getRParenLoc());
17743template<
typename Derived>
17753template<
typename Derived>
17757 = getDerived().TransformType(E->getTypeInfoAsWritten());
17765 if (!getDerived().AlwaysRebuild() &&
17766 TSInfo == E->getTypeInfoAsWritten() &&
17767 Result.get() == E->getSubExpr())
17771 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17775template <
typename Derived>
17781template<
typename Derived>
17785 bool ArgChanged =
false;
17787 Args.reserve(E->getNumArgs());
17788 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17795 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17796 if (!ReceiverTypeInfo)
17800 if (!getDerived().AlwaysRebuild() &&
17801 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17806 E->getSelectorLocs(SelLocs);
17807 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17810 E->getMethodDecl(),
17817 if (!E->getMethodDecl())
17822 E->getSelectorLocs(SelLocs);
17823 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17826 E->getReceiverType(),
17827 E->getMethodDecl(),
17835 "Only class and instance messages may be instantiated");
17837 = getDerived().TransformExpr(E->getInstanceReceiver());
17838 if (Receiver.isInvalid())
17842 if (!getDerived().AlwaysRebuild() &&
17843 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17848 E->getSelectorLocs(SelLocs);
17849 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17852 E->getMethodDecl(),
17858template<
typename Derived>
17864template<
typename Derived>
17870template<
typename Derived>
17875 if (
Base.isInvalid())
17881 if (!getDerived().AlwaysRebuild() &&
17882 Base.get() == E->getBase())
17885 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17887 E->isArrow(), E->isFreeIvar());
17890template<
typename Derived>
17895 if (!E->isObjectReceiver())
17900 if (
Base.isInvalid())
17906 if (!getDerived().AlwaysRebuild() &&
17907 Base.get() == E->getBase())
17910 if (E->isExplicitProperty())
17911 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17912 E->getExplicitProperty(),
17915 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17917 E->getImplicitPropertyGetter(),
17918 E->getImplicitPropertySetter(),
17922template<
typename Derived>
17927 if (
Base.isInvalid())
17931 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17932 if (Key.isInvalid())
17936 if (!getDerived().AlwaysRebuild() &&
17937 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17940 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17941 Base.get(), Key.get(),
17942 E->getAtIndexMethodDecl(),
17943 E->setAtIndexMethodDecl());
17946template<
typename Derived>
17951 if (
Base.isInvalid())
17955 if (!getDerived().AlwaysRebuild() &&
17956 Base.get() == E->getBase())
17959 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17964template<
typename Derived>
17967 bool ArgumentChanged =
false;
17969 SubExprs.reserve(E->getNumSubExprs());
17970 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17971 SubExprs, &ArgumentChanged))
17974 if (!getDerived().AlwaysRebuild() &&
17978 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17980 E->getRParenLoc());
17983template<
typename Derived>
17986 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17987 if (SrcExpr.isInvalid())
17994 if (!getDerived().AlwaysRebuild() &&
17995 Type == E->getTypeSourceInfo() &&
17996 SrcExpr.get() == E->getSrcExpr())
17999 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
18000 SrcExpr.get(),
Type,
18001 E->getRParenLoc());
18004template<
typename Derived>
18007 BlockDecl *oldBlock = E->getBlockDecl();
18013 blockScope->TheDecl->setBlockMissingReturnType(
18014 oldBlock->blockMissingReturnType());
18023 if (getDerived().TransformFunctionTypeParams(
18024 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
18025 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
18027 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
18032 getDerived().TransformType(exprFunctionType->getReturnType());
18034 auto epi = exprFunctionType->getExtProtoInfo();
18035 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
18038 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
18042 if (!params.empty())
18043 blockScope->TheDecl->setParams(params);
18045 if (!oldBlock->blockMissingReturnType()) {
18046 blockScope->HasImplicitReturnType =
false;
18047 blockScope->ReturnType = exprResultType;
18051 StmtResult body = getDerived().TransformStmt(E->getBody());
18052 if (body.isInvalid()) {
18053 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
18061 for (
const auto &I : oldBlock->captures()) {
18062 VarDecl *oldCapture = I.getVariable();
18065 if (oldCapture->isParameterPack())
18069 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
18071 assert(blockScope->CaptureMap.count(newCapture));
18080template<
typename Derived>
18083 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
18084 if (SrcExpr.isInvalid())
18087 QualType Type = getDerived().TransformType(E->getType());
18090 E->getRParenLoc());
18093template<
typename Derived>
18096 bool ArgumentChanged =
false;
18098 SubExprs.reserve(E->getNumSubExprs());
18099 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
18100 SubExprs, &ArgumentChanged))
18103 if (!getDerived().AlwaysRebuild() &&
18107 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
18108 E->getOp(), E->getRParenLoc());
18115template<
typename Derived>
18118 return SemaRef.BuildPointerType(PointeeType,
Star,
18122template<
typename Derived>
18125 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
18129template<
typename Derived>
18132 bool WrittenAsLValue,
18134 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
18138template <
typename Derived>
18142 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
18146template<
typename Derived>
18153 return SemaRef.ObjC().BuildObjCTypeParamType(
18154 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18158template<
typename Derived>
18169 return SemaRef.ObjC().BuildObjCObjectType(
18170 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
18171 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18176template<
typename Derived>
18180 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
18183template <
typename Derived>
18186 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18187 if (SizeExpr || !Size)
18188 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
18189 IndexTypeQuals, BracketsRange,
18193 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
18195 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
18198 for (
const auto &
T : Types)
18199 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
18209 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
18210 IndexTypeQuals, BracketsRange,
18214template <
typename Derived>
18217 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18218 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
18219 IndexTypeQuals, BracketsRange);
18222template <
typename Derived>
18226 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
18227 IndexTypeQuals, BracketsRange);
18230template <
typename Derived>
18233 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18234 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18236 IndexTypeQuals, BracketsRange);
18239template <
typename Derived>
18242 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18243 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18245 IndexTypeQuals, BracketsRange);
18248template <
typename Derived>
18251 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
18255template <
typename Derived>
18257 unsigned NumElements,
18260 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
18263template <
typename Derived>
18267 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
18270template<
typename Derived>
18272 unsigned NumElements,
18274 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18275 NumElements,
true);
18279 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
18282template<
typename Derived>
18287 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
18290template <
typename Derived>
18292 QualType ElementType,
unsigned NumRows,
unsigned NumColumns,
18298 Ctx, llvm::APInt(SizeWidth, NumRows), SizeTy, AttributeLoc);
18300 Ctx, llvm::APInt(SizeWidth, NumColumns), SizeTy, AttributeLoc);
18301 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18305template <
typename Derived>
18309 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18313template <
typename Derived>
18317 return SemaRef.BuildFunctionType(
T, ParamTypes,
18323template<
typename Derived>
18325 return SemaRef.Context.getFunctionNoProtoType(
T);
18328template <
typename Derived>
18332 assert(D &&
"no decl found");
18336 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18340 if (UPD->expansions().empty()) {
18341 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18342 << UPD->isCXXClassMember() << UPD;
18351 for (
auto *E : UPD->expansions()) {
18358 else if (
T.isNull())
18361 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18362 "mismatched resolved types in using pack expansion");
18364 return T.isNull() ? FallbackT :
T;
18366 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18367 assert(Using->hasTypename() &&
18368 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18371 assert(++Using->shadow_begin() == Using->shadow_end());
18376 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18379 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18380 return SemaRef.Context.getUnresolvedUsingType(
18384template <
typename Derived>
18387 return SemaRef.BuildTypeofExprType(E, Kind);
18390template<
typename Derived>
18393 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18396template <
typename Derived>
18398 return SemaRef.BuildDecltypeType(E);
18401template <
typename Derived>
18405 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc,
18406 FullySubstituted, Expansions);
18409template<
typename Derived>
18411 UnaryTransformType::UTTKind UKind,
18413 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18416template <
typename Derived>
18420 return SemaRef.CheckTemplateIdType(
18425template<
typename Derived>
18428 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18431template<
typename Derived>
18435 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18436 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18439template <
typename Derived>
18443 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18447 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18450template <
typename Derived>
18453 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18456template <
typename Derived>
18464template <
typename Derived>
18471 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18474 AllowInjectedClassName);
18478template<
typename Derived>
18485 bool AllowInjectedClassName) {
18488 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18493 false,
Template, AllowInjectedClassName);
18497template <
typename Derived>
18502 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18507 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18508 Opc,
First, Second);
18523 if (Op == OO_Subscript) {
18524 if (!
First->getType()->isOverloadableType() &&
18526 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18528 }
else if (Op == OO_Arrow) {
18531 if (
First->getType()->isDependentType())
18534 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18535 }
else if (Second ==
nullptr || isPostIncDec) {
18536 if (!
First->getType()->isOverloadableType() ||
18537 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18544 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18548 !
First->getType()->isOverloadableType() &&
18554 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18563 if (!Second || isPostIncDec) {
18566 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18573 First, Second, RequiresADL);
18580template<
typename Derived>
18590 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18591 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18596 ->getAsCanonical<RecordType>())) {
18598 return SemaRef.BuildPseudoDestructorExpr(
18599 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18600 CCLoc, TildeLoc, Destroyed);
18612 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18613 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18614 diag::err_expected_class_or_namespace)
18615 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18619 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18623 return getSema().BuildMemberReferenceExpr(
18624 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18630template<
typename Derived>
18638 for (
unsigned I = 0; I < NumParams; ++I) {
18639 if (I != ContextParamPos) {
18645 Params.push_back(std::make_pair(StringRef(), QualType()));
18648 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18656 if (Body.isInvalid()) {
18657 getSema().ActOnCapturedRegionError();
18661 return getSema().ActOnCapturedRegionEnd(Body.get());
18664template <
typename Derived>
18670 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18674template <
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)
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
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 '...
bool anyScoreOrCondition(llvm::function_ref< bool(Expr *&, bool)> Cond)
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
unsigned getIntWidth(QualType T) const
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getLateParsedAttrType(QualType Wrapped, LateParsedTypeAttribute *LateParsedAttr) const
Return a placeholder type for a late-parsed type attribute.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
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)
QualType getMatrixTypeWithLayout(QualType T, MatrixType::LayoutKind Layout) const
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.
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field, DeclContext *UsedContext, Expr *RewrittenInitExpr)
Field is the non-static data member whose default initializer is used by this expression.
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, TemplateName 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.
An expression that occurs in a constant context and the result of evaluating the expression.
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...
A template-id naming a variable template or a concept through a template template parameter.
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
SmallVector< Conflict > Conflicts
Represents an abstract function effect, using just an enumeration describing its kind.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
SourceRange getExceptionSpecRange() const
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
Type source information for HLSL attributed resource type.
void setSourceRange(const SourceRange &R)
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
void setAttrNameLoc(SourceLocation Loc)
Represents a placeholder type for late-parsed type attributes.
Represents the results of name lookup.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
void setExpansionLoc(SourceLocation Loc)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setAttrNameLoc(SourceLocation loc)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Wrapper for source info for member pointers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This is a basic class for representing single OpenMP clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents the 'counts' clause in the 'pragma omp split' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents the 'depth' clause on the 'pragma omp flatten' (and 'pragma omp fuse') loop-transform...
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
A structure for storing a pack-index-template-name ([temp.names]).
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.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
void removeObjCLifetime()
static Qualifiers fromCVRMask(unsigned CVR)
PointerAuthQualifier getPointerAuth() const
bool hasObjCLifetime() const
LangAS getAddressSpace() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Smart pointer class that efficiently represents Objective-C method names.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool diagnoseMatrixLayoutInstantiation(attr::Kind K, QualType T, SourceLocation Loc)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
Helper type for the registration/assignment of constructs that need to 'know' about their parent cons...
Helper type to restore the state of various 'loop' constructs when we run into a loop (for,...
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
void ActOnWhileStmt(SourceLocation WhileLoc)
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(ArrayRef< Expr * > VarList, OpenMPNumThreadsClauseModifier SimpleModifier, SourceLocation SimpleModifierLoc, OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr, SourceLocation ComplexModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr, SourceLocation ModifierExtraLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * 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.
StmtResult ActOnOpenMPMetaDirective(SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPTraitInfo * > TraitInfos, ArrayRef< Stmt * > Variants)
Called for metadirectives with user conditions that require runtime selection.
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.
OMPClause * ActOnOpenMPDepthClause(Expr *DepthExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depth' 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.
std::optional< bool > getKnownValue() const
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)
TemplateName BuildPackIndexingTemplateName(TemplateName Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< TemplateName > Expansions={})
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 BuildCXXReflectExpr(SourceLocation OperatorLoc, TypeSourceInfo *TSI)
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 CheckVarOrConceptTemplateTemplateId(const DeclarationNameInfo &NameInfo, TemplateName Template, const TemplateArgumentListInfo *TemplateArgs)
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...
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel, bool IsConstexpr=false)
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 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.
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.
PackIndexingTemplateStorage * getAsPackIndexingTemplate() const
Retrieve the pack-index-template-name storage, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
QualType pointeeType(QualType T)
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenMPNumTeamsClauseModifier
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ArraySizeModifier
Capture whether this is a normal array (e.g.
OptionalUnsigned< unsigned > UnsignedOrNone
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
ActionResult< CXXBaseSpecifier * > BaseResult
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
TagTypeKind
The kind of a tag type.
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr * > &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr * > &UnresolvedMappers)
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ Keyword
The name has been typo-corrected to a keyword.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDynGroupprivateClauseModifier
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
OpenMPThreadLimitClauseModifier
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
@ PackIndex
Index of a pack indexing expression or specifier.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
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
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