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 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1730 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1757 VarList, PrescriptivenessModifier, PrescriptivenessModifierLoc,
1758 DimsModifier, DimsModifierExpr, DimsModifierLoc, StartLoc, LParenLoc,
1796 std::optional<unsigned> FillIdx,
1798 unsigned FillCount = FillIdx ? 1 : 0;
1800 Counts, StartLoc, LParenLoc, EndLoc, FillIdx, FillLoc, FillCount);
1839 First, Count, StartLoc, LParenLoc, FirstLoc, CountLoc, EndLoc);
1875 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1888 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1895 ImpexTypeArg, StartLoc, LParenLoc, EndLoc);
1908 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1970 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1998 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1999 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
2000 UnresolvedReductions);
2014 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2015 ReductionId, UnresolvedReductions);
2030 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
2031 ReductionId, UnresolvedReductions);
2044 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
2045 StepModifierLoc, EndLoc);
2058 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2118 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2131 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2146 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2147 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2148 ColonLoc, VarList, Locs,
2149 false, UnresolvedMappers);
2166 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2167 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2181 VarList, Modifier, ModifierExpr, ModifierLoc, ModifierExtra,
2182 ModifierExtraExpr, ModifierExtraLoc, StartLoc, LParenLoc, EndLoc);
2194 VarList, Modifier, ModifierExpr, ModifierLoc, StartLoc, LParenLoc,
2219 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2232 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2267 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2282 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2283 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2299 MotionModifiers, MotionModifiersLoc, IteratorModifier,
2300 MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
2313 VarList, Locs, FallbackModifier, FallbackModifierLoc);
2355 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2402 StartLoc, LParenLoc, EndLoc,
Data);
2415 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2427 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2440 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2451 LParenLoc, VarLoc, EndLoc);
2463 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2534 M1, M2, Size, StartLoc, LParenLoc, M1Loc, M2Loc, EndLoc);
2615 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2663 ForLoc, Element, Collection, RParenLoc);
2681 StartLoc, IdLoc, Id);
2718 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2719 if (RangeStmt->isSingleDecl()) {
2720 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2721 if (RangeVar->isInvalidDecl())
2724 Expr *RangeExpr = RangeVar->getInit();
2731 diag::err_objc_for_range_init_stmt)
2732 <<
Init->getSourceRange();
2735 ForLoc, LoopVar, RangeExpr, RParenLoc);
2742 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End, Cond, Inc,
2756 QualifierLoc, NameInfo, Nested);
2818 SS.
Adopt(QualifierLoc);
2872 UnaryExprOrTypeTrait ExprKind,
2883 UnaryExprOrTypeTrait ExprKind,
2938 if (IsOMPArraySection)
2940 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2941 Stride, RBracketLoc);
2943 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2944 "Stride/second colon not allowed for OpenACC");
2947 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2959 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2971 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2981 Expr *ExecConfig =
nullptr) {
2983 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2990 nullptr, Callee, LParenLoc, Args, RParenLoc);
3008 if (!
Member->getDeclName()) {
3012 assert(
Member->getType()->isRecordType() &&
3013 "unnamed member not of record type?");
3026 if (!isArrow &&
Base->isPRValue()) {
3041 SS.
Adopt(QualifierLoc);
3044 if (
Base->containsErrors())
3049 if (isArrow && !BaseType->isPointerType())
3055 R.addDecl(FoundDecl);
3058 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
3063 ->getAsCXXRecordDecl()) {
3067 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
3075 FirstQualifierInScope,
3076 R, ExplicitTemplateArgs,
3086 bool ForFoldExpression =
false) {
3164 return SemaRef.BuildInitList(LBraceLoc,
Inits, RBraceLoc, IsExplicit);
3177 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3217 unsigned NumUserSpecifiedExprs,
3222 InitLoc, LParenLoc, RParenLoc);
3252 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3264 Expr *ControllingExpr,
3269 ControllingExpr, Types, Exprs);
3284 ControllingType, Types, Exprs);
3317 case Stmt::CXXStaticCastExprClass:
3318 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3319 RAngleLoc, LParenLoc,
3320 SubExpr, RParenLoc);
3322 case Stmt::CXXDynamicCastExprClass:
3323 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3324 RAngleLoc, LParenLoc,
3325 SubExpr, RParenLoc);
3327 case Stmt::CXXReinterpretCastExprClass:
3328 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3329 RAngleLoc, LParenLoc,
3333 case Stmt::CXXConstCastExprClass:
3334 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3335 RAngleLoc, LParenLoc,
3336 SubExpr, RParenLoc);
3338 case Stmt::CXXAddrspaceCastExprClass:
3339 return getDerived().RebuildCXXAddrspaceCastExpr(
3340 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3343 llvm_unreachable(
"Invalid C++ named cast");
3421 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3433 bool ListInitialization) {
3437 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3439 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3440 RParenLoc, ListInitialization);
3442 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3444 TInfo, LParenLoc, PLE->getUserSpecifiedInitExprs(), RParenLoc,
3445 ListInitialization);
3449 ListInitialization);
3513 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3523 bool IsThrownVariableInScope) {
3533 Expr *RewrittenExpr) {
3535 RewrittenExpr,
getSema().CurContext);
3544 Expr *RewrittenInit) {
3546 getSema().CurContext, RewrittenInit);
3570 std::optional<Expr *> ArraySize,
3589 bool IsGlobalDelete,
3640 bool IsAddressOfOperand,
3643 SS.
Adopt(QualifierLoc);
3645 if (TemplateArgs || TemplateKWLoc.
isValid())
3647 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3650 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3672 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3673 bool ListInitialization,
bool StdInitListInitialization,
3680 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3683 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3690 HadMultipleCandidates,
3692 StdInitListInitialization,
3693 RequiresZeroInit, ConstructKind,
3701 bool ConstructsVBase,
3702 bool InheritedFromVBase) {
3704 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3715 bool ListInitialization) {
3717 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3728 bool ListInitialization) {
3730 RParenLoc, ListInitialization);
3747 SS.
Adopt(QualifierLoc);
3749 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3750 OperatorLoc, IsArrow,
3752 FirstQualifierInScope,
3754 TemplateArgs,
nullptr);
3770 SS.
Adopt(QualifierLoc);
3772 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3773 OperatorLoc, IsArrow,
3775 FirstQualifierInScope,
3776 R, TemplateArgs,
nullptr);
3784 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3797 RParenLoc, Length, PartialArgs);
3802 Expr *PackIdExpression,
Expr *IndexExpr,
3804 bool FullySubstituted =
false) {
3806 IndexExpr, RSquareLoc, ExpandedExprs,
3832 NamedConcept, TALI);
3850 LocalParameters, RParenLoc, Requirements,
3857 return SemaRef.BuildTypeRequirement(SubstDiag);
3861 return SemaRef.BuildTypeRequirement(
T);
3869 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3876 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3883 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3888 return SemaRef.BuildNestedRequirement(Constraint);
3904 Expr **Elements,
unsigned NumElements) {
3914 RB,
Base, Key, getterMethod, setterMethod);
3933 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3945 return SemaRef.ObjC().BuildClassMessage(
3946 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3959 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3962 SelectorLocs, RBracLoc, Args);
3974 return Method->isInstanceMethod()
3975 ?
SemaRef.ObjC().BuildInstanceMessage(
3976 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3977 SelectorLocs, RBracLoc, Args)
3978 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3980 SelectorLocs, RBracLoc, Args);
3989 bool IsArrow,
bool IsFreeIvar) {
3998 if (IsFreeIvar &&
Result.isUsable())
4035 PropertyLoc,
Base));
4064 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
4067 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
4075 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
4076 CK_BuiltinFnToFnPtr).get();
4092 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4107 EllipsisLoc, NumExpansions);
4131 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4167 EllipsisLoc, RHS, RParenLoc,
4176 Init->containsUnexpandedParameterPack();
4177 else if (PVD->hasUninstantiatedDefaultArg())
4179 PVD->getUninstantiatedDefaultArg()
4180 ->containsUnexpandedParameterPack();
4334 Exprs.push_back(DevNumExpr);
4335 llvm::append_range(Exprs, QueueIdExprs);
4372 AssociatedDecl, Index, ParamType, Loc, Arg,
PackIndex, Final);
4396 ObjectType, FirstQualifierInScope);
4402 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4403 DependentNameTypeLoc TL,
4404 bool DeducibleTSTContext,
4405 QualType ObjectType = QualType(),
4406 NamedDecl *UnqualLookup =
nullptr);
4409 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4414 OpenACCDirectiveKind DirKind,
4415 const OpenACCClause *OldClause);
4418template <
typename Derived>
4428#define STMT(Node, Parent) \
4429 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4430#define VALUESTMT(Node, Parent) \
4431 case Stmt::Node##Class: \
4432 return getDerived().Transform##Node(cast<Node>(S), SDK);
4433#define ABSTRACT_STMT(Node)
4434#define EXPR(Node, Parent)
4435#include "clang/AST/StmtNodes.inc"
4438#define STMT(Node, Parent)
4439#define ABSTRACT_STMT(Stmt)
4440#define EXPR(Node, Parent) case Stmt::Node##Class:
4441#include "clang/AST/StmtNodes.inc"
4446 E =
getSema().ActOnStmtExprResult(E);
4454template<
typename Derived>
4462#define GEN_CLANG_CLAUSE_CLASS
4463#define CLAUSE_CLASS(Enum, Str, Class) \
4465 return getDerived().Transform##Class(cast<Class>(S));
4466#include "llvm/Frontend/OpenMP/OMP.inc"
4473template<
typename Derived>
4480#define STMT(Node, Parent) case Stmt::Node##Class: break;
4481#define ABSTRACT_STMT(Stmt)
4482#define EXPR(Node, Parent) \
4483 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4484#include "clang/AST/StmtNodes.inc"
4490template<
typename Derived>
4498 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4499 Init = FE->getSubExpr();
4501 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4507 Init = MTE->getSubExpr();
4510 Init = Binder->getSubExpr();
4513 Init = ICE->getSubExprAsWritten();
4516 dyn_cast<CXXStdInitializerListExpr>(
Init))
4553 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4554 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4555 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4556 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4558 bool ArgChanged =
false;
4560 true, NewArgs, &ArgChanged))
4571 if (
Parens.isInvalid()) {
4574 assert(NewArgs.empty() &&
4575 "no parens or braces but have direct init with arguments?");
4582template<
typename Derived>
4588 for (
unsigned I = 0; I != NumInputs; ++I) {
4598 Expr *Pattern = Expansion->getPattern();
4601 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4602 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4607 bool RetainExpansion =
false;
4608 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4612 Unexpanded,
true, Expand,
4613 RetainExpansion, NumExpansions))
4626 Expansion->getEllipsisLoc(),
4628 if (Out.isInvalid())
4633 Outputs.push_back(Out.get());
4639 if (ArgChanged) *ArgChanged =
true;
4643 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4646 if (Out.isInvalid())
4649 if (Out.get()->containsUnexpandedParameterPack()) {
4651 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4652 if (Out.isInvalid())
4656 Outputs.push_back(Out.get());
4661 if (RetainExpansion) {
4662 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4665 if (Out.isInvalid())
4669 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4670 if (Out.isInvalid())
4673 Outputs.push_back(Out.get());
4680 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4685 if (
Result.get() != Inputs[I] && ArgChanged)
4688 Outputs.push_back(
Result.get());
4694template <
typename Derived>
4705 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4711 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4720 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4727template <
typename Derived>
4735 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4747 llvm_unreachable(
"unexpected null nested name specifier");
4778 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4779 QualifierLoc, ObjectType, FirstQualifierInScope);
4783 FirstQualifierInScope =
nullptr;
4785 SS.
Adopt(QualifierLoc);
4789 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4791 FirstQualifierInScope,
false))
4799 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4800 FirstQualifierInScope);
4806 if (
T->isDependentType() ||
T->isRecordType() ||
4807 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4808 if (
T->isEnumeralType())
4810 diag::warn_cxx98_compat_enum_nested_name_spec);
4817 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4841template<
typename Derived>
4861 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4868 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4878 NewTInfo =
getDerived().TransformType(OldTInfo);
4881 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4889 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4902 llvm_unreachable(
"Unknown name kind.");
4905template <
typename Derived>
4909 QualType ObjectType,
bool AllowInjectedClassName) {
4911 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4912 ObjectType, AllowInjectedClassName);
4914 NameLoc, ObjectType,
4915 AllowInjectedClassName);
4918template <
typename Derived>
4922 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4924 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4927 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4928 QualifierLoc, ObjectType, FirstQualifierInScope);
4935 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4936 FirstQualifierInScope, AllowInjectedClassName);
4937 if (NewUnderlyingName.
isNull())
4939 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4943 NewUnderlyingName == UnderlyingName)
4946 SS.
Adopt(QualifierLoc);
4947 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4953 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4954 QualifierLoc, ObjectType, FirstQualifierInScope);
4968 SS.
Adopt(QualifierLoc);
4969 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4970 NameLoc, ObjectType,
4971 AllowInjectedClassName);
4976 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4983 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4987 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4988 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4991 Decl *AssociatedDecl =
4992 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4994 AssociatedDecl == S->getAssociatedDecl())
4996 return SemaRef.Context.getSubstTemplateTemplateParm(
4997 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
5002 assert(!QualifierLoc &&
"Unexpected qualified pack-index-template-name");
5008 IndexExpr =
getDerived().TransformExpr(PI->getIndexExpr());
5016 NoQualifier, TemplateKWLoc, N, NameLoc, ObjectType,
5017 FirstQualifierInScope, AllowInjectedClassName);
5024 bool NotYetExpanded = Names.empty();
5025 bool FullySubstituted =
true;
5027 if (Names.empty() && !PI->expandsToEmptyPack())
5031 if (!N.containsUnexpandedParameterPack()) {
5033 if (Transformed.
isNull())
5035 SubstitutedNames.push_back(Transformed);
5040 getSema().collectUnexpandedParameterPacks(N, Unexpanded);
5041 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5043 bool ShouldExpand =
true;
5044 bool RetainExpansion =
false;
5049 RetainExpansion, NumExpansions))
5052 if (!ShouldExpand) {
5057 if (NotYetExpanded) {
5058 FullySubstituted =
false;
5059 return getDerived().RebuildPackIndexingTemplateName(
5060 Pack, IndexExpr.
get(), FullySubstituted);
5062 SubstitutedNames.push_back(Pack);
5066 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5071 SubstitutedNames.push_back(Out);
5072 FullySubstituted &= !Out.containsUnexpandedParameterPack();
5077 if (RetainExpansion) {
5078 FullySubstituted =
false;
5079 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5083 SubstitutedNames.push_back(Out);
5092 return getDerived().RebuildPackIndexingTemplateName(
5093 NewPattern, IndexExpr.
get(), FullySubstituted, SubstitutedNames);
5097 "DeducedTemplateName should not escape partial ordering");
5101 assert(!QualifierLoc &&
"Unexpected qualifier");
5108 assert(!QualifierLoc &&
5109 "Unexpected qualified SubstTemplateTemplateParmPack");
5111 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
5112 SubstPack->getIndex(), SubstPack->getFinal());
5116 llvm_unreachable(
"overloaded function decl survived to here");
5119template <
typename Derived>
5128template <
typename Derived>
5133 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
5139template<
typename Derived>
5143 Output =
getSema().getTrivialTemplateArgumentLoc(
5147template <
typename Derived>
5155 llvm_unreachable(
"Unexpected TemplateArgument");
5178 if (NewT ==
T && D == NewD)
5195 llvm_unreachable(
"unexpected template argument kind");
5227 llvm_unreachable(
"Caller should expand pack expansions");
5243 E =
SemaRef.ActOnConstantExpression(E);
5258template<
typename Derived,
typename InputIterator>
5266 typedef typename std::iterator_traits<InputIterator>::difference_type
5281 : Self(Self), Iter(Iter) { }
5296 Self.InventTemplateArgumentLoc(*Iter,
Result);
5304 return X.Iter == Y.Iter;
5309 return X.Iter != Y.Iter;
5313template<
typename Derived>
5314template<
typename InputIterator>
5334 PackLocIterator(*
this, In.getArgument().pack_begin()),
5335 PackLocIterator(*
this, In.getArgument().pack_end()), *PackOutput,
5342 if (In.getArgument().isPackExpansion()) {
5354 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5364 if (Out.getArgument().containsUnexpandedParameterPack()) {
5367 if (Out.getArgument().isNull())
5377 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5385 if (Out.getArgument().isNull())
5404template <
typename Derived>
5405template <
typename InputIterator>
5414 return !Arg.isDependent() && Arg.isConceptOrConceptTemplateParameter();
5426 PackLocIterator(*
this, In.getArgument().pack_begin()),
5427 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5433 if (!isNonDependentConceptArgument(In.getArgument())) {
5448template <
typename Derived>
5459 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5462 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5463 if (IsLateExpansionAttempt) {
5470 if (!SawPackTypes) {
5475 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5483 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5489 if (ComputeInfo(In,
false, Info, Pattern))
5501 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5502 std::in_place,
getSema(), std::nullopt);
5508 if (Out.getArgument().isNull())
5545 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5546 if (ComputeInfo(Out,
true, Info, OutPattern))
5559template<
typename Derived>
5577template <
typename Derived>
5597template<
typename Derived>
5600 switch (
T.getTypeLocClass()) {
5601#define ABSTRACT_TYPELOC(CLASS, PARENT)
5602#define TYPELOC(CLASS, PARENT) \
5603 case TypeLoc::CLASS: \
5604 return getDerived().Transform##CLASS##Type(TLB, \
5605 T.castAs<CLASS##TypeLoc>());
5606#include "clang/AST/TypeLocNodes.def"
5609 llvm_unreachable(
"unhandled type loc!");
5612template<
typename Derived>
5625template <
typename Derived>
5663template<
typename Derived>
5668 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5669 auto SuppressObjCLifetime =
5670 T.getType().getLocalQualifiers().hasObjCLifetime();
5672 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5673 SuppressObjCLifetime);
5674 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5675 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5676 TLB, STTP, SuppressObjCLifetime);
5678 Result = getDerived().TransformType(TLB, UnqualTL);
5697template <
typename Derived>
5707 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5714 if (
T.getPointerAuth().isPresent()) {
5715 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5718 if (!
T->isDependentType()) {
5719 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5720 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5728 if (
T->isFunctionType()) {
5729 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5739 if (
T->isReferenceType()) {
5749 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5751 else if (
T.getObjCLifetime()) {
5755 const AutoType *AutoTy;
5756 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5762 SemaRef.Context.getQualifiedType(
Deduced.getUnqualifiedType(), Qs);
5764 AutoTy->getKeyword(),
5765 AutoTy->getTypeConstraintConcept(),
5766 AutoTy->getTypeConstraintArguments());
5771 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5777 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5780template <
typename Derived>
5781QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5784 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5787 case TypeLoc::TemplateSpecialization:
5788 return getDerived().TransformTemplateSpecializationType(
5790 FirstQualifierInScope,
true);
5791 case TypeLoc::DependentName:
5792 return getDerived().TransformDependentNameType(
5794 ObjectType, FirstQualifierInScope);
5798 return getDerived().TransformType(TLB, TL);
5802template <
class TyLoc>
static inline
5804 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5805 NewT.setNameLoc(
T.getNameLoc());
5809template<
typename Derived>
5810QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5812 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5813 NewT.setBuiltinLoc(T.getBuiltinLoc());
5814 if (T.needsExtraLocalData())
5815 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5819template<
typename Derived>
5826template <
typename Derived>
5830 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5833template<
typename Derived>
5836 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5837 if (OriginalType.isNull())
5841 if (getDerived().AlwaysRebuild() ||
5842 OriginalType != TL.getOriginalLoc().getType())
5849template <
typename Derived>
5853 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5854 if (OriginalType.isNull())
5858 if (getDerived().AlwaysRebuild() ||
5859 OriginalType != TL.getElementLoc().getType())
5866template<
typename Derived>
5870 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5871 if (PointeeType.isNull())
5875 if (PointeeType->getAs<ObjCObjectType>()) {
5887 if (getDerived().AlwaysRebuild() ||
5888 PointeeType != TL.getPointeeLoc().getType()) {
5889 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5896 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5903template<
typename Derived>
5908 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5909 if (PointeeType.isNull())
5913 if (getDerived().AlwaysRebuild() ||
5914 PointeeType != TL.getPointeeLoc().getType()) {
5915 Result = getDerived().RebuildBlockPointerType(PointeeType,
5930template<
typename Derived>
5938 if (PointeeType.
isNull())
5943 PointeeType !=
T->getPointeeTypeAsWritten()) {
5945 T->isSpelledAsLValue(),
5967template<
typename Derived>
5971 return TransformReferenceType(TLB, TL);
5974template<
typename Derived>
5976TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5977 RValueReferenceTypeLoc TL) {
5978 return TransformReferenceType(TLB, TL);
5981template<
typename Derived>
5985 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5986 if (PointeeType.isNull())
5993 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5994 if (!NewQualifierLoc)
5997 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5999 NewCls = cast_or_null<CXXRecordDecl>(
6000 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
6006 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
6007 NewQualifierLoc.getNestedNameSpecifier() !=
6008 OldQualifierLoc.getNestedNameSpecifier() ||
6011 SS.
Adopt(NewQualifierLoc);
6012 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
6021 if (MPT && PointeeType != MPT->getPointeeType()) {
6028 NewTL.setQualifierLoc(NewQualifierLoc);
6033template<
typename Derived>
6038 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6039 if (ElementType.isNull())
6043 Expr *OldSize = TL.getSizeExpr();
6045 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
6046 Expr *NewSize =
nullptr;
6050 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
6055 if (getDerived().AlwaysRebuild() ||
6056 ElementType !=
T->getElementType() ||
6057 (
T->getSizeExpr() && NewSize != OldSize)) {
6058 Result = getDerived().RebuildConstantArrayType(ElementType,
6059 T->getSizeModifier(),
6060 T->getSize(), NewSize,
6061 T->getIndexTypeCVRQualifiers(),
6062 TL.getBracketsRange());
6073 NewTL.setRBracketLoc(TL.getRBracketLoc());
6074 NewTL.setSizeExpr(NewSize);
6079template<
typename Derived>
6084 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6085 if (ElementType.isNull())
6089 if (getDerived().AlwaysRebuild() ||
6090 ElementType !=
T->getElementType()) {
6091 Result = getDerived().RebuildIncompleteArrayType(ElementType,
6092 T->getSizeModifier(),
6093 T->getIndexTypeCVRQualifiers(),
6094 TL.getBracketsRange());
6101 NewTL.setRBracketLoc(TL.getRBracketLoc());
6102 NewTL.setSizeExpr(
nullptr);
6107template<
typename Derived>
6112 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6113 if (ElementType.isNull())
6120 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
6122 if (SizeResult.isInvalid())
6126 if (SizeResult.isInvalid())
6132 if (getDerived().AlwaysRebuild() ||
6133 ElementType !=
T->getElementType() ||
6134 Size !=
T->getSizeExpr()) {
6135 Result = getDerived().RebuildVariableArrayType(ElementType,
6136 T->getSizeModifier(),
6138 T->getIndexTypeCVRQualifiers(),
6139 TL.getBracketsRange());
6148 NewTL.setRBracketLoc(TL.getRBracketLoc());
6149 NewTL.setSizeExpr(Size);
6154template<
typename Derived>
6159 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6160 if (ElementType.isNull())
6168 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
6171 Expr *origSize = TL.getSizeExpr();
6172 if (!origSize) origSize =
T->getSizeExpr();
6175 = getDerived().TransformExpr(origSize);
6177 if (sizeResult.isInvalid())
6180 Expr *size = sizeResult.get();
6183 if (getDerived().AlwaysRebuild() ||
6184 ElementType !=
T->getElementType() ||
6186 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
6187 T->getSizeModifier(),
6189 T->getIndexTypeCVRQualifiers(),
6190 TL.getBracketsRange());
6199 NewTL.setRBracketLoc(TL.getRBracketLoc());
6200 NewTL.setSizeExpr(size);
6205template <
typename Derived>
6209 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6210 if (ElementType.isNull())
6218 if (
Size.isInvalid())
6222 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6223 Size.get() !=
T->getSizeExpr()) {
6224 Result = getDerived().RebuildDependentVectorType(
6225 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
6243template<
typename Derived>
6250 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6251 if (ElementType.isNull())
6260 if (
Size.isInvalid())
6264 if (getDerived().AlwaysRebuild() ||
6265 ElementType !=
T->getElementType() ||
6266 Size.get() !=
T->getSizeExpr()) {
6267 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6269 T->getAttributeLoc());
6287template <
typename Derived>
6292 QualType ElementType = getDerived().TransformType(
T->getElementType());
6293 if (ElementType.isNull())
6297 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6298 Result = getDerived().RebuildConstantMatrixType(
6299 ElementType,
T->getNumRows(),
T->getNumColumns(), TL.getAttrNameLoc());
6306 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6307 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6308 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6313template <
typename Derived>
6318 QualType ElementType = getDerived().TransformType(
T->getElementType());
6319 if (ElementType.isNull()) {
6327 Expr *origRows = TL.getAttrRowOperand();
6329 origRows =
T->getRowExpr();
6330 Expr *origColumns = TL.getAttrColumnOperand();
6332 origColumns =
T->getColumnExpr();
6334 ExprResult rowResult = getDerived().TransformExpr(origRows);
6336 if (rowResult.isInvalid())
6339 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6341 if (columnResult.isInvalid())
6344 Expr *rows = rowResult.get();
6345 Expr *columns = columnResult.get();
6348 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6349 rows != origRows || columns != origColumns) {
6350 Result = getDerived().RebuildDependentSizedMatrixType(
6351 ElementType, rows, columns,
T->getAttributeLoc());
6361 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6362 NewTL.setAttrRowOperand(rows);
6363 NewTL.setAttrColumnOperand(columns);
6367template <
typename Derived>
6373 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6382 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6384 if (AddrSpace.isInvalid())
6388 if (getDerived().AlwaysRebuild() ||
pointeeType !=
T->getPointeeType() ||
6389 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6390 Result = getDerived().RebuildDependentAddressSpaceType(
6402 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6403 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6406 TLB.TypeWasModifiedSafely(
Result);
6412template <
typename Derived>
6416 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6417 if (ElementType.isNull())
6421 if (getDerived().AlwaysRebuild() ||
6422 ElementType !=
T->getElementType()) {
6423 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6424 T->getVectorKind());
6435template<
typename Derived>
6439 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6440 if (ElementType.isNull())
6444 if (getDerived().AlwaysRebuild() ||
6445 ElementType !=
T->getElementType()) {
6446 Result = getDerived().RebuildExtVectorType(ElementType,
6447 T->getNumElements(),
6459template <
typename Derived>
6462 bool ExpectParameterPack) {
6497 if (NewTSI == OldTSI && indexAdjustment == 0)
6507 getDerived().transformedLocalDecl(OldParm, {newParm});
6511template <
typename Derived>
6519 unsigned *LastParamTransformed) {
6520 int indexAdjustment = 0;
6522 unsigned NumParams = Params.size();
6523 for (
unsigned i = 0; i != NumParams; ++i) {
6524 if (LastParamTransformed)
6525 *LastParamTransformed = i;
6527 assert(OldParm->getFunctionScopeIndex() == i);
6531 if (OldParm->isParameterPack()) {
6536 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6539 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6542 bool ShouldExpand =
false;
6543 bool RetainExpansion =
false;
6545 if (Unexpanded.size() > 0) {
6546 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6547 NumExpansions = OrigNumExpansions;
6551 ShouldExpand, RetainExpansion, NumExpansions)) {
6556 const AutoType *AT =
6557 Pattern.getType().getTypePtr()->getContainedAutoType();
6558 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6559 "Could not find parameter packs or undeduced auto type!");
6566 getDerived().ExpandingFunctionParameterPack(OldParm);
6567 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6570 =
getDerived().TransformFunctionTypeParam(OldParm,
6578 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6579 OutParamTypes.push_back(NewParm->
getType());
6581 PVars->push_back(NewParm);
6586 if (RetainExpansion) {
6587 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6589 =
getDerived().TransformFunctionTypeParam(OldParm,
6597 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6598 OutParamTypes.push_back(NewParm->
getType());
6600 PVars->push_back(NewParm);
6616 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6621 "Parameter pack no longer a parameter pack after "
6624 NewParm =
getDerived().TransformFunctionTypeParam(
6625 OldParm, indexAdjustment, std::nullopt,
6633 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6634 OutParamTypes.push_back(NewParm->
getType());
6636 PVars->push_back(NewParm);
6644 bool IsPackExpansion =
false;
6647 if (
const PackExpansionType *Expansion
6648 = dyn_cast<PackExpansionType>(OldType)) {
6650 QualType Pattern = Expansion->getPattern();
6652 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6655 bool ShouldExpand =
false;
6656 bool RetainExpansion =
false;
6660 RetainExpansion, NumExpansions)) {
6667 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6674 NewType =
getSema().getASTContext().getPackExpansionType(
6675 NewType, std::nullopt);
6682 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6683 OutParamTypes.push_back(NewType);
6685 PVars->push_back(
nullptr);
6694 if (RetainExpansion) {
6695 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6701 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6702 OutParamTypes.push_back(NewType);
6704 PVars->push_back(
nullptr);
6709 OldType = Expansion->getPattern();
6710 IsPackExpansion =
true;
6712 NewType =
getDerived().TransformType(OldType);
6714 NewType =
getDerived().TransformType(OldType);
6720 if (IsPackExpansion)
6721 NewType =
getSema().Context.getPackExpansionType(NewType,
6725 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6726 OutParamTypes.push_back(NewType);
6728 PVars->push_back(
nullptr);
6733 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6735 assert(parm->getFunctionScopeIndex() == i);
6742template<
typename Derived>
6747 return getDerived().TransformFunctionProtoType(
6751 ExceptionStorage, Changed);
6755template<
typename Derived>
template<
typename Fn>
6774 if (
T->hasTrailingReturn()) {
6778 T->getExtParameterInfosOrNull(),
6779 ParamTypes, &ParamDecls, ExtParamInfos))
6789 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6791 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6806 T->getExtParameterInfosOrNull(),
6807 ParamTypes, &ParamDecls, ExtParamInfos))
6813 bool EPIChanged =
false;
6818 if (
auto NewExtParamInfos =
6834 std::optional<FunctionEffectSet> NewFX;
6846 std::optional<FunctionEffectMode> Mode =
6866 "FunctionEffectMode::None shouldn't be possible here");
6869 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6872 NewFX->insert(NewEC, Errs);
6873 assert(Errs.empty());
6883 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6894 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6900template<
typename Derived>
6923 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6938 if (
const PackExpansionType *PackExpansion =
6939 T->getAs<PackExpansionType>()) {
6944 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6946 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6951 bool Expand =
false;
6952 bool RetainExpansion =
false;
6953 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6958 true, Expand, RetainExpansion,
6971 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6972 Exceptions.push_back(
U);
6978 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6982 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6985 Exceptions.push_back(
U);
6989 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6994 Exceptions.push_back(
U);
7004template<
typename Derived>
7014 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
7015 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
7026template <
typename Derived>
7027QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
7028 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
7030 const UnresolvedUsingType *T = TL.getTypePtr();
7031 bool Changed =
false;
7033 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
7034 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
7035 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7038 Changed |= QualifierLoc != OldQualifierLoc;
7041 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
7047 if (getDerived().AlwaysRebuild() || Changed) {
7048 Result = getDerived().RebuildUnresolvedUsingType(
7049 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
7057 QualifierLoc, TL.getNameLoc());
7060 QualifierLoc, TL.getNameLoc());
7064template <
typename Derived>
7072 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7075 Changed |= QualifierLoc != OldQualifierLoc;
7078 auto *D = cast_or_null<UsingShadowDecl>(
7079 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7084 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
7085 if (UnderlyingType.isNull())
7087 Changed |= UnderlyingType !=
T->desugar();
7090 if (getDerived().AlwaysRebuild() || Changed) {
7091 Result = getDerived().RebuildUsingType(
7092 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
7102template<
typename Derived>
7110 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7113 Changed |= QualifierLoc != OldQualifierLoc;
7116 auto *
Typedef = cast_or_null<TypedefNameDecl>(
7117 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
7125 if (getDerived().AlwaysRebuild() || Changed) {
7126 Result = getDerived().RebuildTypedefType(
7127 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
7133 QualifierLoc, TL.getNameLoc());
7137template<
typename Derived>
7145 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
7155 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
7157 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
7164 NewTL.setLParenLoc(TL.getLParenLoc());
7165 NewTL.setRParenLoc(TL.getRParenLoc());
7170template<
typename Derived>
7174 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
7180 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
7181 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
7188 NewTL.setLParenLoc(TL.getLParenLoc());
7189 NewTL.setRParenLoc(TL.getRParenLoc());
7190 NewTL.setUnmodifiedTInfo(New_Under_TI);
7195template<
typename Derived>
7198 const DecltypeType *
T = TL.getTypePtr();
7205 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
7209 E = getSema().ActOnDecltypeExpression(E.get());
7214 if (getDerived().AlwaysRebuild() ||
7215 E.get() !=
T->getUnderlyingExpr()) {
7216 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
7224 NewTL.setRParenLoc(TL.getRParenLoc());
7228template <
typename Derived>
7238 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
7239 if (IndexExpr.isInvalid())
7242 QualType Pattern = TL.getPattern();
7244 const PackIndexingType *PIT = TL.getTypePtr();
7248 bool NotYetExpanded = Types.empty();
7249 bool FullySubstituted =
true;
7251 if (Types.empty() && !PIT->expandsToEmptyPack())
7255 if (!
T->containsUnexpandedParameterPack()) {
7256 QualType Transformed = getDerived().TransformType(
T);
7257 if (Transformed.isNull())
7259 SubtitutedTypes.push_back(Transformed);
7264 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7265 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7268 bool ShouldExpand =
true;
7269 bool RetainExpansion =
false;
7271 if (getDerived().TryExpandParameterPacks(
7274 RetainExpansion, NumExpansions))
7276 if (!ShouldExpand) {
7282 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7285 if (NotYetExpanded) {
7286 FullySubstituted =
false;
7287 QualType Out = getDerived().RebuildPackIndexingType(
7288 Pack, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted);
7296 SubtitutedTypes.push_back(Pack);
7299 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7304 SubtitutedTypes.push_back(Out);
7305 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7309 if (RetainExpansion) {
7310 FullySubstituted =
false;
7311 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7315 SubtitutedTypes.push_back(Out);
7323 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7325 QualType Out = getDerived().RebuildPackIndexingType(
7326 Result, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted,
7336template<
typename Derived>
7342 if (
Result->isDependentType()) {
7343 const UnaryTransformType *
T = TL.getTypePtr();
7345 NewBaseTSI = getDerived().TransformType(TL.getUnderlyingTInfo());
7348 QualType NewBase = NewBaseTSI->getType();
7350 Result = getDerived().RebuildUnaryTransformType(NewBase,
7359 NewTL.setParensRange(TL.getParensRange());
7360 NewTL.setUnderlyingTInfo(NewBaseTSI);
7364template<
typename Derived>
7367 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7372 TL.getTemplateNameLoc());
7376 QualType OldDeduced =
T->getDeducedType();
7378 if (!OldDeduced.isNull()) {
7379 NewDeduced = getDerived().TransformType(OldDeduced);
7380 if (NewDeduced.isNull())
7384 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7392 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7393 NewTL.setQualifierLoc(QualifierLoc);
7397template <
typename Derived>
7404 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7409 auto *TD = cast_or_null<TagDecl>(
7416 TD !=
T->getDecl()) {
7417 if (
T->isCanonicalUnqualified())
7434template <
typename Derived>
7440template <
typename Derived>
7441QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7443 return getDerived().TransformTagType(TLB, TL);
7446template<
typename Derived>
7453template<
typename Derived>
7457 return getDerived().TransformTemplateTypeParmType(
7462template <
typename Derived>
7468template<
typename Derived>
7469QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7470 TypeLocBuilder &TLB,
7471 SubstTemplateTypeParmTypeLoc TL) {
7472 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7475 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7480 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7481 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7482 if (Replacement.isNull())
7486 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7490 SubstTemplateTypeParmTypeLoc NewTL
7491 = TLB.push<SubstTemplateTypeParmTypeLoc>(
Result);
7492 NewTL.setNameLoc(TL.getNameLoc());
7496template <
typename Derived>
7502template<
typename Derived>
7506 return getDerived().TransformSubstTemplateTypeParmPackType(
7510template <
typename Derived>
7516template<
typename Derived>
7517QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7519 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7520 if (ValueType.isNull())
7523 QualType
Result = TL.getType();
7524 if (getDerived().AlwaysRebuild() ||
7525 ValueType != TL.getValueLoc().getType()) {
7526 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7533 NewTL.setLParenLoc(TL.getLParenLoc());
7534 NewTL.setRParenLoc(TL.getRParenLoc());
7539template <
typename Derived>
7542 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7543 if (ValueType.isNull())
7547 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7550 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7561template <
typename Derived>
7567 if (getDerived().AlwaysRebuild()) {
7568 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7569 EIT->getNumBits(), TL.getNameLoc());
7579template <
typename Derived>
7586 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7589 if (BitsExpr.isInvalid())
7594 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7595 Result = getDerived().RebuildDependentBitIntType(
7596 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7612template <
typename Derived>
7615 llvm_unreachable(
"This type does not need to be transformed.");
7623 template<
typename ArgLocContainer>
7625 ArgLocContainer *Container;
7650 : Container(&Container), Index(Index) { }
7664 return Container->getArgLoc(Index);
7668 return pointer(Container->getArgLoc(Index));
7673 return X.Container == Y.Container &&
X.Index == Y.Index;
7682template<
typename Derived>
7683QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7685 const AutoType *T = TL.getTypePtr();
7686 QualType OldDeduced = T->getDeducedType();
7687 QualType NewDeduced;
7688 if (!OldDeduced.isNull()) {
7689 NewDeduced = getDerived().TransformType(OldDeduced);
7690 if (NewDeduced.isNull())
7697 if (
T->isConstrained()) {
7698 assert(TL.getConceptReference());
7699 NewCD = getDerived().TransformConceptTemplateName(
7700 T->getTypeConstraintConcept(), TL.getConceptNameLoc());
7704 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7705 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7707 if (getDerived().TransformTemplateArguments(
7708 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7712 if (TL.getNestedNameSpecifierLoc()) {
7714 = getDerived().TransformNestedNameSpecifierLoc(
7715 TL.getNestedNameSpecifierLoc());
7716 if (!NewNestedNameSpec)
7722 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7723 T->isDependentType() ||
T->isConstrained()) {
7726 NewArgList.reserve(NewTemplateArgs.size());
7727 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7728 NewArgList.push_back(ArgLoc.getArgument());
7729 Result = getDerived().RebuildAutoType(
7731 NewDeduced,
T->getKeyword(), NewCD, NewArgList);
7738 NewTL.setRParenLoc(TL.getRParenLoc());
7739 NewTL.setConceptReference(
nullptr);
7741 if (
T->isConstrained()) {
7745 TL.getConceptNameLoc())
7750 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7751 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7753 NewTL.setConceptReference(CR);
7759template <
typename Derived>
7762 return getDerived().TransformTemplateSpecializationType(
7767template <
typename Derived>
7770 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7771 const TemplateSpecializationType *
T = TL.
getTypePtr();
7777 AllowInjectedClassName);
7786 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7795 QualType Result = getDerived().RebuildTemplateSpecializationType(
7808template <
typename Derived>
7812 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7813 if (modifiedType.isNull())
7820 oldType->getAttrKind(), modifiedType,
7821 TL.getAttr() ? TL.getAttr()->getLocation()
7822 : TL.getModifiedLoc().getBeginLoc()))
7826 const Attr *oldAttr = TL.getAttr();
7827 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7828 if (oldAttr && !newAttr)
7834 if (getDerived().AlwaysRebuild() ||
7835 modifiedType != oldType->getModifiedType()) {
7848 QualType equivalentType = modifiedType;
7849 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7851 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7853 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7854 if (equivalentType.isNull())
7859 if (oldType->getAttrKind() == attr::HLSLRowMajor)
7862 else if (oldType->getAttrKind() == attr::HLSLColumnMajor)
7869 if (
auto nullability = oldType->getImmediateNullability()) {
7870 if (!modifiedType->canHaveNullability()) {
7871 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7872 : TL.getModifiedLoc().getBeginLoc()),
7873 diag::err_nullability_nonpointer)
7890template <
typename Derived>
7894 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7895 if (InnerTy.isNull())
7898 Expr *OldCount = TL.getCountExpr();
7899 Expr *NewCount =
nullptr;
7901 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7902 if (CountResult.isInvalid())
7904 NewCount = CountResult.get();
7908 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7909 OldCount != NewCount) {
7912 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7919template <
typename Derived>
7924 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7925 if (InnerTy.isNull())
7929 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getWrappedType()) {
7931 InnerTy, OldTy->getLateParsedAttribute());
7939template <
typename Derived>
7943 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7946template <
typename Derived>
7949 const OverflowBehaviorType *OldTy = TL.getTypePtr();
7950 QualType InnerTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7951 if (InnerTy.isNull())
7955 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->getUnderlyingType()) {
7967template <
typename Derived>
7971 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7973 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7974 if (WrappedTy.isNull())
7978 QualType OldContainedTy = oldType->getContainedType();
7980 if (!OldContainedTy.isNull()) {
7981 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7982 if (!oldContainedTSI)
7983 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7985 ContainedTSI = getDerived().TransformType(oldContainedTSI);
7988 ContainedTy = ContainedTSI->getType();
7991 HLSLAttributedResourceType::Attributes Attrs = oldType->getAttrs();
7992 if (Attrs.SampleCountExpr) {
7994 getDerived().TransformExpr(Attrs.SampleCountExpr);
7995 if (SampleCountResult.isInvalid())
7997 Attrs.SampleCountExpr = SampleCountResult.get();
8001 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
8002 ContainedTy != oldType->getContainedType() ||
8003 Attrs.SampleCountExpr != oldType->getSampleCountExpr()) {
8005 ContainedTy, Attrs);
8011 NewTL.setContainedTypeSourceInfo(ContainedTSI);
8015template <
typename Derived>
8019 return TL.getType();
8022template<
typename Derived>
8026 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8031 if (getDerived().AlwaysRebuild() ||
8032 Inner != TL.getInnerLoc().getType()) {
8033 Result = getDerived().RebuildParenType(Inner);
8040 NewTL.setRParenLoc(TL.getRParenLoc());
8044template <
typename Derived>
8048 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
8053 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
8055 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
8065template<
typename Derived>
8066QualType TreeTransform<Derived>::TransformDependentNameType(
8068 return TransformDependentNameType(TLB, TL,
false);
8071template <
typename Derived>
8072QualType TreeTransform<Derived>::TransformDependentNameType(
8075 const DependentNameType *
T = TL.getTypePtr();
8079 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
8080 QualifierLoc, ObjectType, UnqualLookup);
8084 assert((ObjectType.isNull() && !UnqualLookup) &&
8085 "must be transformed by TransformNestedNameSpecifierLoc");
8089 = getDerived().RebuildDependentNameType(
T->getKeyword(),
8090 TL.getElaboratedKeywordLoc(),
8101 NewTL.setQualifierLoc(QualifierLoc);
8102 NewTL.setNameLoc(TL.getNameLoc());
8106 NewTL.setTemplateNameLoc(TL.getNameLoc());
8107 NewTL.setQualifierLoc(QualifierLoc);
8110 QualifierLoc, TL.getNameLoc());
8113 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
8117 NewTL.setQualifierLoc(QualifierLoc);
8118 NewTL.setNameLoc(TL.getNameLoc());
8123template<
typename Derived>
8127 = getDerived().TransformType(TLB, TL.getPatternLoc());
8128 if (Pattern.isNull())
8132 if (getDerived().AlwaysRebuild() ||
8133 Pattern != TL.getPatternLoc().getType()) {
8134 Result = getDerived().RebuildPackExpansionType(Pattern,
8135 TL.getPatternLoc().getSourceRange(),
8136 TL.getEllipsisLoc(),
8137 TL.getTypePtr()->getNumExpansions());
8147template<
typename Derived>
8152 TLB.pushFullCopy(TL);
8153 return TL.getType();
8156template<
typename Derived>
8160 const ObjCTypeParamType *
T = TL.getTypePtr();
8162 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
8167 if (getDerived().AlwaysRebuild() ||
8168 OTP !=
T->getDecl()) {
8169 Result = getDerived().RebuildObjCTypeParamType(
8170 OTP, TL.getProtocolLAngleLoc(),
8171 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8172 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8178 if (TL.getNumProtocols()) {
8179 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8180 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8181 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
8182 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8187template<
typename Derived>
8192 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
8193 if (BaseType.isNull())
8196 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
8200 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
8202 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
8203 QualType TypeArg = TypeArgInfo->getType();
8208 const auto *PackExpansion = PackExpansionLoc.getType()
8209 ->castAs<PackExpansionType>();
8213 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
8217 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
8218 bool Expand =
false;
8219 bool RetainExpansion =
false;
8220 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
8221 if (getDerived().TryExpandParameterPacks(
8222 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
8223 Unexpanded,
true, Expand,
8224 RetainExpansion, NumExpansions))
8234 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8235 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
8237 if (NewPatternType.isNull())
8241 NewPatternType, NumExpansions);
8243 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
8244 NewTypeArgInfos.push_back(
8245 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
8251 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
8255 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
8257 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
8259 if (NewTypeArg.isNull())
8262 NewTypeArgInfos.push_back(
8263 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8270 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
8272 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
8273 if (NewTypeArg.isNull())
8277 if (NewTypeArg == TypeArg) {
8278 NewTypeArgInfos.push_back(TypeArgInfo);
8282 NewTypeArgInfos.push_back(
8283 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
8288 if (getDerived().AlwaysRebuild() || AnyChanged) {
8290 Result = getDerived().RebuildObjCObjectType(
8291 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
8292 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
8293 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8294 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
8302 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
8303 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
8304 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
8305 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
8306 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
8307 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
8308 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
8309 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
8313template<
typename Derived>
8317 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
8318 if (PointeeType.isNull())
8322 if (getDerived().AlwaysRebuild() ||
8323 PointeeType != TL.getPointeeLoc().getType()) {
8324 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
8338template<
typename Derived>
8344template<
typename Derived>
8347 return getDerived().TransformCompoundStmt(S,
false);
8350template<
typename Derived>
8357 getSema().resetFPOptions(
8360 bool SubStmtInvalid =
false;
8361 bool SubStmtChanged =
false;
8363 for (
auto *B : S->
body()) {
8365 B, IsStmtExpr && B == S->
body_back() ? StmtDiscardKind::StmtExprResult
8366 : StmtDiscardKind::Discarded);
8368 if (
Result.isInvalid()) {
8375 SubStmtInvalid =
true;
8379 SubStmtChanged = SubStmtChanged ||
Result.get() != B;
8380 Statements.push_back(
Result.getAs<Stmt>());
8386 if (!getDerived().AlwaysRebuild() &&
8390 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8396template<
typename Derived>
8405 LHS = getDerived().TransformExpr(S->getLHS());
8407 if (LHS.isInvalid())
8411 RHS = getDerived().TransformExpr(S->getRHS());
8413 if (RHS.isInvalid())
8420 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8422 S->getEllipsisLoc(),
8425 if (Case.isInvalid())
8430 getDerived().TransformStmt(S->getSubStmt());
8431 if (SubStmt.isInvalid())
8435 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8438template <
typename Derived>
8442 getDerived().TransformStmt(S->getSubStmt());
8443 if (SubStmt.isInvalid())
8447 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8451template<
typename Derived>
8454 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8455 if (SubStmt.isInvalid())
8458 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8466 if (LD == S->getDecl())
8467 S->getDecl()->setStmt(
nullptr);
8470 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8475template <
typename Derived>
8480 switch (R->getKind()) {
8484 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8485#include "clang/Basic/AttrList.inc"
8490template <
typename Derived>
8497 switch (R->getKind()) {
8501 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8502#include "clang/Basic/AttrList.inc"
8507template <
typename Derived>
8510 StmtDiscardKind SDK) {
8515 bool AttrsChanged =
false;
8519 for (
const auto *I : S->
getAttrs()) {
8521 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8522 AttrsChanged |= (I != R);
8535 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8539template<
typename Derived>
8544 if (
Init.isInvalid())
8548 if (!S->isConsteval()) {
8550 Cond = getDerived().TransformCondition(
8551 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8554 if (Cond.isInvalid())
8559 std::optional<bool> ConstexprConditionValue;
8560 if (S->isConstexpr())
8565 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8569 S->isNonNegatedConsteval());
8571 Then = getDerived().TransformStmt(S->getThen());
8572 if (Then.isInvalid())
8578 Then =
new (getSema().Context)
8579 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8584 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8588 S->isNegatedConsteval());
8590 Else = getDerived().TransformStmt(S->getElse());
8591 if (Else.isInvalid())
8593 }
else if (S->getElse() && ConstexprConditionValue &&
8594 *ConstexprConditionValue) {
8598 Else =
new (getSema().Context)
8599 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8602 if (!getDerived().AlwaysRebuild() &&
8603 Init.get() == S->getInit() &&
8604 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8605 Then.get() == S->getThen() &&
8606 Else.get() == S->getElse())
8609 return getDerived().RebuildIfStmt(
8610 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8611 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8614template<
typename Derived>
8619 if (
Init.isInvalid())
8624 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8626 if (Cond.isInvalid())
8631 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8632 Init.get(), Cond, S->getRParenLoc());
8637 StmtResult Body = getDerived().TransformStmt(S->getBody());
8640 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8644template<
typename Derived>
8649 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8651 if (Cond.isInvalid())
8660 StmtResult Body = getDerived().TransformStmt(S->getBody());
8661 if (Body.isInvalid())
8664 if (!getDerived().AlwaysRebuild() &&
8665 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8666 Body.get() == S->getBody())
8669 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8670 Cond, S->getRParenLoc(), Body.get());
8673template<
typename Derived>
8682 StmtResult Body = getDerived().TransformStmt(S->getBody());
8683 if (Body.isInvalid())
8687 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8688 if (Cond.isInvalid())
8691 if (!getDerived().AlwaysRebuild() &&
8692 Cond.get() == S->getCond() &&
8693 Body.get() == S->getBody())
8696 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8697 S->getWhileLoc(), Cond.get(),
8701template<
typename Derived>
8704 if (getSema().getLangOpts().getOpenMPVersion())
8705 getSema().OpenMP().startOpenMPLoop();
8709 if (
Init.isInvalid())
8714 if (getSema().getLangOpts().getOpenMPVersion() &&
Init.isUsable())
8715 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8720 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8722 if (Cond.isInvalid())
8727 if (
Inc.isInvalid())
8731 if (S->getInc() && !FullInc.get())
8738 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8739 Cond.get().second, S->getInc(),
Inc.get());
8742 StmtResult Body = getDerived().TransformStmt(S->getBody());
8743 if (Body.isInvalid())
8748 if (!getDerived().AlwaysRebuild() &&
8749 Init.get() == S->getInit() &&
8750 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8751 Inc.get() == S->getInc() &&
8752 Body.get() == S->getBody())
8755 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8756 Init.get(), Cond, FullInc,
8757 S->getRParenLoc(), Body.get());
8760template<
typename Derived>
8763 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8769 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8773template<
typename Derived>
8781 if (!getDerived().AlwaysRebuild() &&
8782 Target.get() == S->getTarget())
8785 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8789template<
typename Derived>
8792 if (!S->hasLabelTarget())
8795 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8804template<
typename Derived>
8807 if (!S->hasLabelTarget())
8810 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8819template <
typename Derived>
8827template<
typename Derived>
8837 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8840template<
typename Derived>
8843 bool DeclChanged =
false;
8846 for (
auto *D : S->decls()) {
8847 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8851 if (Transformed != D)
8855 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8856 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8857 LSI->ContainsUnexpandedParameterPack |=
8858 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8860 LSI->ContainsUnexpandedParameterPack |=
8863 .getTypeDeclType(TD)
8864 ->containsUnexpandedParameterPack();
8867 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8868 LSI->ContainsUnexpandedParameterPack |=
8869 VD->getType()->containsUnexpandedParameterPack();
8872 Decls.push_back(Transformed);
8875 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8878 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8881template<
typename Derived>
8891 bool ExprsChanged =
false;
8893 auto RebuildString = [&](
Expr *E) {
8898 ExprsChanged =
true;
8905 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8906 Names.push_back(S->getOutputIdentifier(I));
8912 Constraints.push_back(
Result.get());
8915 Expr *OutputExpr = S->getOutputExpr(I);
8916 Result = getDerived().TransformExpr(OutputExpr);
8920 ExprsChanged |=
Result.get() != OutputExpr;
8922 Exprs.push_back(
Result.get());
8926 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8927 Names.push_back(S->getInputIdentifier(I));
8933 Constraints.push_back(
Result.get());
8936 Expr *InputExpr = S->getInputExpr(I);
8937 Result = getDerived().TransformExpr(InputExpr);
8941 ExprsChanged |=
Result.get() != InputExpr;
8943 Exprs.push_back(
Result.get());
8947 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8948 Names.push_back(S->getLabelIdentifier(I));
8953 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8954 Exprs.push_back(
Result.get());
8958 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8962 Clobbers.push_back(
Result.get());
8965 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8966 if (AsmString.isInvalid())
8969 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8972 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8973 S->isVolatile(), S->getNumOutputs(),
8974 S->getNumInputs(), Names.data(),
8975 Constraints, Exprs, AsmString.get(),
8976 Clobbers, S->getNumLabels(),
8980template<
typename Derived>
8985 bool HadError =
false, HadChange =
false;
8989 TransformedExprs.reserve(SrcExprs.size());
8990 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8992 if (!
Result.isUsable()) {
8995 HadChange |= (
Result.get() != SrcExprs[i]);
8996 TransformedExprs.push_back(
Result.get());
9001 if (!HadChange && !getDerived().AlwaysRebuild())
9004 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
9005 AsmToks, S->getAsmString(),
9006 S->getNumOutputs(), S->getNumInputs(),
9007 S->getAllConstraints(), S->getClobbers(),
9008 TransformedExprs, S->getEndLoc());
9012template<
typename Derived>
9017 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
9018 ScopeInfo->NeedsCoroutineSuspends &&
9019 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
9020 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
9021 "expected clean scope info");
9025 ScopeInfo->setNeedsCoroutineSuspends(
false);
9038 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
9039 ScopeInfo->CoroutinePromise = Promise;
9044 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
9045 if (InitSuspend.isInvalid())
9048 getDerived().TransformStmt(S->getFinalSuspendStmt());
9049 if (FinalSuspend.isInvalid() ||
9052 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
9055 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
9056 if (BodyRes.isInvalid())
9060 if (Builder.isInvalid())
9063 Expr *ReturnObject = S->getReturnValueInit();
9064 assert(ReturnObject &&
"the return object is expected to be valid");
9065 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
9067 if (Res.isInvalid())
9069 Builder.ReturnValue = Res.get();
9074 if (S->hasDependentPromiseType()) {
9077 if (!Promise->getType()->isDependentType()) {
9078 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
9079 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
9080 "these nodes should not have been built yet");
9081 if (!Builder.buildDependentStatements())
9085 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
9086 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
9087 if (Res.isInvalid())
9089 Builder.OnFallthrough = Res.get();
9092 if (
auto *OnException = S->getExceptionHandler()) {
9093 StmtResult Res = getDerived().TransformStmt(OnException);
9094 if (Res.isInvalid())
9096 Builder.OnException = Res.get();
9099 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
9100 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
9101 if (Res.isInvalid())
9103 Builder.ReturnStmtOnAllocFailure = Res.get();
9107 assert(S->getAllocate() && S->getDeallocate() &&
9108 "allocation and deallocation calls must already be built");
9109 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
9110 if (AllocRes.isInvalid())
9112 Builder.Allocate = AllocRes.get();
9114 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
9115 if (DeallocRes.isInvalid())
9117 Builder.Deallocate = DeallocRes.get();
9119 if (
auto *ResultDecl = S->getResultDecl()) {
9120 StmtResult Res = getDerived().TransformStmt(ResultDecl);
9121 if (Res.isInvalid())
9123 Builder.ResultDecl = Res.get();
9128 if (Res.isInvalid())
9130 Builder.ReturnStmt = Res.get();
9134 return getDerived().RebuildCoroutineBodyStmt(Builder);
9137template<
typename Derived>
9147 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
9151template <
typename Derived>
9164 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
9165 getSema().getCurScope(), E->getKeywordLoc());
9169 return getDerived().RebuildCoawaitExpr(
9170 E->getKeywordLoc(),
Operand.get(),
9174template <
typename Derived>
9177 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
9179 if (OperandResult.isInvalid())
9183 E->getOperatorCoawaitLookup());
9190 return getDerived().RebuildDependentCoawaitExpr(
9191 E->getKeywordLoc(), OperandResult.get(),
9195template<
typename Derived>
9205 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
9210template<
typename Derived>
9214 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
9215 if (TryBody.isInvalid())
9219 bool AnyCatchChanged =
false;
9221 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
9222 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
9223 if (Catch.isInvalid())
9225 if (Catch.get() != S->getCatchStmt(I))
9226 AnyCatchChanged =
true;
9227 CatchStmts.push_back(Catch.get());
9232 if (S->getFinallyStmt()) {
9233 Finally = getDerived().TransformStmt(S->getFinallyStmt());
9234 if (Finally.isInvalid())
9239 if (!getDerived().AlwaysRebuild() &&
9240 TryBody.get() == S->getTryBody() &&
9242 Finally.get() == S->getFinallyStmt())
9246 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
9247 CatchStmts, Finally.get());
9250template<
typename Derived>
9255 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
9257 if (FromVar->getTypeSourceInfo()) {
9258 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
9265 T = TSInfo->getType();
9267 T = getDerived().TransformType(FromVar->getType());
9272 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
9277 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
9278 if (Body.isInvalid())
9281 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
9286template<
typename Derived>
9290 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
9291 if (Body.isInvalid())
9295 if (!getDerived().AlwaysRebuild() &&
9296 Body.get() == S->getFinallyBody())
9300 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
9304template<
typename Derived>
9308 if (S->getThrowExpr()) {
9309 Operand = getDerived().TransformExpr(S->getThrowExpr());
9314 if (!getDerived().AlwaysRebuild() &&
9315 Operand.get() == S->getThrowExpr())
9318 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
9321template<
typename Derived>
9330 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
9336 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
9337 if (Body.isInvalid())
9341 if (!getDerived().AlwaysRebuild() &&
9342 Object.get() == S->getSynchExpr() &&
9343 Body.get() == S->getSynchBody())
9347 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
9348 Object.get(), Body.get());
9351template<
typename Derived>
9356 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9357 if (Body.isInvalid())
9361 if (!getDerived().AlwaysRebuild() &&
9362 Body.get() == S->getSubStmt())
9366 return getDerived().RebuildObjCAutoreleasePoolStmt(
9367 S->getAtLoc(), Body.get());
9370template<
typename Derived>
9375 StmtResult Element = getDerived().TransformStmt(
9376 S->getElement(), StmtDiscardKind::NotDiscarded);
9377 if (Element.isInvalid())
9381 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9382 if (Collection.isInvalid())
9386 StmtResult Body = getDerived().TransformStmt(S->getBody());
9387 if (Body.isInvalid())
9391 if (!getDerived().AlwaysRebuild() &&
9392 Element.get() == S->getElement() &&
9393 Collection.get() == S->getCollection() &&
9394 Body.get() == S->getBody())
9398 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9405template <
typename Derived>
9409 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9411 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9415 Var = getDerived().RebuildExceptionDecl(
9416 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9417 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9418 if (!Var || Var->isInvalidDecl())
9423 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9424 if (Handler.isInvalid())
9427 if (!getDerived().AlwaysRebuild() && !Var &&
9428 Handler.get() == S->getHandlerBlock())
9431 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9434template <
typename Derived>
9437 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9438 if (TryBlock.isInvalid())
9442 bool HandlerChanged =
false;
9444 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9445 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9446 if (Handler.isInvalid())
9449 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9450 Handlers.push_back(Handler.getAs<
Stmt>());
9453 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9455 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9459 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9463template<
typename Derived>
9474 auto &LastRecord = getSema().currentEvaluationContext();
9475 LastRecord.InLifetimeExtendingContext =
true;
9476 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9479 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9480 if (
Init.isInvalid())
9484 if (
Range.isInvalid())
9489 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9490 auto ForRangeLifetimeExtendTemps =
9491 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9493 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9494 if (Begin.isInvalid())
9496 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9497 if (End.isInvalid())
9500 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9501 if (Cond.isInvalid())
9505 if (Cond.isInvalid())
9511 if (
Inc.isInvalid())
9516 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9517 if (LoopVar.isInvalid())
9521 if (getDerived().AlwaysRebuild() ||
9522 Init.get() != S->getInit() ||
9523 Range.get() != S->getRangeStmt() ||
9524 Begin.get() != S->getBeginStmt() ||
9525 End.get() != S->getEndStmt() ||
9526 Cond.get() != S->getCond() ||
9527 Inc.get() != S->getInc() ||
9528 LoopVar.get() != S->getLoopVarStmt()) {
9529 NewStmt = getDerived().RebuildCXXForRangeStmt(
9530 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9531 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9532 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9533 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9535 getSema().ActOnInitializerError(
9546 StmtResult Body = getDerived().TransformStmt(S->getBody());
9547 if (Body.isInvalid())
9554 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9555 NewStmt = getDerived().RebuildCXXForRangeStmt(
9556 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9557 Range.get(), Begin.get(), End.get(), Cond.get(),
Inc.get(),
9558 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9559 if (NewStmt.isInvalid())
9563 if (NewStmt.get() == S)
9566 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9569template <
typename Derived>
9575 getDerived().TransformDecl(S->getDecl()->getLocation(), S->getDecl());
9576 if (!ESD || ESD->isInvalidDecl())
9583 auto TransformStmtInParentContext = [&](
Stmt *SubStmt) ->
StmtResult {
9586 return getDerived().TransformStmt(SubStmt);
9605 if (S->isDependent() || S->isIterating()) {
9611 if (S->isDependent()) {
9617 ExpansionInitializer =
9618 getDerived().TransformExpr(S->getExpansionInitializer());
9619 if (ExpansionInitializer.isInvalid())
9621 }
else if (S->isIterating()) {
9622 Range = TransformStmtInParentContext(S->getRangeVarStmt());
9623 if (
Range.isInvalid())
9627 ExpansionInitializer =
9630 LifetimeExtendTemps =
9635 if (S->isEnumerating()) {
9637 getDerived().TransformStmt(S->getExpansionVarStmt());
9638 if (ExpansionVar.isInvalid())
9643 S->getLParenLoc(), S->getColonLoc(), S->getRParenLoc());
9644 }
else if (S->isIterating()) {
9645 StmtResult Begin = TransformStmtInParentContext(S->getBeginVarStmt());
9646 StmtResult Iter = TransformStmtInParentContext(S->getIterVarStmt());
9647 if (Begin.isInvalid() || Iter.isInvalid())
9654 getDerived().TransformStmt(S->getExpansionVarStmt());
9655 if (ExpansionVar.isInvalid())
9661 Iter.getAs<
DeclStmt>(), S->getLParenLoc(), S->getColonLoc(),
9665 NewPattern->getRangeVar(), LifetimeExtendTemps);
9666 }
else if (S->isDependent()) {
9668 getDerived().TransformStmt(S->getExpansionVarStmt());
9669 if (ExpansionVar.isInvalid())
9674 ExpansionInitializer.get(), S->getLParenLoc(), S->getColonLoc(),
9675 S->getRParenLoc(), LifetimeExtendTemps);
9677 if (Res.isInvalid())
9687 llvm_unreachable(
"destructuring pattern should never be instantiated");
9690 StmtResult Body = getDerived().TransformStmt(S->getBody());
9691 if (Body.isInvalid())
9697template <
typename Derived>
9700 bool SubStmtChanged =
false;
9703 for (
Stmt *OldDS : OldStmts) {
9704 StmtResult NewDS = getDerived().TransformStmt(OldDS);
9705 if (NewDS.isInvalid())
9708 SubStmtChanged |= NewDS.get() != OldDS;
9709 NewStmts.push_back(NewDS.get());
9716 getDerived().TransformDecl(S->getParent()->getLocation(), S->getParent());
9717 if (!ESD || ESD->isInvalidDecl())
9731 if (TransformStmts(PreambleStmts, S->getPreambleStmts()))
9734 if (S->shouldApplyLifetimeExtensionToPreamble()) {
9742 if (TransformStmts(Instantiations, S->getInstantiations()))
9745 if (!getDerived().AlwaysRebuild() && !SubStmtChanged)
9749 SemaRef.
Context, NewESD, Instantiations, PreambleStmts,
9750 S->shouldApplyLifetimeExtensionToPreamble());
9753template <
typename Derived>
9757 ExprResult Idx = getDerived().TransformExpr(E->getIndexExpr());
9758 if (
Range.isInvalid() || Idx.isInvalid())
9761 if (!getDerived().AlwaysRebuild() &&
Range.get() == E->getRangeExpr() &&
9762 Idx.get() == E->getIndexExpr())
9769template<
typename Derived>
9775 if (S->getQualifierLoc()) {
9777 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9784 if (NameInfo.getName()) {
9785 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9786 if (!NameInfo.getName())
9791 if (!getDerived().AlwaysRebuild() &&
9792 QualifierLoc == S->getQualifierLoc() &&
9793 NameInfo.getName() == S->getNameInfo().getName())
9798 SS.
Adopt(QualifierLoc);
9800 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9802 if (S->isIfExists())
9805 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9808 if (S->isIfNotExists())
9811 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9822 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9823 if (SubStmt.isInvalid())
9831 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9838template<
typename Derived>
9842 if (E->getQualifierLoc()) {
9844 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9850 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9855 if (
Base.isInvalid())
9861 QualifierLoc, E->getMemberLoc());
9864template <
typename Derived>
9868 if (BaseRes.isInvalid())
9870 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9871 if (IdxRes.isInvalid())
9874 if (!getDerived().AlwaysRebuild() &&
9875 BaseRes.get() == E->getBase() &&
9876 IdxRes.get() == E->getIdx())
9879 return getDerived().RebuildArraySubscriptExpr(
9880 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9883template <
typename Derived>
9885 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9886 if (TryBlock.isInvalid())
9889 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9890 if (Handler.isInvalid())
9893 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9894 Handler.get() == S->getHandler())
9897 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9898 TryBlock.get(), Handler.get());
9901template <
typename Derived>
9904 if (
Block.isInvalid())
9907 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9910template <
typename Derived>
9912 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9913 if (FilterExpr.isInvalid())
9917 if (
Block.isInvalid())
9920 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9924template <
typename Derived>
9932template<
typename Derived>
9942template <
typename Derived>
9944TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9948 return getDerived().TransformStmt(L->getLoopStmt());
9951template <
typename Derived>
9958 TClauses.reserve(Clauses.size());
9962 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9964 getDerived().getSema().OpenMP().EndOpenMPClause();
9966 TClauses.push_back(Clause);
9968 TClauses.push_back(
nullptr);
9972 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9973 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9974 D->getDirectiveKind(),
9980 if (D->getDirectiveKind() == OMPD_atomic ||
9981 D->getDirectiveKind() == OMPD_critical ||
9982 D->getDirectiveKind() == OMPD_section ||
9983 D->getDirectiveKind() == OMPD_master)
9984 CS = D->getAssociatedStmt();
9986 CS = D->getRawStmt();
9989 getSema().getLangOpts().OpenMPIRBuilder)
9993 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9998 if (TClauses.size() != Clauses.size()) {
10004 if (D->getDirectiveKind() == OMPD_critical) {
10006 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
10009 if (D->getDirectiveKind() == OMPD_cancellation_point) {
10011 }
else if (D->getDirectiveKind() == OMPD_cancel) {
10015 return getDerived().RebuildOMPExecutableDirective(
10016 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
10017 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
10025template <
typename Derived>
10032 TClauses.reserve(Clauses.size());
10035 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
10037 getDerived().getSema().OpenMP().EndOpenMPClause();
10039 TClauses.push_back(Clause);
10041 TClauses.push_back(
nullptr);
10045 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
10046 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
10047 D->getDirectiveKind(),
10052 assert(D->getDirectiveKind() == OMPD_assume &&
10053 "Unexpected informational directive");
10054 Stmt *CS = D->getAssociatedStmt();
10058 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
10062 if (TClauses.size() != Clauses.size())
10067 return getDerived().RebuildOMPInformationalDirective(
10068 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
10069 D->getBeginLoc(), D->getEndLoc());
10072template <
typename Derived>
10076 llvm::omp::Version OMPVersion =
10078 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
10079 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
10083template <
typename Derived>
10085TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
10086 DeclarationNameInfo DirName;
10087 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10088 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
10089 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10090 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10094template <
typename Derived>
10098 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10099 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
10100 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10101 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10105template <
typename Derived>
10109 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10110 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10111 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10112 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10116template <
typename Derived>
10120 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10121 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10122 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10123 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10127template <
typename Derived>
10131 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10132 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10133 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10134 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10138template <
typename Derived>
10142 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10143 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10144 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10145 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10149template <
typename Derived>
10151 OMPInterchangeDirective *D) {
10153 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10154 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10155 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10156 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10160template <
typename Derived>
10164 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10165 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10166 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10167 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10171template <
typename Derived>
10175 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10176 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10177 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10178 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10182template <
typename Derived>
10186 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10187 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
10188 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10189 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10193template <
typename Derived>
10197 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10198 OMPD_for, DirName,
nullptr, D->getBeginLoc());
10199 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10200 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10204template <
typename Derived>
10208 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10209 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
10210 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10211 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10215template <
typename Derived>
10219 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10220 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
10221 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10222 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10226template <
typename Derived>
10230 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10231 OMPD_section, DirName,
nullptr, D->getBeginLoc());
10232 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10233 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10237template <
typename Derived>
10241 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10242 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
10243 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10244 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10248template <
typename Derived>
10252 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10253 OMPD_single, DirName,
nullptr, D->getBeginLoc());
10254 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10255 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10259template <
typename Derived>
10263 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10264 OMPD_master, DirName,
nullptr, D->getBeginLoc());
10265 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10266 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10270template <
typename Derived>
10275 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10276 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10280template <
typename Derived>
10282 OMPParallelForDirective *D) {
10284 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10285 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
10286 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10287 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10291template <
typename Derived>
10293 OMPParallelForSimdDirective *D) {
10295 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10296 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10297 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10298 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10302template <
typename Derived>
10304 OMPParallelMasterDirective *D) {
10306 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10307 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
10308 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10309 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10313template <
typename Derived>
10315 OMPParallelMaskedDirective *D) {
10317 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10318 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
10319 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10320 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10324template <
typename Derived>
10326 OMPParallelSectionsDirective *D) {
10328 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10329 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
10330 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10331 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10335template <
typename Derived>
10339 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10340 OMPD_task, DirName,
nullptr, D->getBeginLoc());
10341 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10342 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10346template <
typename Derived>
10348 OMPTaskyieldDirective *D) {
10350 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10351 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
10352 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10353 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10357template <
typename Derived>
10361 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10362 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
10363 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10364 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10368template <
typename Derived>
10372 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10373 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
10374 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10375 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10379template <
typename Derived>
10383 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10384 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
10385 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
10386 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10390template <
typename Derived>
10394 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10395 OMPD_error, DirName,
nullptr, D->getBeginLoc());
10396 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10397 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10401template <
typename Derived>
10403 OMPTaskgroupDirective *D) {
10405 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10406 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
10407 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10408 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10412template <
typename Derived>
10416 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10417 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
10418 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10419 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10423template <
typename Derived>
10427 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10428 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
10429 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10430 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10434template <
typename Derived>
10438 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10439 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
10440 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10441 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10445template <
typename Derived>
10447 OMPOrderedStandaloneDirective *D) {
10449 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10450 OMPD_ordered_standalone, DirName,
nullptr, D->getBeginLoc());
10451 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10452 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10456template <
typename Derived>
10458 OMPOrderedBlockAssocDirective *D) {
10460 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10461 OMPD_ordered_blockassoc, DirName,
nullptr, D->getBeginLoc());
10462 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10463 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10467template <
typename Derived>
10471 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10472 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
10473 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10474 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10478template <
typename Derived>
10482 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10483 OMPD_target, DirName,
nullptr, D->getBeginLoc());
10484 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10485 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10489template <
typename Derived>
10491 OMPTargetDataDirective *D) {
10493 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10494 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
10495 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10496 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10500template <
typename Derived>
10502 OMPTargetEnterDataDirective *D) {
10504 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10505 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
10506 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10507 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10511template <
typename Derived>
10513 OMPTargetExitDataDirective *D) {
10515 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10516 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
10517 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10518 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10522template <
typename Derived>
10524 OMPTargetParallelDirective *D) {
10526 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10527 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
10528 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10529 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10533template <
typename Derived>
10535 OMPTargetParallelForDirective *D) {
10537 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10538 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
10539 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10540 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10544template <
typename Derived>
10546 OMPTargetUpdateDirective *D) {
10548 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10549 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
10550 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10551 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10555template <
typename Derived>
10559 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10560 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
10561 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10562 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10566template <
typename Derived>
10568 OMPCancellationPointDirective *D) {
10570 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10571 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
10572 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10573 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10577template <
typename Derived>
10581 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10582 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
10583 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10584 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10588template <
typename Derived>
10592 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10593 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10594 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10595 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10599template <
typename Derived>
10601 OMPTaskLoopSimdDirective *D) {
10603 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10604 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10605 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10606 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10610template <
typename Derived>
10612 OMPMasterTaskLoopDirective *D) {
10614 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10615 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10616 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10617 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10621template <
typename Derived>
10623 OMPMaskedTaskLoopDirective *D) {
10625 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10626 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10627 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10628 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10632template <
typename Derived>
10634 OMPMasterTaskLoopSimdDirective *D) {
10636 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10637 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10638 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10639 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10643template <
typename Derived>
10645 OMPMaskedTaskLoopSimdDirective *D) {
10647 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10648 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10649 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10650 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10654template <
typename Derived>
10656 OMPParallelMasterTaskLoopDirective *D) {
10658 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10659 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10660 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10661 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10665template <
typename Derived>
10667 OMPParallelMaskedTaskLoopDirective *D) {
10669 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10670 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10671 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10672 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10676template <
typename Derived>
10679 OMPParallelMasterTaskLoopSimdDirective *D) {
10681 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10682 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10683 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10684 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10688template <
typename Derived>
10691 OMPParallelMaskedTaskLoopSimdDirective *D) {
10693 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10694 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10695 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10696 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10700template <
typename Derived>
10702 OMPDistributeDirective *D) {
10704 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10705 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10706 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10707 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10711template <
typename Derived>
10713 OMPDistributeParallelForDirective *D) {
10715 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10716 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10717 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10718 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10722template <
typename Derived>
10725 OMPDistributeParallelForSimdDirective *D) {
10727 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10728 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10729 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10730 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10734template <
typename Derived>
10736 OMPDistributeSimdDirective *D) {
10738 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10739 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10740 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10741 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10745template <
typename Derived>
10747 OMPTargetParallelForSimdDirective *D) {
10749 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10750 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10751 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10752 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10756template <
typename Derived>
10758 OMPTargetSimdDirective *D) {
10760 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10761 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10762 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10763 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10767template <
typename Derived>
10769 OMPTeamsDistributeDirective *D) {
10771 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10772 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10773 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10774 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10778template <
typename Derived>
10780 OMPTeamsDistributeSimdDirective *D) {
10782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10783 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10784 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10789template <
typename Derived>
10791 OMPTeamsDistributeParallelForSimdDirective *D) {
10793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10794 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10796 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10797 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10801template <
typename Derived>
10803 OMPTeamsDistributeParallelForDirective *D) {
10805 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10806 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10807 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10808 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10812template <
typename Derived>
10814 OMPTargetTeamsDirective *D) {
10816 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10817 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10818 auto Res = getDerived().TransformOMPExecutableDirective(D);
10819 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10823template <
typename Derived>
10825 OMPTargetTeamsDistributeDirective *D) {
10827 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10828 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10829 auto Res = getDerived().TransformOMPExecutableDirective(D);
10830 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10834template <
typename Derived>
10837 OMPTargetTeamsDistributeParallelForDirective *D) {
10839 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10840 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10842 auto Res = getDerived().TransformOMPExecutableDirective(D);
10843 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10847template <
typename Derived>
10850 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10852 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10853 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10855 auto Res = getDerived().TransformOMPExecutableDirective(D);
10856 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10860template <
typename Derived>
10863 OMPTargetTeamsDistributeSimdDirective *D) {
10865 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10866 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10867 auto Res = getDerived().TransformOMPExecutableDirective(D);
10868 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10872template <
typename Derived>
10876 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10877 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10878 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10879 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10883template <
typename Derived>
10887 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10888 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10889 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10890 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10894template <
typename Derived>
10898 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10899 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10900 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10901 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10905template <
typename Derived>
10907 OMPGenericLoopDirective *D) {
10909 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10910 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10911 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10912 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10916template <
typename Derived>
10918 OMPTeamsGenericLoopDirective *D) {
10920 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10921 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10922 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10923 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10927template <
typename Derived>
10929 OMPTargetTeamsGenericLoopDirective *D) {
10931 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10932 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10933 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10934 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10938template <
typename Derived>
10940 OMPParallelGenericLoopDirective *D) {
10942 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10943 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10944 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10945 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10949template <
typename Derived>
10952 OMPTargetParallelGenericLoopDirective *D) {
10954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10955 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10964template <
typename Derived>
10966 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10967 if (Cond.isInvalid())
10969 return getDerived().RebuildOMPIfClause(
10970 C->getNameModifier(), Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10971 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10974template <
typename Derived>
10976 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
10977 if (Cond.isInvalid())
10979 return getDerived().RebuildOMPFinalClause(Cond.get(),
C->getBeginLoc(),
10980 C->getLParenLoc(),
C->getEndLoc());
10983template <
typename Derived>
10987 Vars.reserve(
C->varlist_size());
10988 for (
auto *
VE :
C->varlist()) {
10990 if (EVar.isInvalid())
10992 Vars.push_back(EVar.get());
10994 Expr *DimsModifierExpr =
C->getDimsModifierExpr();
10995 if (DimsModifierExpr) {
10997 if (EVar.isInvalid())
10999 DimsModifierExpr = EVar.get();
11001 return getDerived().RebuildOMPNumThreadsClause(
11002 Vars,
C->getPrescriptivenessModifier(),
11003 C->getPrescriptivenessModifierLoc(),
C->getDimsModifier(),
11004 DimsModifierExpr,
C->getDimsModifierLoc(),
C->getBeginLoc(),
11005 C->getLParenLoc(),
C->getEndLoc());
11008template <
typename Derived>
11011 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
11014 return getDerived().RebuildOMPSafelenClause(
11015 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11018template <
typename Derived>
11021 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
11024 return getDerived().RebuildOMPAllocatorClause(
11025 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11028template <
typename Derived>
11031 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
11034 return getDerived().RebuildOMPSimdlenClause(
11035 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11038template <
typename Derived>
11041 TransformedSizes.reserve(
C->getNumSizes());
11043 for (
Expr *E :
C->getSizesRefs()) {
11045 TransformedSizes.push_back(
nullptr);
11054 TransformedSizes.push_back(
T.get());
11057 if (!Changed && !getDerived().AlwaysRebuild())
11059 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
11060 C->getLParenLoc(),
C->getEndLoc());
11063template <
typename Derived>
11067 TransformedCounts.reserve(
C->getNumCounts());
11068 for (
Expr *E :
C->getCountsRefs()) {
11070 TransformedCounts.push_back(
nullptr);
11077 TransformedCounts.push_back(
T.get());
11080 return RebuildOMPCountsClause(TransformedCounts,
C->getBeginLoc(),
11081 C->getLParenLoc(),
C->getEndLoc(),
11082 C->getOmpFillIndex(),
C->getOmpFillLoc());
11085template <
typename Derived>
11089 TransformedArgs.reserve(
C->getNumLoops());
11091 for (
Expr *E :
C->getArgsRefs()) {
11093 TransformedArgs.push_back(
nullptr);
11102 TransformedArgs.push_back(
T.get());
11105 if (!Changed && !getDerived().AlwaysRebuild())
11107 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
11108 C->getLParenLoc(),
C->getEndLoc());
11111template <
typename Derived>
11113 if (!getDerived().AlwaysRebuild())
11115 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
11118template <
typename Derived>
11121 ExprResult T = getDerived().TransformExpr(
C->getFactor());
11124 Expr *Factor =
T.get();
11125 bool Changed = Factor !=
C->getFactor();
11127 if (!Changed && !getDerived().AlwaysRebuild())
11129 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
11133template <
typename Derived>
11135 ExprResult T = getDerived().TransformExpr(
C->getDepth());
11138 Expr *Depth =
T.get();
11139 bool Changed = Depth !=
C->getDepth();
11141 if (!Changed && !getDerived().AlwaysRebuild())
11143 return RebuildOMPDepthClause(Depth,
C->getBeginLoc(),
C->getLParenLoc(),
11147template <
typename Derived>
11150 ExprResult F = getDerived().TransformExpr(
C->getFirst());
11154 ExprResult Cn = getDerived().TransformExpr(
C->getCount());
11155 if (Cn.isInvalid())
11159 Expr *Count = Cn.get();
11161 bool Changed = (
First !=
C->getFirst()) || (Count !=
C->getCount());
11164 if (!Changed && !getDerived().AlwaysRebuild())
11167 return RebuildOMPLoopRangeClause(
First, Count,
C->getBeginLoc(),
11168 C->getLParenLoc(),
C->getFirstLoc(),
11169 C->getCountLoc(),
C->getEndLoc());
11172template <
typename Derived>
11175 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
11178 return getDerived().RebuildOMPCollapseClause(
11179 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11182template <
typename Derived>
11186 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
11187 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11191template <
typename Derived>
11198template <
typename Derived>
11201 Expr *Impex =
C->getImpexType();
11202 ExprResult TransformedImpex = getDerived().TransformExpr(Impex);
11204 if (TransformedImpex.isInvalid())
11207 return getDerived().RebuildOMPTransparentClause(
11208 TransformedImpex.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11212template <
typename Derived>
11216 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
11217 C->getLParenLoc(),
C->getEndLoc());
11220template <
typename Derived>
11223 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11226 return getDerived().RebuildOMPScheduleClause(
11227 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
11228 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11229 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
11230 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11233template <
typename Derived>
11237 if (
auto *
Num =
C->getNumForLoops()) {
11238 E = getDerived().TransformExpr(
Num);
11242 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
11243 C->getLParenLoc(), E.get());
11246template <
typename Derived>
11250 if (
Expr *Evt =
C->getEventHandler()) {
11251 E = getDerived().TransformExpr(Evt);
11255 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
11256 C->getLParenLoc(),
C->getEndLoc());
11259template <
typename Derived>
11264 Cond = getDerived().TransformExpr(
Condition);
11265 if (Cond.isInvalid())
11268 return getDerived().RebuildOMPNowaitClause(Cond.get(),
C->getBeginLoc(),
11269 C->getLParenLoc(),
C->getEndLoc());
11272template <
typename Derived>
11279template <
typename Derived>
11286template <
typename Derived>
11292template <
typename Derived>
11298template <
typename Derived>
11305template <
typename Derived>
11307 OMPUpdateDependObjectsClause *
C) {
11312template <
typename Derived>
11319template <
typename Derived>
11326template <
typename Derived>
11332template <
typename Derived>
11338template <
typename Derived>
11340 ExprResult E = getDerived().TransformExpr(
C->getExpr());
11343 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
11344 C->getLParenLoc(),
C->getEndLoc());
11347template <
typename Derived>
11353template <
typename Derived>
11358template <
typename Derived>
11360 OMPNoOpenMPRoutinesClause *
C) {
11363template <
typename Derived>
11365 OMPNoOpenMPConstructsClause *
C) {
11368template <
typename Derived>
11370 OMPNoParallelismClause *
C) {
11374template <
typename Derived>
11381template <
typename Derived>
11388template <
typename Derived>
11395template <
typename Derived>
11402template <
typename Derived>
11409template <
typename Derived>
11415template <
typename Derived>
11422template <
typename Derived>
11428template <
typename Derived>
11435template <
typename Derived>
11437 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
11438 if (IVR.isInvalid())
11442 for (OMPInitClause::PrefView P :
C->prefs()) {
11443 Expr *NewFr =
nullptr;
11445 ExprResult ER = getDerived().TransformExpr(P.Fr);
11446 if (ER.isInvalid())
11451 NewAttrs.reserve(P.Attrs.size());
11452 for (
Expr *A : P.Attrs) {
11453 ExprResult ER = getDerived().TransformExpr(A);
11454 if (ER.isInvalid())
11456 NewAttrs.push_back(ER.get());
11458 InteropInfo.Prefs.emplace_back(NewFr, std::move(NewAttrs));
11460 InteropInfo.HasPreferAttrs =
C->hasPreferAttrs();
11461 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
11462 C->getBeginLoc(),
C->getLParenLoc(),
11463 C->getVarLoc(),
C->getEndLoc());
11466template <
typename Derived>
11468 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
11469 if (ER.isInvalid())
11471 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
11472 C->getLParenLoc(),
C->getVarLoc(),
11476template <
typename Derived>
11480 if (
Expr *IV =
C->getInteropVar()) {
11481 ER = getDerived().TransformExpr(IV);
11482 if (ER.isInvalid())
11485 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
11486 C->getLParenLoc(),
C->getVarLoc(),
11490template <
typename Derived>
11493 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11494 if (Cond.isInvalid())
11496 return getDerived().RebuildOMPNovariantsClause(
11497 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11500template <
typename Derived>
11503 ExprResult Cond = getDerived().TransformExpr(
C->getCondition());
11504 if (Cond.isInvalid())
11506 return getDerived().RebuildOMPNocontextClause(
11507 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11510template <
typename Derived>
11513 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
11514 if (ThreadID.isInvalid())
11516 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
11517 C->getLParenLoc(),
C->getEndLoc());
11520template <
typename Derived>
11522 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
11525 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
11526 C->getLParenLoc(),
C->getEndLoc());
11529template <
typename Derived>
11531 OMPUnifiedAddressClause *
C) {
11532 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
11535template <
typename Derived>
11537 OMPUnifiedSharedMemoryClause *
C) {
11539 "unified_shared_memory clause cannot appear in dependent context");
11542template <
typename Derived>
11544 OMPReverseOffloadClause *
C) {
11545 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
11548template <
typename Derived>
11550 OMPDynamicAllocatorsClause *
C) {
11552 "dynamic_allocators clause cannot appear in dependent context");
11555template <
typename Derived>
11557 OMPAtomicDefaultMemOrderClause *
C) {
11559 "atomic_default_mem_order clause cannot appear in dependent context");
11562template <
typename Derived>
11565 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
11568template <
typename Derived>
11571 C->getBeginLoc(),
C->getLParenLoc(),
11575template <
typename Derived>
11579 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
11580 C->getLParenLoc(),
C->getEndLoc());
11583template <
typename Derived>
11586 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
11589 return getDerived().RebuildOMPMessageClause(
11590 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11593template <
typename Derived>
11597 Vars.reserve(
C->varlist_size());
11598 for (
auto *
VE :
C->varlist()) {
11600 if (EVar.isInvalid())
11602 Vars.push_back(EVar.get());
11604 return getDerived().RebuildOMPPrivateClause(
11605 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11608template <
typename Derived>
11610 OMPFirstprivateClause *
C) {
11612 Vars.reserve(
C->varlist_size());
11613 for (
auto *
VE :
C->varlist()) {
11615 if (EVar.isInvalid())
11617 Vars.push_back(EVar.get());
11619 return getDerived().RebuildOMPFirstprivateClause(
11620 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11623template <
typename Derived>
11627 Vars.reserve(
C->varlist_size());
11628 for (
auto *
VE :
C->varlist()) {
11630 if (EVar.isInvalid())
11632 Vars.push_back(EVar.get());
11634 return getDerived().RebuildOMPLastprivateClause(
11635 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
11636 C->getLParenLoc(),
C->getEndLoc());
11639template <
typename Derived>
11643 Vars.reserve(
C->varlist_size());
11644 for (
auto *
VE :
C->varlist()) {
11646 if (EVar.isInvalid())
11648 Vars.push_back(EVar.get());
11650 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
11651 C->getLParenLoc(),
C->getEndLoc());
11654template <
typename Derived>
11658 Vars.reserve(
C->varlist_size());
11659 for (
auto *
VE :
C->varlist()) {
11661 if (EVar.isInvalid())
11663 Vars.push_back(EVar.get());
11666 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11669 if (NameInfo.getName()) {
11670 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11671 if (!NameInfo.getName())
11677 for (
auto *E :
C->reduction_ops()) {
11682 for (
auto *D : ULE->decls()) {
11685 Decls.addDecl(InstD, InstD->getAccess());
11689 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11690 true, Decls.begin(), Decls.end(),
11693 UnresolvedReductions.push_back(
nullptr);
11695 return getDerived().RebuildOMPReductionClause(
11696 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
11697 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
11698 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11701template <
typename Derived>
11703 OMPTaskReductionClause *
C) {
11705 Vars.reserve(
C->varlist_size());
11706 for (
auto *
VE :
C->varlist()) {
11708 if (EVar.isInvalid())
11710 Vars.push_back(EVar.get());
11713 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11716 if (NameInfo.getName()) {
11717 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11718 if (!NameInfo.getName())
11724 for (
auto *E :
C->reduction_ops()) {
11729 for (
auto *D : ULE->decls()) {
11732 Decls.addDecl(InstD, InstD->getAccess());
11736 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11737 true, Decls.begin(), Decls.end(),
11740 UnresolvedReductions.push_back(
nullptr);
11742 return getDerived().RebuildOMPTaskReductionClause(
11743 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11744 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11747template <
typename Derived>
11751 Vars.reserve(
C->varlist_size());
11752 for (
auto *
VE :
C->varlist()) {
11754 if (EVar.isInvalid())
11756 Vars.push_back(EVar.get());
11759 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11762 if (NameInfo.getName()) {
11763 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11764 if (!NameInfo.getName())
11770 for (
auto *E :
C->reduction_ops()) {
11775 for (
auto *D : ULE->decls()) {
11778 Decls.addDecl(InstD, InstD->getAccess());
11782 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11783 true, Decls.begin(), Decls.end(),
11786 UnresolvedReductions.push_back(
nullptr);
11788 return getDerived().RebuildOMPInReductionClause(
11789 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11790 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11793template <
typename Derived>
11797 Vars.reserve(
C->varlist_size());
11798 for (
auto *
VE :
C->varlist()) {
11800 if (EVar.isInvalid())
11802 Vars.push_back(EVar.get());
11804 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11805 if (Step.isInvalid())
11807 return getDerived().RebuildOMPLinearClause(
11808 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11809 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11813template <
typename Derived>
11817 Vars.reserve(
C->varlist_size());
11818 for (
auto *
VE :
C->varlist()) {
11820 if (EVar.isInvalid())
11822 Vars.push_back(EVar.get());
11824 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11825 if (Alignment.isInvalid())
11827 return getDerived().RebuildOMPAlignedClause(
11828 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11829 C->getColonLoc(),
C->getEndLoc());
11832template <
typename Derived>
11836 Vars.reserve(
C->varlist_size());
11837 for (
auto *
VE :
C->varlist()) {
11839 if (EVar.isInvalid())
11841 Vars.push_back(EVar.get());
11843 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11844 C->getLParenLoc(),
C->getEndLoc());
11847template <
typename Derived>
11851 Vars.reserve(
C->varlist_size());
11852 for (
auto *
VE :
C->varlist()) {
11854 if (EVar.isInvalid())
11856 Vars.push_back(EVar.get());
11858 return getDerived().RebuildOMPCopyprivateClause(
11859 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11862template <
typename Derived>
11865 Vars.reserve(
C->varlist_size());
11866 for (
auto *
VE :
C->varlist()) {
11868 if (EVar.isInvalid())
11870 Vars.push_back(EVar.get());
11872 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11873 C->getLParenLoc(),
C->getEndLoc());
11876template <
typename Derived>
11879 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11882 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11883 C->getLParenLoc(),
C->getEndLoc());
11886template <
typename Derived>
11890 Expr *DepModifier =
C->getModifier();
11892 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11893 if (DepModRes.isInvalid())
11895 DepModifier = DepModRes.get();
11897 Vars.reserve(
C->varlist_size());
11898 for (
auto *
VE :
C->varlist()) {
11900 if (EVar.isInvalid())
11902 Vars.push_back(EVar.get());
11904 return getDerived().RebuildOMPDependClause(
11905 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11906 C->getOmpAllMemoryLoc()},
11907 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11910template <
typename Derived>
11913 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11916 return getDerived().RebuildOMPDeviceClause(
11917 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11918 C->getModifierLoc(),
C->getEndLoc());
11921template <
typename Derived,
class T>
11928 Vars.reserve(
C->varlist_size());
11929 for (
auto *
VE :
C->varlist()) {
11933 Vars.push_back(EVar.
get());
11937 if (
C->getMapperQualifierLoc()) {
11938 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11939 C->getMapperQualifierLoc());
11943 MapperIdScopeSpec.
Adopt(QualifierLoc);
11944 MapperIdInfo =
C->getMapperIdInfo();
11945 if (MapperIdInfo.
getName()) {
11946 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11952 for (
auto *E :
C->mapperlists()) {
11957 for (
auto *D : ULE->decls()) {
11960 Decls.addDecl(InstD, InstD->
getAccess());
11965 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11968 UnresolvedMappers.push_back(
nullptr);
11974template <
typename Derived>
11976 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11978 Expr *IteratorModifier =
C->getIteratorModifier();
11979 if (IteratorModifier) {
11980 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11981 if (MapModRes.isInvalid())
11983 IteratorModifier = MapModRes.
get();
11989 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11991 return getDerived().RebuildOMPMapClause(
11992 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11993 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11994 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11997template <
typename Derived>
12000 Expr *Allocator =
C->getAllocator();
12002 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
12003 if (AllocatorRes.isInvalid())
12005 Allocator = AllocatorRes.get();
12007 Expr *Alignment =
C->getAlignment();
12009 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
12010 if (AlignmentRes.isInvalid())
12012 Alignment = AlignmentRes.get();
12015 Vars.reserve(
C->varlist_size());
12016 for (
auto *
VE :
C->varlist()) {
12018 if (EVar.isInvalid())
12020 Vars.push_back(EVar.get());
12022 return getDerived().RebuildOMPAllocateClause(
12023 Allocator, Alignment,
C->getFirstAllocateModifier(),
12024 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
12025 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
12026 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
12029template <
typename Derived>
12033 Vars.reserve(
C->varlist_size());
12034 for (
auto *
VE :
C->varlist()) {
12036 if (EVar.isInvalid())
12038 Vars.push_back(EVar.get());
12040 Expr *ModifierExpr =
C->getModifierExpr();
12041 if (ModifierExpr) {
12043 if (EVar.isInvalid())
12045 ModifierExpr = EVar.get();
12047 return getDerived().RebuildOMPNumTeamsClause(
12048 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12050 C->getLParenLoc(),
C->getEndLoc());
12053template <
typename Derived>
12057 Vars.reserve(
C->varlist_size());
12058 for (
auto *
VE :
C->varlist()) {
12060 if (EVar.isInvalid())
12062 Vars.push_back(EVar.get());
12064 Expr *ModifierExpr =
C->getModifierExpr();
12065 if (ModifierExpr) {
12067 if (EVar.isInvalid())
12069 ModifierExpr = EVar.get();
12071 return getDerived().RebuildOMPThreadLimitClause(
12072 Vars,
C->getModifier(), ModifierExpr,
C->getModifierLoc(),
12073 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12076template <
typename Derived>
12079 ExprResult E = getDerived().TransformExpr(
C->getPriority());
12082 return getDerived().RebuildOMPPriorityClause(
12083 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12086template <
typename Derived>
12089 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
12092 return getDerived().RebuildOMPGrainsizeClause(
12093 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12094 C->getModifierLoc(),
C->getEndLoc());
12097template <
typename Derived>
12100 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
12103 return getDerived().RebuildOMPNumTasksClause(
12104 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12105 C->getModifierLoc(),
C->getEndLoc());
12108template <
typename Derived>
12110 ExprResult E = getDerived().TransformExpr(
C->getHint());
12113 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
12114 C->getLParenLoc(),
C->getEndLoc());
12117template <
typename Derived>
12119 OMPDistScheduleClause *
C) {
12120 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
12123 return getDerived().RebuildOMPDistScheduleClause(
12124 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12125 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
12128template <
typename Derived>
12134 C->getDefaultmapKind(),
12137 C->getDefaultmapModifierLoc(),
12138 C->getDefaultmapKindLoc(),
12142template <
typename Derived>
12146 Expr *IteratorModifier =
C->getIteratorModifier();
12147 if (IteratorModifier) {
12148 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12149 if (MapModRes.isInvalid())
12151 IteratorModifier = MapModRes.get();
12157 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12159 return getDerived().RebuildOMPToClause(
12160 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12161 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12162 UnresolvedMappers);
12165template <
typename Derived>
12169 Expr *IteratorModifier =
C->getIteratorModifier();
12170 if (IteratorModifier) {
12171 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
12172 if (MapModRes.isInvalid())
12174 IteratorModifier = MapModRes.get();
12180 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
12182 return getDerived().RebuildOMPFromClause(
12183 C->getMotionModifiers(),
C->getMotionModifiersLoc(), IteratorModifier,
12184 MapperIdScopeSpec, MapperIdInfo,
C->getColonLoc(), Vars, Locs,
12185 UnresolvedMappers);
12188template <
typename Derived>
12190 OMPUseDevicePtrClause *
C) {
12192 Vars.reserve(
C->varlist_size());
12193 for (
auto *
VE :
C->varlist()) {
12195 if (EVar.isInvalid())
12197 Vars.push_back(EVar.get());
12200 return getDerived().RebuildOMPUseDevicePtrClause(
12201 Vars, Locs,
C->getFallbackModifier(),
C->getFallbackModifierLoc());
12204template <
typename Derived>
12206 OMPUseDeviceAddrClause *
C) {
12208 Vars.reserve(
C->varlist_size());
12209 for (
auto *
VE :
C->varlist()) {
12211 if (EVar.isInvalid())
12213 Vars.push_back(EVar.get());
12216 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
12219template <
typename Derived>
12223 Vars.reserve(
C->varlist_size());
12224 for (
auto *
VE :
C->varlist()) {
12226 if (EVar.isInvalid())
12228 Vars.push_back(EVar.get());
12231 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
12234template <
typename Derived>
12236 OMPHasDeviceAddrClause *
C) {
12238 Vars.reserve(
C->varlist_size());
12239 for (
auto *
VE :
C->varlist()) {
12241 if (EVar.isInvalid())
12243 Vars.push_back(EVar.get());
12246 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
12249template <
typename Derived>
12253 Vars.reserve(
C->varlist_size());
12254 for (
auto *
VE :
C->varlist()) {
12256 if (EVar.isInvalid())
12258 Vars.push_back(EVar.get());
12260 return getDerived().RebuildOMPNontemporalClause(
12261 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12264template <
typename Derived>
12268 Vars.reserve(
C->varlist_size());
12269 for (
auto *
VE :
C->varlist()) {
12271 if (EVar.isInvalid())
12273 Vars.push_back(EVar.get());
12275 return getDerived().RebuildOMPInclusiveClause(
12276 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12279template <
typename Derived>
12283 Vars.reserve(
C->varlist_size());
12284 for (
auto *
VE :
C->varlist()) {
12286 if (EVar.isInvalid())
12288 Vars.push_back(EVar.get());
12290 return getDerived().RebuildOMPExclusiveClause(
12291 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12294template <
typename Derived>
12296 OMPUsesAllocatorsClause *
C) {
12298 Data.reserve(
C->getNumberOfAllocators());
12299 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
12300 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
12302 if (Allocator.isInvalid())
12306 AllocatorTraits = getDerived().TransformExpr(AT);
12307 if (AllocatorTraits.isInvalid())
12311 NewD.Allocator = Allocator.get();
12312 NewD.AllocatorTraits = AllocatorTraits.get();
12316 return getDerived().RebuildOMPUsesAllocatorsClause(
12317 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12320template <
typename Derived>
12324 Locators.reserve(
C->varlist_size());
12326 if (
Expr *Modifier =
C->getModifier()) {
12327 ModifierRes = getDerived().TransformExpr(Modifier);
12328 if (ModifierRes.isInvalid())
12331 for (
Expr *E :
C->varlist()) {
12332 ExprResult Locator = getDerived().TransformExpr(E);
12333 if (Locator.isInvalid())
12335 Locators.push_back(Locator.get());
12337 return getDerived().RebuildOMPAffinityClause(
12338 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
12339 ModifierRes.get(), Locators);
12342template <
typename Derived>
12345 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
12346 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
12349template <
typename Derived>
12352 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
12353 C->getLParenLoc(),
C->getEndLoc());
12356template <
typename Derived>
12358 OMPXDynCGroupMemClause *
C) {
12360 if (
Size.isInvalid())
12362 return getDerived().RebuildOMPXDynCGroupMemClause(
12363 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12366template <
typename Derived>
12368 OMPDynGroupprivateClause *
C) {
12370 if (
Size.isInvalid())
12372 return getDerived().RebuildOMPDynGroupprivateClause(
12373 C->getDynGroupprivateModifier(),
C->getDynGroupprivateFallbackModifier(),
12374 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
12375 C->getDynGroupprivateModifierLoc(),
12376 C->getDynGroupprivateFallbackModifierLoc(),
C->getEndLoc());
12379template <
typename Derived>
12383 Vars.reserve(
C->varlist_size());
12384 for (
auto *
VE :
C->varlist()) {
12386 if (EVar.isInvalid())
12388 Vars.push_back(EVar.get());
12390 return getDerived().RebuildOMPDoacrossClause(
12391 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
12392 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12395template <
typename Derived>
12399 for (
auto *A :
C->getAttrs())
12400 NewAttrs.push_back(getDerived().TransformAttr(A));
12401 return getDerived().RebuildOMPXAttributeClause(
12402 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
12405template <
typename Derived>
12414template <
typename Derived>
12415class OpenACCClauseTransform final
12417 TreeTransform<Derived> &Self;
12418 ArrayRef<const OpenACCClause *> ExistingClauses;
12419 SemaOpenACC::OpenACCParsedClause &ParsedClause;
12420 OpenACCClause *NewClause =
nullptr;
12423 ExprResult Res = Self.TransformExpr(VarRef);
12425 if (!Res.isUsable())
12428 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12429 ParsedClause.getClauseKind(),
12435 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
12436 llvm::SmallVector<Expr *> InstantiatedVarList;
12437 for (Expr *CurVar : VarList) {
12440 if (VarRef.isUsable())
12441 InstantiatedVarList.push_back(VarRef.get());
12444 return InstantiatedVarList;
12448 OpenACCClauseTransform(TreeTransform<Derived> &Self,
12449 ArrayRef<const OpenACCClause *> ExistingClauses,
12450 SemaOpenACC::OpenACCParsedClause &PC)
12451 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
12453 OpenACCClause *CreatedClause()
const {
return NewClause; }
12455#define VISIT_CLAUSE(CLAUSE_NAME) \
12456 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
12457#include "clang/Basic/OpenACCClauses.def"
12460template <
typename Derived>
12461void OpenACCClauseTransform<Derived>::VisitDefaultClause(
12463 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
12466 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
12467 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12468 ParsedClause.getEndLoc());
12471template <
typename Derived>
12472void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
12473 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12474 assert(Cond &&
"If constructed with invalid Condition");
12478 if (Res.isInvalid() || !Res.get().second)
12481 ParsedClause.setConditionDetails(Res.get().second);
12484 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12485 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12486 ParsedClause.getEndLoc());
12489template <
typename Derived>
12490void OpenACCClauseTransform<Derived>::VisitSelfClause(
12496 for (
Expr *CurVar :
C.getVarList()) {
12499 if (!Res.isUsable())
12502 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
12503 ParsedClause.getClauseKind(),
12506 if (Res.isUsable())
12507 InstantiatedVarList.push_back(Res.get());
12510 ParsedClause.setVarListDetails(InstantiatedVarList,
12514 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12515 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12516 ParsedClause.getEndLoc());
12519 if (
C.hasConditionExpr()) {
12520 Expr *Cond =
const_cast<Expr *
>(
C.getConditionExpr());
12522 Self.TransformCondition(Cond->getExprLoc(),
nullptr, Cond,
12525 if (Res.isInvalid() || !Res.get().second)
12528 ParsedClause.setConditionDetails(Res.get().second);
12532 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12533 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
12534 ParsedClause.getEndLoc());
12538template <
typename Derived>
12539void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
12543 for (
Expr *CurIntExpr :
C.getIntExprs()) {
12546 if (!Res.isUsable())
12551 C.getBeginLoc(), Res.get());
12552 if (!Res.isUsable())
12555 InstantiatedIntExprs.push_back(Res.get());
12558 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
12560 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12561 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12562 ParsedClause.getEndLoc());
12565template <
typename Derived>
12566void OpenACCClauseTransform<Derived>::VisitPrivateClause(
12571 for (
const auto [RefExpr, InitRecipe] :
12572 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12575 if (VarRef.isUsable()) {
12576 InstantiatedVarList.push_back(VarRef.get());
12580 if (InitRecipe.isSet())
12581 InitRecipes.push_back(InitRecipe);
12583 InitRecipes.push_back(
12584 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
12587 ParsedClause.setVarListDetails(InstantiatedVarList,
12591 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12592 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12593 ParsedClause.getEndLoc());
12596template <
typename Derived>
12597void OpenACCClauseTransform<Derived>::VisitHostClause(
12599 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12603 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12604 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12605 ParsedClause.getEndLoc());
12608template <
typename Derived>
12609void OpenACCClauseTransform<Derived>::VisitDeviceClause(
12611 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12615 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12616 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12617 ParsedClause.getEndLoc());
12620template <
typename Derived>
12621void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
12626 for (
const auto [RefExpr, InitRecipe] :
12627 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
12630 if (VarRef.isUsable()) {
12631 InstantiatedVarList.push_back(VarRef.get());
12635 if (InitRecipe.isSet())
12636 InitRecipes.push_back(InitRecipe);
12638 InitRecipes.push_back(
12639 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
12643 ParsedClause.setVarListDetails(InstantiatedVarList,
12647 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12648 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
12649 ParsedClause.getEndLoc());
12652template <
typename Derived>
12653void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
12655 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12659 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12660 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12661 ParsedClause.getEndLoc());
12664template <
typename Derived>
12665void OpenACCClauseTransform<Derived>::VisitPresentClause(
12667 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12671 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12672 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12673 ParsedClause.getEndLoc());
12676template <
typename Derived>
12677void OpenACCClauseTransform<Derived>::VisitCopyClause(
12679 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12680 C.getModifierList());
12683 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12684 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12685 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12686 ParsedClause.getEndLoc());
12689template <
typename Derived>
12690void OpenACCClauseTransform<Derived>::VisitLinkClause(
12692 llvm_unreachable(
"link clause not valid unless a decl transform");
12695template <
typename Derived>
12696void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
12698 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
12700template <
typename Derived>
12701void OpenACCClauseTransform<Derived>::VisitNoHostClause(
12703 llvm_unreachable(
"nohost clause not valid unless a decl transform");
12705template <
typename Derived>
12706void OpenACCClauseTransform<Derived>::VisitBindClause(
12708 llvm_unreachable(
"bind clause not valid unless a decl transform");
12711template <
typename Derived>
12712void OpenACCClauseTransform<Derived>::VisitCopyInClause(
12714 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12715 C.getModifierList());
12718 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12719 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12720 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12721 ParsedClause.getEndLoc());
12724template <
typename Derived>
12725void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
12727 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12728 C.getModifierList());
12731 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12732 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12733 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12734 ParsedClause.getEndLoc());
12737template <
typename Derived>
12738void OpenACCClauseTransform<Derived>::VisitCreateClause(
12740 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12741 C.getModifierList());
12744 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
12745 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12746 ParsedClause.getModifierList(), ParsedClause.getVarList(),
12747 ParsedClause.getEndLoc());
12749template <
typename Derived>
12750void OpenACCClauseTransform<Derived>::VisitAttachClause(
12755 llvm::erase_if(VarList, [&](
Expr *E) {
12756 return Self.getSema().OpenACC().CheckVarIsPointerType(
12762 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12763 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12764 ParsedClause.getEndLoc());
12767template <
typename Derived>
12768void OpenACCClauseTransform<Derived>::VisitDetachClause(
12773 llvm::erase_if(VarList, [&](
Expr *E) {
12774 return Self.getSema().OpenACC().CheckVarIsPointerType(
12780 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12781 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12782 ParsedClause.getEndLoc());
12785template <
typename Derived>
12786void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12788 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12791 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12792 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12793 ParsedClause.getEndLoc());
12796template <
typename Derived>
12797void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12799 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12802 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12803 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12804 ParsedClause.getEndLoc());
12807template <
typename Derived>
12808void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12813 llvm::erase_if(VarList, [&](
Expr *E) {
12814 return Self.getSema().OpenACC().CheckVarIsPointerType(
12820 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12821 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12822 ParsedClause.getEndLoc());
12825template <
typename Derived>
12826void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12828 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12829 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12832 if (!Res.isUsable())
12837 C.getBeginLoc(), Res.get());
12838 if (!Res.isUsable())
12841 ParsedClause.setIntExprDetails(Res.get());
12843 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12844 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12845 ParsedClause.getEndLoc());
12848template <
typename Derived>
12849void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12851 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12852 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12855 if (!Res.isUsable())
12860 C.getBeginLoc(), Res.get());
12861 if (!Res.isUsable())
12864 ParsedClause.setIntExprDetails(Res.get());
12866 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12867 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12868 ParsedClause.getEndLoc());
12871template <
typename Derived>
12872void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12874 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12875 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12878 if (!Res.isUsable())
12883 C.getBeginLoc(), Res.get());
12884 if (!Res.isUsable())
12887 ParsedClause.setIntExprDetails(Res.get());
12889 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12890 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12891 ParsedClause.getEndLoc());
12894template <
typename Derived>
12895void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12897 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12898 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12901 if (!Res.isUsable())
12906 C.getBeginLoc(), Res.get());
12907 if (!Res.isUsable())
12910 ParsedClause.setIntExprDetails(Res.get());
12912 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12913 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12914 ParsedClause.getEndLoc());
12917template <
typename Derived>
12918void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12920 if (
C.hasIntExpr()) {
12922 if (!Res.isUsable())
12927 C.getBeginLoc(), Res.get());
12928 if (!Res.isUsable())
12930 ParsedClause.setIntExprDetails(Res.get());
12934 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12935 ParsedClause.getLParenLoc(),
12936 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12938 ParsedClause.getEndLoc());
12941template <
typename Derived>
12942void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12944 if (
C.hasIntExpr()) {
12949 if (!Res.isUsable())
12954 C.getBeginLoc(), Res.get());
12955 if (!Res.isUsable())
12957 ParsedClause.setIntExprDetails(Res.get());
12961 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12962 ParsedClause.getLParenLoc(),
12963 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12965 ParsedClause.getEndLoc());
12968template <
typename Derived>
12969void OpenACCClauseTransform<Derived>::VisitVectorClause(
12971 if (
C.hasIntExpr()) {
12976 if (!Res.isUsable())
12981 C.getBeginLoc(), Res.get());
12982 if (!Res.isUsable())
12984 ParsedClause.setIntExprDetails(Res.get());
12988 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12989 ParsedClause.getLParenLoc(),
12990 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12992 ParsedClause.getEndLoc());
12995template <
typename Derived>
12996void OpenACCClauseTransform<Derived>::VisitWaitClause(
12998 if (
C.hasExprs()) {
12999 Expr *DevNumExpr =
nullptr;
13003 if (
C.getDevNumExpr()) {
13005 if (!Res.isUsable())
13009 C.getBeginLoc(), Res.get());
13010 if (!Res.isUsable())
13013 DevNumExpr = Res.get();
13017 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
13019 if (!Res.isUsable())
13023 C.getBeginLoc(), Res.get());
13024 if (!Res.isUsable())
13027 InstantiatedQueueIdExprs.push_back(Res.get());
13030 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
13031 std::move(InstantiatedQueueIdExprs));
13035 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13036 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
13037 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
13038 ParsedClause.getEndLoc());
13041template <
typename Derived>
13042void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
13046 Self.getSema().getASTContext(),
C.getClauseKind(),
13047 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13048 C.getArchitectures(), ParsedClause.getEndLoc());
13051template <
typename Derived>
13052void OpenACCClauseTransform<Derived>::VisitAutoClause(
13056 ParsedClause.getBeginLoc(),
13057 ParsedClause.getEndLoc());
13060template <
typename Derived>
13061void OpenACCClauseTransform<Derived>::VisitIndependentClause(
13064 ParsedClause.getBeginLoc(),
13065 ParsedClause.getEndLoc());
13068template <
typename Derived>
13069void OpenACCClauseTransform<Derived>::VisitSeqClause(
13072 ParsedClause.getBeginLoc(),
13073 ParsedClause.getEndLoc());
13075template <
typename Derived>
13076void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
13079 ParsedClause.getBeginLoc(),
13080 ParsedClause.getEndLoc());
13083template <
typename Derived>
13084void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
13087 ParsedClause.getBeginLoc(),
13088 ParsedClause.getEndLoc());
13091template <
typename Derived>
13092void OpenACCClauseTransform<Derived>::VisitReductionClause(
13098 for (
const auto [Var, OrigRecipe] :
13099 llvm::zip(TransformedVars,
C.getRecipes())) {
13101 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
13102 if (Res.isUsable()) {
13103 ValidVars.push_back(Res.get());
13105 if (OrigRecipe.isSet())
13106 Recipes.emplace_back(OrigRecipe.AllocaDecl, OrigRecipe.CombinerRecipes);
13108 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
13109 C.getReductionOp(), Res.get()));
13113 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
13114 ExistingClauses, ParsedClause.getDirectiveKind(),
13115 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13116 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
13119template <
typename Derived>
13120void OpenACCClauseTransform<Derived>::VisitCollapseClause(
13122 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
13123 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
13127 if (!NewLoopCount.isUsable())
13130 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
13132 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
13136 if (!NewLoopCount.isUsable())
13140 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
13144 if (!NewLoopCount.isUsable())
13147 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
13149 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13150 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
13151 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
13154template <
typename Derived>
13155void OpenACCClauseTransform<Derived>::VisitTileClause(
13160 for (
Expr *E :
C.getSizeExprs()) {
13163 if (!NewSizeExpr.isUsable())
13166 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
13168 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
13172 if (!NewSizeExpr.isUsable())
13175 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
13177 if (!NewSizeExpr.isUsable())
13179 TransformedExprs.push_back(NewSizeExpr.get());
13182 ParsedClause.setIntExprDetails(TransformedExprs);
13184 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
13185 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
13186 ParsedClause.getEndLoc());
13188template <
typename Derived>
13189void OpenACCClauseTransform<Derived>::VisitGangClause(
13194 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
13196 if (!ER.isUsable())
13199 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
13200 ParsedClause.getDirectiveKind(),
13201 C.getExpr(I).first, ER.get());
13202 if (!ER.isUsable())
13204 TransformedGangKinds.push_back(
C.getExpr(I).first);
13205 TransformedIntExprs.push_back(ER.get());
13208 NewClause =
Self.getSema().OpenACC().CheckGangClause(
13209 ParsedClause.getDirectiveKind(), ExistingClauses,
13210 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
13211 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
13214template <
typename Derived>
13215OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
13220 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
13221 ParsedClause.setEndLoc(OldClause->getEndLoc());
13223 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
13224 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
13226 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
13228 Transform.Visit(OldClause);
13230 return Transform.CreatedClause();
13233template <
typename Derived>
13235TreeTransform<Derived>::TransformOpenACCClauseList(
13238 for (
const auto *Clause : OldClauses) {
13239 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
13240 TransformedClauses, DirKind, Clause))
13241 TransformedClauses.push_back(TransformedClause);
13243 return TransformedClauses;
13246template <
typename Derived>
13249 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13252 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13255 if (getSema().OpenACC().ActOnStartStmtDirective(
13256 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13261 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13262 C->clauses(), TransformedClauses);
13263 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13264 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13265 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13267 return getDerived().RebuildOpenACCComputeConstruct(
13268 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13269 C->getEndLoc(), TransformedClauses, StrBlock);
13272template <
typename Derived>
13276 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13279 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13282 if (getSema().OpenACC().ActOnStartStmtDirective(
13283 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13288 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13289 C->clauses(), TransformedClauses);
13291 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13292 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13294 return getDerived().RebuildOpenACCLoopConstruct(
13295 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13296 TransformedClauses,
Loop);
13299template <
typename Derived>
13301 OpenACCCombinedConstruct *
C) {
13302 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13305 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13308 if (getSema().OpenACC().ActOnStartStmtDirective(
13309 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13314 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13315 C->clauses(), TransformedClauses);
13317 Loop = getSema().OpenACC().ActOnAssociatedStmt(
13318 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
13320 return getDerived().RebuildOpenACCCombinedConstruct(
13321 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
13322 C->getEndLoc(), TransformedClauses,
Loop);
13325template <
typename Derived>
13328 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13331 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13333 if (getSema().OpenACC().ActOnStartStmtDirective(
13334 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13338 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13339 C->clauses(), TransformedClauses);
13340 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13341 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13342 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13344 return getDerived().RebuildOpenACCDataConstruct(
13345 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13346 TransformedClauses, StrBlock);
13349template <
typename Derived>
13351 OpenACCEnterDataConstruct *
C) {
13352 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13355 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13357 if (getSema().OpenACC().ActOnStartStmtDirective(
13358 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13361 return getDerived().RebuildOpenACCEnterDataConstruct(
13362 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13363 TransformedClauses);
13366template <
typename Derived>
13368 OpenACCExitDataConstruct *
C) {
13369 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13372 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13374 if (getSema().OpenACC().ActOnStartStmtDirective(
13375 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13378 return getDerived().RebuildOpenACCExitDataConstruct(
13379 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13380 TransformedClauses);
13383template <
typename Derived>
13385 OpenACCHostDataConstruct *
C) {
13386 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13389 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13391 if (getSema().OpenACC().ActOnStartStmtDirective(
13392 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13396 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
13397 C->clauses(), TransformedClauses);
13398 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
13399 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
13400 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
13402 return getDerived().RebuildOpenACCHostDataConstruct(
13403 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13404 TransformedClauses, StrBlock);
13407template <
typename Derived>
13410 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13413 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13415 if (getSema().OpenACC().ActOnStartStmtDirective(
13416 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13419 return getDerived().RebuildOpenACCInitConstruct(
13420 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13421 TransformedClauses);
13424template <
typename Derived>
13426 OpenACCShutdownConstruct *
C) {
13427 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13430 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13432 if (getSema().OpenACC().ActOnStartStmtDirective(
13433 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13436 return getDerived().RebuildOpenACCShutdownConstruct(
13437 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13438 TransformedClauses);
13440template <
typename Derived>
13443 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13446 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13448 if (getSema().OpenACC().ActOnStartStmtDirective(
13449 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13452 return getDerived().RebuildOpenACCSetConstruct(
13453 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13454 TransformedClauses);
13457template <
typename Derived>
13459 OpenACCUpdateConstruct *
C) {
13460 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13463 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13465 if (getSema().OpenACC().ActOnStartStmtDirective(
13466 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13469 return getDerived().RebuildOpenACCUpdateConstruct(
13470 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
13471 TransformedClauses);
13474template <
typename Derived>
13477 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13480 if (
C->hasDevNumExpr()) {
13481 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
13483 if (DevNumExpr.isUsable())
13484 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
13486 C->getBeginLoc(), DevNumExpr.get());
13491 for (
Expr *QE :
C->getQueueIdExprs()) {
13492 assert(QE &&
"Null queue id expr?");
13493 ExprResult NewEQ = getDerived().TransformExpr(QE);
13495 if (!NewEQ.isUsable())
13499 C->getBeginLoc(), NewEQ.get());
13500 if (NewEQ.isUsable())
13501 QueueIdExprs.push_back(NewEQ.get());
13505 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13508 if (getSema().OpenACC().ActOnStartStmtDirective(
13509 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
13512 return getDerived().RebuildOpenACCWaitConstruct(
13513 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13514 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
13515 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
13517template <
typename Derived>
13519 OpenACCCacheConstruct *
C) {
13520 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13523 for (
Expr *Var :
C->getVarList()) {
13524 assert(Var &&
"Null var listexpr?");
13526 ExprResult NewVar = getDerived().TransformExpr(Var);
13528 if (!NewVar.isUsable())
13531 NewVar = getSema().OpenACC().ActOnVar(
13533 if (!NewVar.isUsable())
13536 TransformedVarList.push_back(NewVar.get());
13539 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13540 C->getBeginLoc(), {}))
13543 return getDerived().RebuildOpenACCCacheConstruct(
13544 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
13545 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
13549template <
typename Derived>
13551 OpenACCAtomicConstruct *
C) {
13552 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
13555 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
13558 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
13559 C->getBeginLoc(), {}))
13564 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
13566 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
13567 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
13568 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
13571 return getDerived().RebuildOpenACCAtomicConstruct(
13572 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
13573 C->getEndLoc(), TransformedClauses, AssocStmt);
13576template <
typename Derived>
13579 if (getDerived().AlwaysRebuild())
13588template<
typename Derived>
13591 return TransformExpr(E->getSubExpr());
13594template <
typename Derived>
13597 if (!E->isTypeDependent())
13600 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
13605 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
13608 return getDerived().RebuildSYCLUniqueStableNameExpr(
13609 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
13612template <
typename Derived>
13616 const auto *SKEPAttr = FD->template getAttr<SYCLKernelEntryPointAttr>();
13617 if (!SKEPAttr || SKEPAttr->isInvalidAttr())
13620 ExprResult IdExpr = getDerived().TransformExpr(S->getKernelLaunchIdExpr());
13621 if (IdExpr.isInvalid())
13624 StmtResult Body = getDerived().TransformStmt(S->getOriginalStmt());
13625 if (Body.isInvalid())
13631 if (SR.isInvalid())
13637template <
typename Derived>
13641 switch (E->getKind()) {
13650 llvm_unreachable(
"A null reflection should not reach here");
13653 assert(
false &&
"unknown or unimplemented reflection entities");
13657template<
typename Derived>
13660 if (!E->isTypeDependent())
13664 E->getIdentKind());
13667template<
typename Derived>
13671 if (E->getQualifierLoc()) {
13673 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13679 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
13681 if (!ND || ND->isInvalidDecl())
13685 if (E->getFoundDecl() != E->getDecl()) {
13686 Found = cast_or_null<NamedDecl>(
13687 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
13693 if (NameInfo.getName()) {
13694 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
13695 if (!NameInfo.getName())
13699 if (!getDerived().AlwaysRebuild() &&
13700 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
13701 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
13702 Found == E->getFoundDecl() &&
13703 NameInfo.getName() == E->getDecl()->getDeclName() &&
13704 !E->hasExplicitTemplateArgs()) {
13714 if (E->hasExplicitTemplateArgs()) {
13715 TemplateArgs = &TransArgs;
13716 TransArgs.setLAngleLoc(E->getLAngleLoc());
13717 TransArgs.setRAngleLoc(E->getRAngleLoc());
13718 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13719 E->getNumTemplateArgs(),
13724 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
13725 Found, TemplateArgs);
13728template<
typename Derived>
13734template <
typename Derived>
13740template<
typename Derived>
13746template<
typename Derived>
13752template<
typename Derived>
13758template<
typename Derived>
13764template<
typename Derived>
13767 return getDerived().TransformCallExpr(E);
13770template<
typename Derived>
13775 if (E->isExprPredicate())
13776 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
13778 ControllingType = getDerived().TransformType(E->getControllingType());
13780 if (ControllingExpr.isInvalid() && !ControllingType)
13791 AssocTypes.push_back(AssocType);
13793 AssocTypes.push_back(
nullptr);
13797 getDerived().TransformExpr(Assoc.getAssociationExpr());
13798 if (AssocExpr.isInvalid())
13800 AssocExprs.push_back(AssocExpr.get());
13803 if (!ControllingType)
13804 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
13805 E->getDefaultLoc(),
13807 ControllingExpr.get(),
13810 return getDerived().RebuildGenericSelectionExpr(
13811 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
13812 ControllingType, AssocTypes, AssocExprs);
13815template<
typename Derived>
13818 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13819 if (SubExpr.isInvalid())
13822 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13825 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13832template<
typename Derived>
13836 return getDerived().TransformDependentScopeDeclRefExpr(
13837 DRE,
true,
nullptr);
13839 return getDerived().TransformUnresolvedLookupExpr(
13845template<
typename Derived>
13850 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13856 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13864template<
typename Derived>
13866TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13868 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13878 bool ExprChanged =
false;
13880 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13881 const OffsetOfNode &ON = E->getComponent(I);
13882 switch (ON.getKind()) {
13884 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13885 ExprResult Index = getDerived().TransformExpr(FromIndex);
13886 if (Index.isInvalid())
13889 ExprChanged = ExprChanged || Index.get() != FromIndex;
13892 AD.setRBracketLoc(ON.getEndLoc());
13893 Desig.AddDesignator(AD);
13905 Desig.AddDesignator(
13917 if (!getDerived().AlwaysRebuild() &&
13918 Type == E->getTypeSourceInfo() &&
13923 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type, Desig,
13924 E->getRParenLoc());
13927template<
typename Derived>
13930 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13931 "opaque value expression requires transformation");
13935template <
typename Derived>
13939 for (
Expr *
C : E->subExpressions()) {
13941 if (NewC.isInvalid())
13947 if (!getDerived().AlwaysRebuild() && !Changed)
13949 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13953template<
typename Derived>
13963 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13964 if (result.isInvalid())
return ExprError();
13969 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13975template<
typename Derived>
13979 if (E->isArgumentType()) {
13986 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13989 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13991 E->getSourceRange());
14005 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
14007 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
14008 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
14009 PE, DRE,
false, &RecoveryTSI);
14011 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
14014 return getDerived().RebuildUnaryExprOrTypeTrait(
14015 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
14016 }
else if (SubExpr.isInvalid())
14019 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
14022 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
14023 E->getOperatorLoc(),
14025 E->getSourceRange());
14028template<
typename Derived>
14031 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14032 if (LHS.isInvalid())
14035 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14036 if (RHS.isInvalid())
14040 if (!getDerived().AlwaysRebuild() &&
14041 LHS.get() == E->getLHS() &&
14042 RHS.get() == E->getRHS())
14045 return getDerived().RebuildArraySubscriptExpr(
14047 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
14050template <
typename Derived>
14054 if (
Base.isInvalid())
14057 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14058 if (RowIdx.isInvalid())
14061 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14062 RowIdx.get() == E->getRowIdx())
14065 return getDerived().RebuildMatrixSingleSubscriptExpr(
Base.get(), RowIdx.get(),
14066 E->getRBracketLoc());
14069template <
typename Derived>
14073 if (
Base.isInvalid())
14076 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
14077 if (RowIdx.isInvalid())
14080 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
14081 if (ColumnIdx.isInvalid())
14084 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14085 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
14088 return getDerived().RebuildMatrixSubscriptExpr(
14089 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
14092template <
typename Derived>
14096 if (
Base.isInvalid())
14100 if (E->getLowerBound()) {
14101 LowerBound = getDerived().TransformExpr(E->getLowerBound());
14102 if (LowerBound.isInvalid())
14107 if (E->getLength()) {
14108 Length = getDerived().TransformExpr(E->getLength());
14109 if (Length.isInvalid())
14114 if (E->isOMPArraySection()) {
14115 if (
Expr *Str = E->getStride()) {
14116 Stride = getDerived().TransformExpr(Str);
14117 if (Stride.isInvalid())
14122 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
14123 LowerBound.get() == E->getLowerBound() &&
14124 Length.get() == E->getLength() &&
14125 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
14128 return getDerived().RebuildArraySectionExpr(
14129 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
14130 LowerBound.get(), E->getColonLocFirst(),
14131 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
14132 Length.get(), Stride.get(), E->getRBracketLoc());
14135template <
typename Derived>
14139 if (
Base.isInvalid())
14143 bool ErrorFound =
false;
14144 for (
Expr *
Dim : E->getDimensions()) {
14146 if (DimRes.isInvalid()) {
14150 Dims.push_back(DimRes.get());
14155 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
14156 E->getRParenLoc(), Dims,
14157 E->getBracketsRanges());
14160template <
typename Derived>
14163 unsigned NumIterators = E->numOfIterators();
14166 bool ErrorFound =
false;
14167 bool NeedToRebuild = getDerived().AlwaysRebuild();
14168 for (
unsigned I = 0; I < NumIterators; ++I) {
14170 Data[I].DeclIdent = D->getIdentifier();
14171 Data[I].DeclIdentLoc = D->getLocation();
14172 if (D->getLocation() == D->getBeginLoc()) {
14174 "Implicit type must be int.");
14176 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
14177 QualType DeclTy = getDerived().TransformType(D->getType());
14184 ErrorFound = ErrorFound ||
14185 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
14186 !
Data[I].Type.get().isNull())) ||
14187 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
14190 Data[I].Range.Begin = Begin.get();
14191 Data[I].Range.End = End.get();
14192 Data[I].Range.Step = Step.get();
14193 Data[I].AssignLoc = E->getAssignLoc(I);
14194 Data[I].ColonLoc = E->getColonLoc(I);
14195 Data[I].SecColonLoc = E->getSecondColonLoc(I);
14198 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
14199 D->getType().getTypePtrOrNull()) ||
14205 if (!NeedToRebuild)
14208 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
14209 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
14210 if (!Res.isUsable())
14213 for (
unsigned I = 0; I < NumIterators; ++I)
14214 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
14215 IE->getIteratorDecl(I));
14219template<
typename Derived>
14228 bool ArgChanged =
false;
14230 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14234 if (!getDerived().AlwaysRebuild() &&
14235 Callee.get() == E->getCallee() &&
14241 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14244 if (E->hasStoredFPFeatures()) {
14246 getSema().CurFPFeatures =
14248 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14251 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14253 E->getRParenLoc());
14256template<
typename Derived>
14260 if (
Base.isInvalid())
14264 if (E->hasQualifier()) {
14266 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
14274 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
14275 E->getMemberDecl()));
14279 NamedDecl *FoundDecl = E->getFoundDecl();
14280 if (FoundDecl == E->getMemberDecl()) {
14283 FoundDecl = cast_or_null<NamedDecl>(
14284 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
14289 if (!getDerived().AlwaysRebuild() &&
14290 Base.get() == E->getBase() &&
14291 QualifierLoc == E->getQualifierLoc() &&
14292 Member == E->getMemberDecl() &&
14293 FoundDecl == E->getFoundDecl() &&
14294 !E->hasExplicitTemplateArgs()) {
14299 getSema().OpenMP().isOpenMPRebuildMemberExpr(
14309 if (E->hasExplicitTemplateArgs()) {
14310 TransArgs.setLAngleLoc(E->getLAngleLoc());
14311 TransArgs.setRAngleLoc(E->getRAngleLoc());
14312 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
14313 E->getNumTemplateArgs(),
14326 NamedDecl *FirstQualifierInScope =
nullptr;
14328 if (MemberNameInfo.getName()) {
14329 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
14330 if (!MemberNameInfo.getName())
14334 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
14341 (E->hasExplicitTemplateArgs()
14342 ? &TransArgs :
nullptr),
14343 FirstQualifierInScope);
14346template<
typename Derived>
14349 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14350 if (LHS.isInvalid())
14354 getDerived().TransformInitializer(E->getRHS(),
false);
14355 if (RHS.isInvalid())
14358 if (!getDerived().AlwaysRebuild() &&
14359 LHS.get() == E->getLHS() &&
14360 RHS.get() == E->getRHS())
14363 if (E->isCompoundAssignmentOp())
14365 return getDerived().RebuildBinaryOperator(
14366 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
14369 getSema().CurFPFeatures =
14370 NewOverrides.applyOverrides(getSema().getLangOpts());
14371 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14372 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
14373 LHS.get(), RHS.get());
14376template <
typename Derived>
14381 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
14382 if (LHS.isInvalid())
14385 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
14386 if (RHS.isInvalid())
14392 bool ChangedAnyLookups =
false;
14393 Expr *PossibleBinOps[] = {E->getSemanticForm(),
14394 const_cast<Expr *
>(Decomp.InnerBinOp)};
14395 for (
Expr *PossibleBinOp : PossibleBinOps) {
14396 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
14399 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
14405 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
14406 E->getOperatorLoc(),
Callee->getFoundDecl()));
14410 ChangedAnyLookups =
true;
14411 UnqualLookups.addDecl(
Found);
14414 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
14415 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
14421 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
14426 return getDerived().RebuildCXXRewrittenBinaryOperator(
14427 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
14430template<
typename Derived>
14436 getSema().CurFPFeatures =
14437 NewOverrides.applyOverrides(getSema().getLangOpts());
14438 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14439 return getDerived().TransformBinaryOperator(E);
14442template<
typename Derived>
14448 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
14449 if (commonExpr.isInvalid())
14452 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
14453 if (rhs.isInvalid())
14456 if (!getDerived().AlwaysRebuild() &&
14457 commonExpr.get() == e->getCommon() &&
14458 rhs.get() == e->getFalseExpr())
14461 return getDerived().RebuildConditionalOperator(commonExpr.get(),
14462 e->getQuestionLoc(),
14468template<
typename Derived>
14471 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14472 if (Cond.isInvalid())
14475 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14476 if (LHS.isInvalid())
14479 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14480 if (RHS.isInvalid())
14483 if (!getDerived().AlwaysRebuild() &&
14484 Cond.get() == E->getCond() &&
14485 LHS.get() == E->getLHS() &&
14486 RHS.get() == E->getRHS())
14489 return getDerived().RebuildConditionalOperator(Cond.get(),
14490 E->getQuestionLoc(),
14496template<
typename Derived>
14501 return getDerived().
TransformExpr(E->getSubExprAsWritten());
14504template<
typename Derived>
14512 = getDerived().TransformExpr(E->getSubExprAsWritten());
14513 if (SubExpr.isInvalid())
14516 if (!getDerived().AlwaysRebuild() &&
14517 Type == E->getTypeInfoAsWritten() &&
14518 SubExpr.get() == E->getSubExpr())
14521 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
14527template<
typename Derived>
14535 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
14536 if (
Init.isInvalid())
14539 if (!getDerived().AlwaysRebuild() &&
14541 Init.get() == E->getInitializer())
14548 return getDerived().RebuildCompoundLiteralExpr(
14549 E->getLParenLoc(), NewT,
14550 E->getInitializer()->getEndLoc(),
Init.get());
14553template<
typename Derived>
14557 if (
Base.isInvalid())
14560 if (!getDerived().AlwaysRebuild() &&
14561 Base.get() == E->getBase())
14567 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14568 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
14572template <
typename Derived>
14576 if (
Base.isInvalid())
14579 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
14585 return getDerived().RebuildExtVectorOrMatrixElementExpr(
14586 Base.get(), FakeOperatorLoc,
false, E->getAccessorLoc(),
14590template<
typename Derived>
14596 bool InitChanged =
false;
14602 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
14603 Inits, &InitChanged))
14606 if (!getDerived().AlwaysRebuild() && !InitChanged) {
14613 return getDerived().RebuildInitList(E->getLBraceLoc(),
Inits,
14614 E->getRBraceLoc(), E->isExplicit());
14617template<
typename Derived>
14624 if (
Init.isInvalid())
14629 bool ExprChanged =
false;
14631 if (D.isFieldDesignator()) {
14632 if (D.getFieldDecl()) {
14634 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
14635 if (Field != D.getFieldDecl())
14638 ExprChanged =
true;
14639 if (
Field->isAnonymousStructOrUnion())
14645 ExprChanged =
true;
14648 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
14652 if (D.isArrayDesignator()) {
14653 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
14654 if (Index.isInvalid())
14657 Desig.AddDesignator(
14660 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
14661 ArrayExprs.push_back(Index.get());
14665 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
14667 = getDerived().TransformExpr(E->getArrayRangeStart(D));
14668 if (Start.isInvalid())
14671 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
14672 if (End.isInvalid())
14676 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
14678 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
14679 End.get() != E->getArrayRangeEnd(D);
14681 ArrayExprs.push_back(Start.get());
14682 ArrayExprs.push_back(End.get());
14685 if (!getDerived().AlwaysRebuild() &&
14686 Init.get() == E->getInit() &&
14690 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
14691 E->getEqualOrColonLoc(),
14692 E->usesGNUSyntax(),
Init.get());
14697template<
typename Derived>
14701 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
14706template<
typename Derived>
14710 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
14714template<
typename Derived>
14717 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
14721template<
typename Derived>
14724 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
14728template<
typename Derived>
14736 QualType T = getDerived().TransformType(E->getType());
14740 if (!getDerived().AlwaysRebuild() &&
14744 return getDerived().RebuildImplicitValueInitExpr(
T);
14747template<
typename Derived>
14750 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
14754 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14755 if (SubExpr.isInvalid())
14758 if (!getDerived().AlwaysRebuild() &&
14759 TInfo == E->getWrittenTypeInfo() &&
14760 SubExpr.get() == E->getSubExpr())
14763 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
14764 TInfo, E->getRParenLoc());
14767template<
typename Derived>
14770 bool ArgumentChanged =
false;
14772 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true,
Inits,
14776 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
14778 E->getRParenLoc());
14786template<
typename Derived>
14789 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
14794 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
14798template<
typename Derived>
14803 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
14804 if (SubStmt.isInvalid()) {
14809 unsigned OldDepth = E->getTemplateDepth();
14810 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
14812 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
14813 SubStmt.get() == E->getSubStmt()) {
14819 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
14820 E->getRParenLoc(), NewDepth);
14823template<
typename Derived>
14826 ExprResult Cond = getDerived().TransformExpr(E->getCond());
14827 if (Cond.isInvalid())
14830 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
14831 if (LHS.isInvalid())
14834 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
14835 if (RHS.isInvalid())
14838 if (!getDerived().AlwaysRebuild() &&
14839 Cond.get() == E->getCond() &&
14840 LHS.get() == E->getLHS() &&
14841 RHS.get() == E->getRHS())
14844 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
14845 Cond.get(), LHS.get(), RHS.get(),
14846 E->getRParenLoc());
14849template<
typename Derived>
14855template<
typename Derived>
14858 switch (E->getOperator()) {
14862 case OO_Array_Delete:
14863 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14868 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14881 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14882 FakeLParenLoc = EndLoc;
14886 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14890 if (E->getOperator() == OO_Subscript)
14891 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14892 Args, E->getEndLoc());
14894 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14898#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14902#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14903#include "clang/Basic/OperatorKinds.def"
14905 case OO_Conditional:
14906 llvm_unreachable(
"conditional operator is not actually overloadable");
14910 llvm_unreachable(
"not an overloaded operator?");
14914 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14915 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14917 First = getDerived().TransformExpr(E->getArg(0));
14918 if (
First.isInvalid())
14922 if (E->getNumArgs() == 2) {
14924 getDerived().TransformInitializer(E->getArg(1),
false);
14925 if (Second.isInvalid())
14931 getSema().CurFPFeatures =
14932 NewOverrides.applyOverrides(getSema().getLangOpts());
14933 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14939 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14942 return getDerived().RebuildCXXOperatorCallExpr(
14943 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14944 ULE->requiresADL(),
R.asUnresolvedSet(),
First.get(), Second.get());
14949 Callee = ICE->getSubExprAsWritten();
14951 ValueDecl *VD = cast_or_null<ValueDecl>(
14952 getDerived().TransformDecl(DR->getLocation(), DR));
14957 Functions.addDecl(VD);
14959 return getDerived().RebuildCXXOperatorCallExpr(
14960 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14961 false, Functions,
First.get(), Second.get());
14964template<
typename Derived>
14967 return getDerived().TransformCallExpr(E);
14970template <
typename Derived>
14973 getSema().CurContext != E->getParentContext();
14975 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14978 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14979 E->getBeginLoc(), E->getEndLoc(),
14980 getSema().CurContext);
14983template <
typename Derived>
14988template<
typename Derived>
14997 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14998 if (EC.isInvalid())
15002 bool ArgChanged =
false;
15004 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15008 if (!getDerived().AlwaysRebuild() &&
15009 Callee.get() == E->getCallee() &&
15015 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
15016 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
15018 E->getRParenLoc(), EC.get());
15021template<
typename Derived>
15037 return getDerived().RebuildCXXNamedCastExpr(
15044template<
typename Derived>
15053 if (Sub.isInvalid())
15056 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
15060template<
typename Derived>
15062TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
15063 return getDerived().TransformCXXNamedCastExpr(E);
15066template<
typename Derived>
15072template<
typename Derived>
15079template<
typename Derived>
15085template<
typename Derived>
15091template<
typename Derived>
15096 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
15101 = getDerived().TransformExpr(E->getSubExprAsWritten());
15102 if (SubExpr.isInvalid())
15105 if (!getDerived().AlwaysRebuild() &&
15106 Type == E->getTypeInfoAsWritten() &&
15107 SubExpr.get() == E->getSubExpr())
15110 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
15114 E->isListInitialization());
15117template<
typename Derived>
15120 if (E->isTypeOperand()) {
15122 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15126 if (!getDerived().AlwaysRebuild() &&
15127 TInfo == E->getTypeOperandSourceInfo())
15130 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15131 TInfo, E->getEndLoc());
15137 Expr *Op = E->getExprOperand();
15139 if (E->isGLValue()) {
15141 if (
auto *RD = OpType->getAsCXXRecordDecl()) {
15143 diag::err_incomplete_typeid))
15146 if (RD->isPolymorphic())
15154 ExprResult SubExpr = getDerived().TransformExpr(Op);
15155 if (SubExpr.isInvalid())
15158 if (!getDerived().AlwaysRebuild() &&
15159 SubExpr.get() == E->getExprOperand())
15162 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
15163 SubExpr.get(), E->getEndLoc());
15166template<
typename Derived>
15169 if (E->isTypeOperand()) {
15171 = getDerived().TransformType(E->getTypeOperandSourceInfo());
15175 if (!getDerived().AlwaysRebuild() &&
15176 TInfo == E->getTypeOperandSourceInfo())
15179 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15180 TInfo, E->getEndLoc());
15186 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
15187 if (SubExpr.isInvalid())
15190 if (!getDerived().AlwaysRebuild() &&
15191 SubExpr.get() == E->getExprOperand())
15194 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
15195 SubExpr.get(), E->getEndLoc());
15198template<
typename Derived>
15204template<
typename Derived>
15211template<
typename Derived>
15227 auto &S = getSema();
15228 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
15229 return S.getCurrentThisType();
15230 if (S.getCurLambda())
15231 return getDerived().TransformType(E->getType());
15232 return S.getCurrentThisType();
15235 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
15236 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
15239 getSema().MarkThisReferenced(E);
15243 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
15246template<
typename Derived>
15249 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
15250 if (SubExpr.isInvalid())
15253 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
15255 if (!getDerived().AlwaysRebuild() &&
15256 SubExpr.get() == E->getSubExpr())
15259 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
15260 E->isThrownVariableInScope());
15263template<
typename Derived>
15267 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
15272 if (E->hasRewrittenInit()) {
15273 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15274 if (InitRes.isInvalid())
15278 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
15279 E->getUsedContext() == SemaRef.
CurContext &&
15280 InitRes.get() == E->getRewrittenExpr())
15283 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
15287template<
typename Derived>
15291 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
15296 if (E->hasRewrittenInit()) {
15300 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
15301 if (InitRes.isInvalid())
15305 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
15306 E->getUsedContext() == SemaRef.
CurContext &&
15307 InitRes.get() == E->getExpr())
15310 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field,
15314template<
typename Derived>
15318 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
15322 if (!getDerived().AlwaysRebuild() &&
15323 T == E->getTypeSourceInfo())
15326 return getDerived().RebuildCXXScalarValueInitExpr(
T,
15327 T->getTypeLoc().getEndLoc(),
15328 E->getRParenLoc());
15331template<
typename Derived>
15336 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
15337 if (!AllocTypeInfo)
15341 std::optional<Expr *> ArraySize;
15342 if (E->isArray()) {
15344 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
15345 NewArraySize = getDerived().TransformExpr(*OldArraySize);
15346 if (NewArraySize.isInvalid())
15349 ArraySize = NewArraySize.get();
15353 bool ArgumentChanged =
false;
15355 if (getDerived().TransformExprs(E->getPlacementArgs(),
15356 E->getNumPlacementArgs(),
true,
15357 PlacementArgs, &ArgumentChanged))
15361 Expr *OldInit = E->getInitializer();
15364 NewInit = getDerived().TransformInitializer(OldInit,
true);
15365 if (NewInit.isInvalid())
15370 if (E->getOperatorNew()) {
15371 OperatorNew = cast_or_null<FunctionDecl>(
15372 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
15378 if (E->getOperatorDelete()) {
15379 OperatorDelete = cast_or_null<FunctionDecl>(
15380 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15381 if (!OperatorDelete)
15385 if (!getDerived().AlwaysRebuild() &&
15386 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
15387 ArraySize == E->getArraySize() &&
15388 NewInit.get() == OldInit &&
15389 OperatorNew == E->getOperatorNew() &&
15390 OperatorDelete == E->getOperatorDelete() &&
15391 !ArgumentChanged) {
15396 if (OperatorDelete)
15399 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
15411 QualType AllocType = AllocTypeInfo->getType();
15422 = dyn_cast<ConstantArrayType>(ArrayT)) {
15426 AllocType = ConsArrayT->getElementType();
15428 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
15429 if (DepArrayT->getSizeExpr()) {
15430 ArraySize = DepArrayT->getSizeExpr();
15431 AllocType = DepArrayT->getElementType();
15436 return getDerived().RebuildCXXNewExpr(
15437 E->getBeginLoc(), E->isGlobalNew(),
15438 E->getBeginLoc(), PlacementArgs,
15439 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
15440 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
15443template<
typename Derived>
15452 if (E->getOperatorDelete()) {
15453 OperatorDelete = cast_or_null<FunctionDecl>(
15454 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
15455 if (!OperatorDelete)
15459 if (!getDerived().AlwaysRebuild() &&
15460 Operand.get() == E->getArgument() &&
15461 OperatorDelete == E->getOperatorDelete()) {
15464 if (OperatorDelete)
15467 if (!E->getArgument()->isTypeDependent()) {
15469 E->getDestroyedType());
15478 return getDerived().RebuildCXXDeleteExpr(
15479 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
15482template<
typename Derived>
15487 if (
Base.isInvalid())
15491 bool MayBePseudoDestructor =
false;
15493 E->getOperatorLoc(),
15494 E->isArrow()? tok::arrow : tok::period,
15496 MayBePseudoDestructor);
15497 if (
Base.isInvalid())
15500 QualType ObjectType = ObjectTypePtr.get();
15502 if (QualifierLoc) {
15504 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
15509 SS.
Adopt(QualifierLoc);
15512 if (E->getDestroyedTypeInfo()) {
15513 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
15514 E->getDestroyedTypeInfo(), ObjectType,
15516 if (!DestroyedTypeInfo)
15519 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
15523 E->getDestroyedTypeLoc());
15527 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
15528 nullptr, SS, ObjectTypePtr,
false);
15534 E->getDestroyedTypeLoc());
15538 if (E->getScopeTypeInfo()) {
15539 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
15540 E->getScopeTypeInfo(), ObjectType,
nullptr);
15541 if (!ScopeTypeInfo)
15545 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
15546 E->getOperatorLoc(),
15550 E->getColonColonLoc(),
15555template <
typename Derived>
15560 bool AllEmptyPacks =
true;
15561 for (
auto *OldD : Old->
decls()) {
15577 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
15578 Decls = UPD->expansions();
15581 for (
auto *D : Decls) {
15582 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
15583 for (
auto *SD : UD->shadows())
15590 AllEmptyPacks &= Decls.empty();
15599 if (AllEmptyPacks && !RequiresADL) {
15610 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
15611 getSema().FilterAcceptableTemplateNames(R,
15617 getSema().Diag(R.getNameLoc(),
15618 diag::err_template_kw_refers_to_non_template)
15622 diag::note_template_kw_refers_to_non_template)
15623 << R.getLookupName();
15631template <
typename Derived>
15637template <
typename Derived>
15640 bool IsAddressOfOperand) {
15645 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
15652 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
15656 SS.
Adopt(QualifierLoc);
15660 CXXRecordDecl *NamingClass
15661 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
15664 if (!NamingClass) {
15669 R.setNamingClass(NamingClass);
15690 SS, TemplateKWLoc, R,
15697 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
15700 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
15704template<
typename Derived>
15707 bool ArgChanged =
false;
15709 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
15711 TypeLoc FromTL = From->getTypeLoc();
15714 TLB.
reserve(FromTL.getFullDataSize());
15715 QualType To = getDerived().TransformType(TLB, FromTL);
15719 if (To == From->getType())
15720 Args.push_back(From);
15722 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15732 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
15738 bool Expand =
true;
15739 bool RetainExpansion =
false;
15741 ExpansionTL.getTypePtr()->getNumExpansions();
15743 if (getDerived().TryExpandParameterPacks(
15744 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
15745 Unexpanded,
true, Expand,
15746 RetainExpansion, NumExpansions))
15756 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15758 QualType To = getDerived().TransformType(TLB, PatternTL);
15762 To = getDerived().RebuildPackExpansionType(To,
15763 PatternTL.getSourceRange(),
15764 ExpansionTL.getEllipsisLoc(),
15772 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15778 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15781 TLB.
reserve(PatternTL.getFullDataSize());
15782 QualType To = getDerived().TransformType(TLB, PatternTL);
15786 if (To->containsUnexpandedParameterPack()) {
15787 To = getDerived().RebuildPackExpansionType(To,
15788 PatternTL.getSourceRange(),
15789 ExpansionTL.getEllipsisLoc(),
15799 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15802 if (!RetainExpansion)
15807 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
15810 TLB.
reserve(From->getTypeLoc().getFullDataSize());
15812 QualType To = getDerived().TransformType(TLB, PatternTL);
15816 To = getDerived().RebuildPackExpansionType(To,
15817 PatternTL.getSourceRange(),
15818 ExpansionTL.getEllipsisLoc(),
15826 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
15829 if (!getDerived().AlwaysRebuild() && !ArgChanged)
15832 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
15836template<
typename Derived>
15842 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
15843 Old->NumTemplateArgs, TransArgs))
15846 return getDerived().RebuildConceptSpecializationExpr(
15847 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
15848 E->getConceptNameInfo(), E->getFoundDecl(), E->getConceptDecl(),
15852template<
typename Derived>
15866 getSema().Context, getSema().CurContext,
15867 E->getBody()->getBeginLoc());
15871 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
15872 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
15873 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
15877 Param->setDeclContext(Body);
15883 if (!TypeParamResult.isUnset())
15884 return TypeParamResult;
15887 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15892 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15893 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15894 ER->getReturnTypeRequirement()
15895 .getTypeConstraintTemplateParameterList()->getParam(0)
15896 ->setDeclContext(Body);
15901 return getDerived().RebuildRequiresExpr(
15902 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15903 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15906template<
typename Derived>
15912 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15913 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15914 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15915 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15917 TransReq =
getDerived().TransformNestedRequirement(
15921 Transformed.push_back(TransReq);
15926template<
typename Derived>
15939 return getDerived().RebuildTypeRequirement(TransType);
15942template<
typename Derived>
15945 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15951 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15954 TransExpr = TransExprRes.
get();
15957 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15959 if (RetReq.isEmpty())
15960 TransRetReq.emplace();
15961 else if (RetReq.isSubstitutionFailure())
15962 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15963 else if (RetReq.isTypeConstraint()) {
15965 RetReq.getTypeConstraintTemplateParameterList();
15967 getDerived().TransformTemplateParameterList(OrigTPL);
15970 TransRetReq.emplace(TPL);
15972 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15973 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15976 std::move(*TransRetReq));
15982template<
typename Derived>
15988 return getDerived().RebuildNestedRequirement(
15996 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15999template<
typename Derived>
16006 if (!getDerived().AlwaysRebuild() &&
16023template<
typename Derived>
16030 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
16031 if (SubExpr.isInvalid())
16034 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
16038 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
16039 SubExpr.get(), E->getEndLoc());
16042template <
typename Derived>
16047 DRE, AddrTaken, RecoveryTSI);
16060template <
typename Derived>
16067template <
typename Derived>
16083 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
16088 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
16094 return getDerived().RebuildDependentScopeDeclRefExpr(
16095 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
16096 IsAddressOfOperand, RecoveryTSI);
16100 if (getDerived().TransformTemplateArguments(
16104 return getDerived().RebuildDependentScopeDeclRefExpr(
16105 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
16109template<
typename Derived>
16115 if (getDerived().AllowSkippingCXXConstructExpr() &&
16116 ((E->getNumArgs() == 1 ||
16117 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
16118 (!getDerived().DropCallArgument(E->getArg(0))) &&
16119 !E->isListInitialization()))
16125 QualType T = getDerived().TransformType(E->getType());
16130 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16134 bool ArgumentChanged =
false;
16139 E->isListInitialization());
16140 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16145 if (!getDerived().AlwaysRebuild() &&
16146 T == E->getType() &&
16148 !ArgumentChanged) {
16155 return getDerived().RebuildCXXConstructExpr(
16156 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
16157 E->hadMultipleCandidates(), E->isListInitialization(),
16158 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
16159 E->getConstructionKind(), E->getParenOrBraceRange());
16162template<
typename Derived>
16165 QualType T = getDerived().TransformType(E->getType());
16170 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16174 if (!getDerived().AlwaysRebuild() &&
16175 T == E->getType() &&
16183 return getDerived().RebuildCXXInheritedCtorInitExpr(
16185 E->constructsVBase(), E->inheritedFromVBase());
16192template<
typename Derived>
16195 if (
auto *Dtor = E->getTemporary()->getDestructor())
16198 return getDerived().TransformExpr(E->getSubExpr());
16206template<
typename Derived>
16212template<
typename Derived>
16217 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
16222 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
16226 bool ArgumentChanged =
false;
16228 Args.reserve(E->getNumArgs());
16232 E->isListInitialization());
16233 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
16237 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
16238 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc(),
16240 if (Res.isInvalid())
16242 Args = {Res.get()};
16246 if (!getDerived().AlwaysRebuild() &&
16247 T == E->getTypeSourceInfo() &&
16249 !ArgumentChanged) {
16256 return getDerived().RebuildCXXTemporaryObjectExpr(
16257 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
16260template<
typename Derived>
16265 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
16266 struct TransformedInitCapture {
16268 SourceLocation EllipsisLoc;
16270 SmallVector<InitCaptureInfoTy, 4> Expansions;
16273 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
16275 CEnd = E->capture_end();
16277 if (!E->isInitCapture(
C))
16280 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
16285 ExprResult NewExprInitResult = getDerived().TransformInitializer(
16288 if (NewExprInitResult.isInvalid()) {
16292 Expr *NewExprInit = NewExprInitResult.get();
16295 getSema().buildLambdaInitCaptureInitialization(
16296 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
16297 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
16301 Result.Expansions.push_back(
16302 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
16306 if (OldVD->isParameterPack()) {
16315 bool Expand =
true;
16316 bool RetainExpansion =
false;
16318 ExpansionTL.getTypePtr()->getNumExpansions();
16320 if (getDerived().TryExpandParameterPacks(
16321 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
16322 Unexpanded,
true, Expand,
16323 RetainExpansion, NumExpansions))
16325 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
16326 "capture since it cannot be extended");
16328 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16333 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
16334 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
16373 if ((getSema().isUnevaluatedContext() ||
16374 getSema().isConstantEvaluatedContext()) &&
16375 !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
16377 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
16382 E->getIntroducerRange(),
nullptr, DependencyKind,
16383 E->getCaptureDefault());
16384 getDerived().transformedLocalDecl(OldClass, {
Class});
16387 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
16390 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
16391 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
16392 E->hasExplicitParameters(), E->isMutable());
16402 CEnd = E->capture_end();
16406 if (
C->isImplicit())
16410 if (
C->capturesThis()) {
16418 dyn_cast_if_present<CXXRecordDecl>(
16419 getSema().getFunctionLevelDeclContext()),
16421 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16428 if (
C->capturesVLAType())
16432 if (E->isInitCapture(
C)) {
16433 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
16438 for (InitCaptureInfoTy &Info : NewC.Expansions) {
16440 QualType InitQualType = Info.second;
16441 if (
Init.isInvalid() || InitQualType.isNull()) {
16445 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
16446 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
16447 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
16448 getSema().CurContext);
16453 NewVDs.push_back(NewVD);
16454 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
16459 if (NewC.EllipsisLoc.isInvalid())
16460 LSI->ContainsUnexpandedParameterPack |=
16461 Init.get()->containsUnexpandedParameterPack();
16467 getDerived().transformedLocalDecl(OldVD, NewVDs);
16471 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16479 if (
C->isPackExpansion()) {
16481 bool ShouldExpand =
false;
16482 bool RetainExpansion =
false;
16484 if (getDerived().TryExpandParameterPacks(
16485 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
16486 true, ShouldExpand,
16487 RetainExpansion, NumExpansions)) {
16492 if (ShouldExpand) {
16497 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16499 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
16500 getDerived().TransformDecl(
C->getLocation(), Pack));
16501 if (!CapturedVar) {
16507 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
16515 EllipsisLoc =
C->getEllipsisLoc();
16519 auto *CapturedVar = cast_or_null<ValueDecl>(
16520 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
16521 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
16528 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
16529 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
16532 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
16535 getSema().finishLambdaExplicitCaptures(LSI);
16539 auto TPL = getDerived().TransformTemplateParameterList(
16540 E->getTemplateParameterList());
16541 LSI->GLTemplateParameterList = TPL;
16543 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
16545 LSI->ContainsUnexpandedParameterPack |=
16546 TPL->containsUnexpandedParameterPack();
16551 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
16553 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
16554 if (NewCallOpType.isNull())
16556 LSI->ContainsUnexpandedParameterPack |=
16557 NewCallOpType->containsUnexpandedParameterPack();
16559 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
16564 assert(FPTL &&
"Not a FunctionProtoType?");
16568 ExprResult E = getDerived().TransformLambdaConstraint(
16569 const_cast<Expr *
>(TRC.ConstraintExpr));
16572 TRC.ConstraintExpr = E.get();
16575 LSI->BeforeCompoundStatement =
false;
16576 getSema().CompleteLambdaCallOperator(
16577 NewCallOperator, E->getCallOperator()->getLocation(),
16578 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
16579 E->getCallOperator()->getConstexprKind(),
16580 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
16581 E->hasExplicitResultType());
16583 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
16584 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
16590 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
16591 if (getDerived().ReplacingOriginal()) {
16592 Numbering = OldClass->getLambdaNumbering();
16595 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
16600 getSema().PushExpressionEvaluationContextForFunction(
16602 E->getCallOperator());
16609 C.PointOfInstantiation = E->getBody()->getBeginLoc();
16610 getSema().pushCodeSynthesisContext(
C);
16614 : getDerived().TransformLambdaBody(E, E->getBody());
16616 getSema().popCodeSynthesisContext();
16620 FuncScopeCleanup.disable();
16622 if (Body.isInvalid()) {
16623 SavedContext.pop();
16624 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
16629 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
16632 SavedContext.pop();
16667 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
16668 Class->setLambdaDependencyKind(DependencyKind);
16670 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
16671 Body.get()->getEndLoc(), LSI);
16674template<
typename Derived>
16680template<
typename Derived>
16689 if (!
C->isImplicit())
16693 if (
C->capturesThis()) {
16694 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
16701 if (
C->capturesVLAType())
16704 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
16708 VarDecl *CapturedVar = cast_or_null<VarDecl>(
16714 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
16720template<
typename Derived>
16729 bool ArgumentChanged =
false;
16741 if (!getDerived().AlwaysRebuild() &&
16747 return getDerived().RebuildCXXUnresolvedConstructExpr(
16751template <
typename Derived>
16755 TemplateName Name = getDerived().TransformConceptTemplateName(
16756 E->getTemplateName(), E->getNameLoc());
16761 if (getDerived().TransformTemplateArguments(
16762 E->template_arguments().data(), E->getNumTemplateArgs(), TransArgs))
16775 return getDerived().RebuildTemplateIdExpr(
16777 false, &TransArgs);
16780template<
typename Derived>
16789 if (!E->isImplicitAccess()) {
16790 OldBase = E->getBase();
16791 Base = getDerived().TransformExpr(OldBase);
16792 if (
Base.isInvalid())
16797 bool MayBePseudoDestructor =
false;
16799 E->getOperatorLoc(),
16800 E->isArrow()? tok::arrow : tok::period,
16802 MayBePseudoDestructor);
16803 if (
Base.isInvalid())
16806 ObjectType = ObjectTy.get();
16807 BaseType = ((
Expr*)
Base.get())->getType();
16810 BaseType = getDerived().TransformType(E->getBaseType());
16817 = getDerived().TransformFirstQualifierInScope(
16818 E->getFirstQualifierFoundInScope(),
16819 E->getQualifierLoc().getBeginLoc());
16822 if (E->getQualifier()) {
16824 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
16826 FirstQualifierInScope);
16838 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
16839 if (!NameInfo.getName())
16842 if (!E->hasExplicitTemplateArgs()) {
16845 if (!getDerived().AlwaysRebuild() &&
16846 Base.get() == OldBase &&
16847 BaseType == E->getBaseType() &&
16848 QualifierLoc == E->getQualifierLoc() &&
16849 NameInfo.getName() == E->getMember() &&
16850 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
16853 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16856 E->getOperatorLoc(),
16859 FirstQualifierInScope,
16865 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
16866 E->getNumTemplateArgs(),
16870 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
16873 E->getOperatorLoc(),
16876 FirstQualifierInScope,
16881template <
typename Derived>
16887 if (!Old->isImplicitAccess()) {
16888 Base = getDerived().TransformExpr(Old->getBase());
16889 if (
Base.isInvalid())
16892 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
16893 if (
Base.isInvalid())
16895 BaseType =
Base.get()->getType();
16897 BaseType = getDerived().TransformType(Old->getBaseType());
16901 if (Old->getQualifierLoc()) {
16903 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
16913 if (TransformOverloadExprDecls(Old,
false, R))
16917 if (Old->getNamingClass()) {
16919 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16923 R.setNamingClass(NamingClass);
16927 if (Old->hasExplicitTemplateArgs()) {
16928 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16929 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16930 if (getDerived().TransformTemplateArguments(
16931 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16939 NamedDecl *FirstQualifierInScope =
nullptr;
16941 return getDerived().RebuildUnresolvedMemberExpr(
16942 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16943 TemplateKWLoc, FirstQualifierInScope, R,
16944 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16947template<
typename Derived>
16952 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16953 if (SubExpr.isInvalid())
16956 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16959 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16962template<
typename Derived>
16965 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16966 if (Pattern.isInvalid())
16969 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16972 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16973 E->getNumExpansions());
16976template <
typename Derived>
16981 if (!Arg.isPackExpansion()) {
16993 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16994 OrigNumExpansions);
17006 if (!NumExpansions) {
17018template<
typename Derived>
17037 bool ShouldExpand =
false;
17038 bool RetainExpansion =
false;
17040 if (getDerived().TryExpandParameterPacks(
17042 true, ShouldExpand,
17043 RetainExpansion, NumExpansions))
17048 if (ShouldExpand) {
17050 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
17051 ArgStorage = getSema().Context.getPackExpansionType(
17052 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
17053 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
17057 ExprResult DRE = getSema().BuildDeclRefExpr(
17058 VD, VD->getType().getNonLValueExprType(getSema().Context),
17061 if (DRE.isInvalid())
17064 new (getSema().Context)
17068 PackArgs = ArgStorage;
17073 if (!PackArgs.size()) {
17074 auto *Pack = cast_or_null<NamedDecl>(
17078 return getDerived().RebuildSizeOfPackExpr(
17085 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
17097 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
17100 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
17101 PackLocIterator(*
this, PackArgs.end()),
17102 TransformedPackArgs,
true))
17109 bool PartialSubstitution =
false;
17110 for (
auto &Loc : TransformedPackArgs.arguments()) {
17111 Args.push_back(Loc.getArgument());
17112 if (Loc.getArgument().isPackExpansion())
17113 PartialSubstitution =
true;
17116 if (PartialSubstitution)
17117 return getDerived().RebuildSizeOfPackExpr(
17119 std::nullopt, Args);
17121 return getDerived().RebuildSizeOfPackExpr(
17123 static_cast<unsigned>(Args.size()),
17127template <
typename Derived>
17130 if (!E->isValueDependent())
17138 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
17139 if (IndexExpr.isInvalid())
17144 bool FullySubstituted =
true;
17145 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
17146 Expr *Pattern = E->getPackIdExpression();
17148 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
17150 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17154 bool ShouldExpand =
true;
17155 bool RetainExpansion =
false;
17157 NumExpansions = std::nullopt;
17158 if (getDerived().TryExpandParameterPacks(
17159 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17160 true, ShouldExpand,
17161 RetainExpansion, NumExpansions))
17163 if (!ShouldExpand) {
17165 ExprResult Pack = getDerived().TransformExpr(Pattern);
17166 if (Pack.isInvalid())
17168 return getDerived().RebuildPackIndexingExpr(
17169 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
17172 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17175 if (
Out.isInvalid())
17177 if (
Out.get()->containsUnexpandedParameterPack()) {
17178 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17179 OrigNumExpansions);
17180 if (
Out.isInvalid())
17182 FullySubstituted =
false;
17184 ExpandedExprs.push_back(
Out.get());
17188 if (RetainExpansion) {
17189 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17192 if (
Out.isInvalid())
17195 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
17196 OrigNumExpansions);
17197 if (
Out.isInvalid())
17199 FullySubstituted =
false;
17200 ExpandedExprs.push_back(
Out.get());
17202 }
else if (!E->expandsToEmptyPack()) {
17203 if (getDerived().TransformExprs(E->getExpressions().data(),
17204 E->getExpressions().size(),
false,
17209 return getDerived().RebuildPackIndexingExpr(
17210 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
17211 IndexExpr.get(), ExpandedExprs, FullySubstituted);
17214template <
typename Derived>
17217 if (!getSema().ArgPackSubstIndex)
17223 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17224 E->getAssociatedDecl(), E->getParameterPack()->getPosition(),
17225 E->getParameterPack()->getType(), E->getParameterPackLocation(), Arg,
17229template <
typename Derived>
17246 ExprResult Replacement = getDerived().TransformExpr(OrigReplacement);
17247 if (Replacement.isInvalid())
17250 Decl *AssociatedDecl =
17251 getDerived().TransformDecl(E->getNameLoc(), E->getAssociatedDecl());
17252 if (!AssociatedDecl)
17255 QualType ParamType = TransformType(E->getParameterType());
17256 if (ParamType.isNull())
17259 if (Replacement.get() == OrigReplacement &&
17260 AssociatedDecl == E->getAssociatedDecl() &&
17261 ParamType == E->getParameterType())
17264 if (Replacement.get() != OrigReplacement ||
17265 ParamType != E->getParameterType()) {
17274 Param, ParamType, Replacement.get(), SugaredConverted,
17275 CanonicalConverted,
17277 if (Replacement.isInvalid())
17281 Replacement = E->getReplacement();
17284 return getDerived().RebuildSubstNonTypeTemplateParmExpr(
17285 AssociatedDecl, E->getIndex(), ParamType, E->getNameLoc(),
17287 E->getPackIndex(), E->getFinal());
17290template<
typename Derived>
17297template<
typename Derived>
17304template<
typename Derived>
17308 if (
Expr *OldCallee = E->getCallee()) {
17309 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
17310 if (CalleeResult.isInvalid())
17315 Expr *Pattern = E->getPattern();
17318 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
17319 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17323 bool Expand =
true;
17324 bool RetainExpansion =
false;
17326 NumExpansions = OrigNumExpansions;
17327 if (getDerived().TryExpandParameterPacks(
17328 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
17329 true, Expand, RetainExpansion,
17339 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
17340 if (LHS.isInvalid())
17344 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
17345 if (RHS.isInvalid())
17348 if (!getDerived().AlwaysRebuild() &&
17349 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
17352 return getDerived().RebuildCXXFoldExpr(
17353 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
17354 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
17360 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
17361 SemaRef.
Diag(E->getEllipsisLoc(),
17362 clang::diag::err_fold_expression_limit_exceeded)
17363 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
17364 << E->getSourceRange();
17365 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
17374 bool LeftFold = E->isLeftFold();
17378 if (!LeftFold && RetainExpansion) {
17379 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17382 if (
Out.isInvalid())
17385 Result = getDerived().RebuildCXXFoldExpr(
17386 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
17387 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
17392 bool WarnedOnComparison =
false;
17393 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17395 getSema(), LeftFold ? I : *NumExpansions - I - 1);
17397 if (
Out.isInvalid())
17400 if (
Out.get()->containsUnexpandedParameterPack()) {
17402 Result = getDerived().RebuildCXXFoldExpr(
17403 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
17404 E->getOperator(), E->getEllipsisLoc(),
17405 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
17406 OrigNumExpansions);
17407 }
else if (
Result.isUsable()) {
17414 Result = getDerived().RebuildCXXOperatorCallExpr(
17416 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
17417 Functions, LHS, RHS);
17419 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
17420 E->getOperator(), LHS, RHS,
17422 if (!WarnedOnComparison &&
Result.isUsable()) {
17423 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
17424 BO && BO->isComparisonOp()) {
17425 WarnedOnComparison =
true;
17426 SemaRef.
Diag(BO->getBeginLoc(),
17427 diag::warn_comparison_in_fold_expression)
17428 << BO->getOpcodeStr();
17441 if (LeftFold && RetainExpansion) {
17442 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
17445 if (
Out.isInvalid())
17448 Result = getDerived().RebuildCXXFoldExpr(
17449 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
17450 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
17456 PE->setIsProducedByFoldExpansion();
17461 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
17466template <
typename Derived>
17472 QualType T = getDerived().TransformType(E->getType());
17474 bool ArgChanged =
false;
17476 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
17477 TransformedInits, &ArgChanged))
17480 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
17483 return getDerived().RebuildCXXParenListInitExpr(
17484 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
17485 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
17488template<
typename Derived>
17495template<
typename Derived>
17501template<
typename Derived>
17507template<
typename Derived>
17510 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
17511 if (SubExpr.isInvalid())
17514 if (!getDerived().AlwaysRebuild() &&
17515 SubExpr.get() == E->getSubExpr())
17518 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
17521template<
typename Derived>
17526 bool ArgChanged =
false;
17527 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
17528 false, Elements, &ArgChanged))
17531 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17534 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
17539template<
typename Derived>
17545 bool ArgChanged =
false;
17546 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
17549 if (OrigElement.isPackExpansion()) {
17552 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
17553 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
17554 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
17558 bool Expand =
true;
17559 bool RetainExpansion =
false;
17562 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
17563 OrigElement.Value->getEndLoc());
17564 if (getDerived().TryExpandParameterPacks(
17565 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
17566 true, Expand, RetainExpansion,
17575 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17576 if (Key.isInvalid())
17579 if (Key.get() != OrigElement.Key)
17583 if (
Value.isInvalid())
17590 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
17592 Elements.push_back(Expansion);
17602 for (
unsigned I = 0; I != *NumExpansions; ++I) {
17604 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17605 if (Key.isInvalid())
17609 if (
Value.isInvalid())
17619 if (Key.get()->containsUnexpandedParameterPack() ||
17620 Value.get()->containsUnexpandedParameterPack())
17621 Element.EllipsisLoc = OrigElement.EllipsisLoc;
17623 Elements.push_back(Element);
17633 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
17634 if (Key.isInvalid())
17637 if (Key.get() != OrigElement.Key)
17642 = getDerived().TransformExpr(OrigElement.Value);
17643 if (
Value.isInvalid())
17651 Elements.push_back(Element);
17654 if (!getDerived().AlwaysRebuild() && !ArgChanged)
17657 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
17661template<
typename Derived>
17665 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
17666 if (!EncodedTypeInfo)
17669 if (!getDerived().AlwaysRebuild() &&
17670 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
17673 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
17675 E->getRParenLoc());
17678template<
typename Derived>
17688template<
typename Derived>
17692 = getDerived().TransformType(E->getTypeInfoAsWritten());
17700 if (!getDerived().AlwaysRebuild() &&
17701 TSInfo == E->getTypeInfoAsWritten() &&
17702 Result.get() == E->getSubExpr())
17706 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
17710template <
typename Derived>
17716template<
typename Derived>
17720 bool ArgChanged =
false;
17722 Args.reserve(E->getNumArgs());
17723 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
17730 = getDerived().TransformType(E->getClassReceiverTypeInfo());
17731 if (!ReceiverTypeInfo)
17735 if (!getDerived().AlwaysRebuild() &&
17736 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
17741 E->getSelectorLocs(SelLocs);
17742 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
17745 E->getMethodDecl(),
17752 if (!E->getMethodDecl())
17757 E->getSelectorLocs(SelLocs);
17758 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
17761 E->getReceiverType(),
17762 E->getMethodDecl(),
17770 "Only class and instance messages may be instantiated");
17772 = getDerived().TransformExpr(E->getInstanceReceiver());
17773 if (Receiver.isInvalid())
17777 if (!getDerived().AlwaysRebuild() &&
17778 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
17783 E->getSelectorLocs(SelLocs);
17784 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
17787 E->getMethodDecl(),
17793template<
typename Derived>
17799template<
typename Derived>
17805template<
typename Derived>
17810 if (
Base.isInvalid())
17816 if (!getDerived().AlwaysRebuild() &&
17817 Base.get() == E->getBase())
17820 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
17822 E->isArrow(), E->isFreeIvar());
17825template<
typename Derived>
17830 if (!E->isObjectReceiver())
17835 if (
Base.isInvalid())
17841 if (!getDerived().AlwaysRebuild() &&
17842 Base.get() == E->getBase())
17845 if (E->isExplicitProperty())
17846 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17847 E->getExplicitProperty(),
17850 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
17852 E->getImplicitPropertyGetter(),
17853 E->getImplicitPropertySetter(),
17857template<
typename Derived>
17862 if (
Base.isInvalid())
17866 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
17867 if (Key.isInvalid())
17871 if (!getDerived().AlwaysRebuild() &&
17872 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
17875 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
17876 Base.get(), Key.get(),
17877 E->getAtIndexMethodDecl(),
17878 E->setAtIndexMethodDecl());
17881template<
typename Derived>
17886 if (
Base.isInvalid())
17890 if (!getDerived().AlwaysRebuild() &&
17891 Base.get() == E->getBase())
17894 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
17899template<
typename Derived>
17902 bool ArgumentChanged =
false;
17904 SubExprs.reserve(E->getNumSubExprs());
17905 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17906 SubExprs, &ArgumentChanged))
17909 if (!getDerived().AlwaysRebuild() &&
17913 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
17915 E->getRParenLoc());
17918template<
typename Derived>
17921 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17922 if (SrcExpr.isInvalid())
17929 if (!getDerived().AlwaysRebuild() &&
17930 Type == E->getTypeSourceInfo() &&
17931 SrcExpr.get() == E->getSrcExpr())
17934 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
17935 SrcExpr.get(),
Type,
17936 E->getRParenLoc());
17939template<
typename Derived>
17942 BlockDecl *oldBlock = E->getBlockDecl();
17948 blockScope->TheDecl->setBlockMissingReturnType(
17949 oldBlock->blockMissingReturnType());
17958 if (getDerived().TransformFunctionTypeParams(
17959 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
17960 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
17962 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17967 getDerived().TransformType(exprFunctionType->getReturnType());
17969 auto epi = exprFunctionType->getExtProtoInfo();
17970 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
17973 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
17977 if (!params.empty())
17978 blockScope->TheDecl->setParams(params);
17980 if (!oldBlock->blockMissingReturnType()) {
17981 blockScope->HasImplicitReturnType =
false;
17982 blockScope->ReturnType = exprResultType;
17986 StmtResult body = getDerived().TransformStmt(E->getBody());
17987 if (body.isInvalid()) {
17988 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17996 for (
const auto &I : oldBlock->captures()) {
17997 VarDecl *oldCapture = I.getVariable();
18000 if (oldCapture->isParameterPack())
18004 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
18006 assert(blockScope->CaptureMap.count(newCapture));
18015template<
typename Derived>
18018 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
18019 if (SrcExpr.isInvalid())
18022 QualType Type = getDerived().TransformType(E->getType());
18025 E->getRParenLoc());
18028template<
typename Derived>
18031 bool ArgumentChanged =
false;
18033 SubExprs.reserve(E->getNumSubExprs());
18034 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
18035 SubExprs, &ArgumentChanged))
18038 if (!getDerived().AlwaysRebuild() &&
18042 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
18043 E->getOp(), E->getRParenLoc());
18050template<
typename Derived>
18053 return SemaRef.BuildPointerType(PointeeType,
Star,
18057template<
typename Derived>
18060 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
18064template<
typename Derived>
18067 bool WrittenAsLValue,
18069 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
18073template <
typename Derived>
18077 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
18081template<
typename Derived>
18088 return SemaRef.ObjC().BuildObjCTypeParamType(
18089 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18093template<
typename Derived>
18104 return SemaRef.ObjC().BuildObjCObjectType(
18105 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
18106 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
18111template<
typename Derived>
18115 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
18118template <
typename Derived>
18121 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18122 if (SizeExpr || !Size)
18123 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
18124 IndexTypeQuals, BracketsRange,
18128 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
18130 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
18133 for (
const auto &
T : Types)
18134 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
18144 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
18145 IndexTypeQuals, BracketsRange,
18149template <
typename Derived>
18152 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18153 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
18154 IndexTypeQuals, BracketsRange);
18157template <
typename Derived>
18161 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
18162 IndexTypeQuals, BracketsRange);
18165template <
typename Derived>
18168 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18169 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18171 IndexTypeQuals, BracketsRange);
18174template <
typename Derived>
18177 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
18178 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
18180 IndexTypeQuals, BracketsRange);
18183template <
typename Derived>
18186 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
18190template <
typename Derived>
18192 unsigned NumElements,
18195 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
18198template <
typename Derived>
18202 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
18205template<
typename Derived>
18207 unsigned NumElements,
18209 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18210 NumElements,
true);
18214 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
18217template<
typename Derived>
18222 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
18225template <
typename Derived>
18227 QualType ElementType,
unsigned NumRows,
unsigned NumColumns,
18233 Ctx, llvm::APInt(SizeWidth, NumRows), SizeTy, AttributeLoc);
18235 Ctx, llvm::APInt(SizeWidth, NumColumns), SizeTy, AttributeLoc);
18236 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18240template <
typename Derived>
18244 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
18248template <
typename Derived>
18252 return SemaRef.BuildFunctionType(
T, ParamTypes,
18258template<
typename Derived>
18260 return SemaRef.Context.getFunctionNoProtoType(
T);
18263template <
typename Derived>
18267 assert(D &&
"no decl found");
18271 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
18275 if (UPD->expansions().empty()) {
18276 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
18277 << UPD->isCXXClassMember() << UPD;
18286 for (
auto *E : UPD->expansions()) {
18293 else if (
T.isNull())
18296 assert(
getSema().Context.hasSameType(ThisT,
T) &&
18297 "mismatched resolved types in using pack expansion");
18299 return T.isNull() ? FallbackT :
T;
18301 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
18302 assert(Using->hasTypename() &&
18303 "UnresolvedUsingTypenameDecl transformed to non-typename using");
18306 assert(++Using->shadow_begin() == Using->shadow_end());
18311 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
18314 "UnresolvedUsingTypenameDecl transformed to non-using decl");
18315 return SemaRef.Context.getUnresolvedUsingType(
18319template <
typename Derived>
18322 return SemaRef.BuildTypeofExprType(E, Kind);
18325template<
typename Derived>
18328 return SemaRef.Context.getTypeOfType(Underlying, Kind);
18331template <
typename Derived>
18333 return SemaRef.BuildDecltypeType(E);
18336template <
typename Derived>
18340 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc,
18341 FullySubstituted, Expansions);
18344template<
typename Derived>
18346 UnaryTransformType::UTTKind UKind,
18348 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
18351template <
typename Derived>
18355 return SemaRef.CheckTemplateIdType(
18360template<
typename Derived>
18363 return SemaRef.BuildAtomicType(ValueType, KWLoc);
18366template<
typename Derived>
18370 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
18371 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
18374template <
typename Derived>
18378 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
18382 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
18385template <
typename Derived>
18388 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
18391template <
typename Derived>
18399template <
typename Derived>
18406 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
18409 AllowInjectedClassName);
18413template<
typename Derived>
18420 bool AllowInjectedClassName) {
18423 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
18428 false,
Template, AllowInjectedClassName);
18432template <
typename Derived>
18437 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
18442 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
18443 Opc,
First, Second);
18458 if (Op == OO_Subscript) {
18459 if (!
First->getType()->isOverloadableType() &&
18461 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
18463 }
else if (Op == OO_Arrow) {
18466 if (
First->getType()->isDependentType())
18469 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
18470 }
else if (Second ==
nullptr || isPostIncDec) {
18471 if (!
First->getType()->isOverloadableType() ||
18472 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
18479 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
18483 !
First->getType()->isOverloadableType() &&
18489 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
18498 if (!Second || isPostIncDec) {
18501 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
18508 First, Second, RequiresADL);
18515template<
typename Derived>
18525 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
18526 if (
Base->isTypeDependent() || Destroyed.getIdentifier() ||
18531 ->getAsCanonical<RecordType>())) {
18533 return SemaRef.BuildPseudoDestructorExpr(
18534 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
18535 CCLoc, TildeLoc, Destroyed);
18547 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
18548 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
18549 diag::err_expected_class_or_namespace)
18550 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
18554 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
18558 return getSema().BuildMemberReferenceExpr(
18559 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
18565template<
typename Derived>
18573 for (
unsigned I = 0; I < NumParams; ++I) {
18574 if (I != ContextParamPos) {
18580 Params.push_back(std::make_pair(StringRef(), QualType()));
18583 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
18591 if (Body.isInvalid()) {
18592 getSema().ActOnCapturedRegionError();
18596 return getSema().ActOnCapturedRegionEnd(Body.get());
18599template <
typename Derived>
18605 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
18609template <
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 '...
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.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
bool isExpansionStmt() const
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
The name of a declaration.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
DeferStmt - This represents a deferred statement.
static DeferStmt * Create(ASTContext &Context, SourceLocation DeferLoc, Stmt *Body)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
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.
llvm::omp::Version getOpenMPVersion() const
Return the OpenMP version.
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.
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...
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.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
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.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
const NamespaceBaseDecl * Namespace
Iterator range representation begin:end[:step].
This structure contains most locations needed for by an OMPVarListClause.
An element in an Objective-C dictionary literal.
Data for list of allocators.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
bool InLifetimeExtendingContext
Whether we are currently in a context in which all temporaries must be lifetime-extended,...
SmallVector< MaterializeTemporaryExpr *, 8 > ForRangeLifetimeExtendTemps
P2718R0 - Lifetime extension in range-based for loops.
bool RebuildDefaultArgOrDefaultInit
Whether we should rebuild CXXDefaultArgExpr and CXXDefaultInitExpr.
ExpressionEvaluationContext Context
The expression evaluation context.
An RAII helper that pops function a function scope on exit.
Keeps information about an identifier in a nested-name-spec.
Location information for a TemplateArgument.
UnsignedOrNone OrigNumExpansions
bool ExpandUnderForgetSubstitions
UnsignedOrNone NumExpansions