13#ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14#define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
49#include "llvm/ADT/ArrayRef.h"
50#include "llvm/Support/ErrorHandling.h"
54using namespace llvm::omp;
121template<
typename Derived>
126 class ForgetPartiallySubstitutedPackRAII {
134 ForgetPartiallySubstitutedPackRAII(Derived &
Self)
135 :
Self(
Self), ResetPackSubstIndex(
Self.getSema(), std::nullopt) {
136 Old =
Self.ForgetPartiallySubstitutedPack();
139 ~ForgetPartiallySubstitutedPackRAII() {
140 Self.RememberPartiallySubstitutedPack(Old);
157 Derived &
getDerived() {
return static_cast<Derived&
>(*this); }
161 return static_cast<const Derived&
>(*this);
229 if (Location.isValid())
230 Self.getDerived().setBase(Location, Entity);
234 Self.getDerived().setBase(OldLocation, OldEntity);
307 bool FailOnPackProducingTemplates,
308 bool &ShouldExpand,
bool &RetainExpansion,
310 ShouldExpand =
false;
338 struct ForgetSubstitutionRAII {
344 Old =
Self.ForgetSubstitution();
347 ~ForgetSubstitutionRAII() {
Self.RememberSubstitution(std::move(Old)); }
447 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
448#include "clang/Basic/AttrList.inc"
458 const X##Attr *TransformStmt##X##Attr(const Stmt *, const Stmt *, \
459 const X##Attr *A) { \
460 return getDerived().Transform##X##Attr(A); \
462#include "clang/Basic/AttrList.inc"
508 bool *ArgChanged =
nullptr);
517 llvm::DenseMap<Decl *, Decl *>::iterator Known
520 return Known->second;
548 assert(
New.size() == 1 &&
549 "must override transformedLocalDecl if performing pack expansion");
587 NamedDecl *FirstQualifierInScope =
nullptr);
632 NamedDecl *FirstQualifierInScope =
nullptr,
633 bool AllowInjectedClassName =
false);
645 bool Uneval =
false);
672 bool Uneval =
false) {
691 template<
typename InputIterator>
695 bool Uneval =
false);
716 return SemaRef.Context.getTrivialTypeSourceInfo(
T,
720#define ABSTRACT_TYPELOC(CLASS, PARENT)
721#define TYPELOC(CLASS, PARENT) \
722 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
723#include "clang/AST/TypeLocNodes.def"
727 bool SuppressObjCLifetime);
731 bool SuppressObjCLifetime);
733 template<
typename Fn>
751 bool AllowInjectedClassName);
779 return getDerived().TransformFunctionTypeParams(
780 Loc, Params, ParamTypes, ParamInfos, PTypes, PVars, PInfos,
nullptr);
798 KWLoc, Params,
nullptr,
799 nullptr, PTypes, &TransParams, PInfos))
813 bool ExpectParameterPack);
840 bool IsAddressOfOperand,
848 bool IsAddressOfOperand);
856#define STMT(Node, Parent) \
857 LLVM_ATTRIBUTE_NOINLINE \
858 StmtResult Transform##Node(Node *S);
859#define VALUESTMT(Node, Parent) \
860 LLVM_ATTRIBUTE_NOINLINE \
861 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
862#define EXPR(Node, Parent) \
863 LLVM_ATTRIBUTE_NOINLINE \
864 ExprResult Transform##Node(Node *E);
865#define ABSTRACT_STMT(Stmt)
866#include "clang/AST/StmtNodes.inc"
868#define GEN_CLANG_CLAUSE_CLASS
869#define CLAUSE_CLASS(Enum, Str, Class) \
870 LLVM_ATTRIBUTE_NOINLINE \
871 OMPClause *Transform##Class(Class *S);
872#include "llvm/Frontend/OpenMP/OMP.inc"
950 const llvm::APInt *Size,
Expr *SizeExpr,
951 unsigned IndexTypeQuals,
SourceRange BracketsRange);
960 const llvm::APInt &Size,
Expr *SizeExpr,
961 unsigned IndexTypeQuals,
971 unsigned IndexTypeQuals,
981 unsigned IndexTypeQuals,
992 unsigned IndexTypeQuals,
1030 unsigned NumColumns);
1047 Expr *AddrSpaceExpr,
1071 return SemaRef.Context.getUsingType(
Keyword, Qualifier, D, UnderlyingType);
1084 return SemaRef.Context.getMacroQualifiedType(
T, MacroII);
1094 return SemaRef.Context.getCanonicalTagType(Tag);
1111 UnaryTransformType::UTTKind UKind,
1123 bool FullySubstituted,
1137 TypeConstraintConcept,
1138 TypeConstraintArgs);
1145 return SemaRef.Context.getDeducedTemplateSpecializationType(
1164 return SemaRef.BuildParenType(InnerType);
1177 bool DeducedTSTContext) {
1179 SS.
Adopt(QualifierLoc);
1183 if (!
SemaRef.computeDeclContext(SS))
1191 return SemaRef.CheckTypenameType(
Keyword, KeywordLoc, QualifierLoc,
1192 *Id, IdLoc, DeducedTSTContext);
1205 if (
SemaRef.RequireCompleteDeclContext(SS, DC))
1210 switch (
Result.getResultKind()) {
1221 llvm_unreachable(
"Tag lookup cannot find non-tags");
1233 switch (
Result.getResultKind()) {
1239 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag)
1240 << SomeDecl << NTK << Kind;
1245 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1251 if (!
SemaRef.isAcceptableTagRedeclaration(Tag, Kind,
false,
1253 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1254 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1310 bool AllowInjectedClassName);
1323 bool AllowInjectedClassName);
1329 bool AllowInjectedClassName);
1339 Decl *AssociatedDecl,
unsigned Index,
1342 ArgPack, AssociatedDecl, Index, Final);
1396 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1406 if (
SemaRef.CheckRebuiltStmtAttributes(Attrs))
1408 return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
1420 Then, ElseLoc, Else);
1474 Inc, RParenLoc, Body);
1519 bool IsVolatile,
unsigned NumOutputs,
1526 NumInputs, Names, Constraints, Exprs,
1527 AsmString, Clobbers, NumLabels, RParenLoc);
1536 StringRef AsmString,
1537 unsigned NumOutputs,
unsigned NumInputs,
1543 NumOutputs, NumInputs,
1544 Constraints, Clobbers, Exprs, EndLoc);
1573 CoawaitLoc, Operand, OpCoawaitLookup);
1577 Suspend.
get(),
true);
1678 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1690 Kind, DirName, Clauses, AStmt, StartLoc, EndLoc);
1704 NameModifier,
Condition, StartLoc, LParenLoc, NameModifierLoc, ColonLoc,
1730 Modifier, NumThreads, StartLoc, LParenLoc, ModifierLoc, EndLoc);
1819 Kind, KindKwLoc, VCKind, VCLoc, StartLoc, LParenLoc, EndLoc);
1832 Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
1845 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1896 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1924 VarList, {Modifier, OriginalSharingModifier}, StartLoc, LParenLoc,
1925 ModifierLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId,
1926 UnresolvedReductions);
1940 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1941 ReductionId, UnresolvedReductions);
1956 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1957 ReductionId, UnresolvedReductions);
1970 VarList, Step, StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc,
1971 StepModifierLoc, EndLoc);
1984 VarList, Alignment, StartLoc, LParenLoc, ColonLoc, EndLoc);
2044 Data, DepModifier, VarList, StartLoc, LParenLoc, EndLoc);
2057 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2072 IteratorModifier, MapTypeModifiers, MapTypeModifiersLoc,
2073 MapperIdScopeSpec, MapperId, MapType, IsMapTypeImplicit, MapLoc,
2074 ColonLoc, VarList, Locs,
2075 false, UnresolvedMappers);
2092 Allocate, Alignment, FirstModifier, FirstModifierLoc, SecondModifier,
2093 SecondModifierLoc, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc);
2141 Modifier,
Device, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2154 Modifier, NumTasks, StartLoc, LParenLoc, ModifierLoc, EndLoc);
2189 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
2204 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2205 ColonLoc, VarList, Locs, UnresolvedMappers);
2220 MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
2221 ColonLoc, VarList, Locs, UnresolvedMappers);
2272 M, Kind, StartLoc, LParenLoc, MLoc, KindLoc, EndLoc);
2319 StartLoc, LParenLoc, EndLoc,
Data);
2332 StartLoc, LParenLoc, ColonLoc, EndLoc, Modifier, Locators);
2344 Modifier, Kind, StartLoc, LParenLoc, ModifierKwLoc, KindKwLoc, EndLoc);
2357 InteropVar, InteropInfo, StartLoc, LParenLoc, VarLoc, EndLoc);
2368 LParenLoc, VarLoc, EndLoc);
2380 InteropVar, StartLoc, LParenLoc, VarLoc, EndLoc);
2519 DepType, DepLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
2567 ForLoc, Element, Collection, RParenLoc);
2585 StartLoc, IdLoc, Id);
2622 if (
DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2623 if (RangeStmt->isSingleDecl()) {
2624 if (
VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2625 if (RangeVar->isInvalidDecl())
2628 Expr *RangeExpr = RangeVar->getInit();
2635 diag::err_objc_for_range_init_stmt)
2636 <<
Init->getSourceRange();
2639 ForLoc, LoopVar, RangeExpr, RParenLoc);
2646 ForLoc, CoawaitLoc,
Init, ColonLoc, Range, Begin, End,
Cond, Inc,
2660 QualifierLoc, NameInfo, Nested);
2722 SS.
Adopt(QualifierLoc);
2834 if (IsOMPArraySection)
2836 Base, LBracketLoc, LowerBound, ColonLocFirst, ColonLocSecond, Length,
2837 Stride, RBracketLoc);
2839 assert(Stride ==
nullptr && !ColonLocSecond.
isValid() &&
2840 "Stride/second colon not allowed for OpenACC");
2843 Base, LBracketLoc, LowerBound, ColonLocFirst, Length, RBracketLoc);
2855 Base, LParenLoc, RParenLoc, Dims, BracketsRanges);
2867 nullptr, IteratorKwLoc, LLoc, RLoc,
Data);
2877 Expr *ExecConfig =
nullptr) {
2879 nullptr, Callee, LParenLoc, Args, RParenLoc, ExecConfig);
2886 nullptr, Callee, LParenLoc, Args, RParenLoc);
2904 if (!
Member->getDeclName()) {
2908 assert(
Member->getType()->isRecordType() &&
2909 "unnamed member not of record type?");
2922 if (!isArrow &&
Base->isPRValue()) {
2937 SS.
Adopt(QualifierLoc);
2940 if (
Base->containsErrors())
2945 if (isArrow && !BaseType->isPointerType())
2954 if (
getSema().isUnevaluatedContext() &&
Base->isImplicitCXXThis() &&
2959 ->getAsCXXRecordDecl()) {
2963 if (!ThisClass->Equals(
Class) && !ThisClass->isDerivedFrom(
Class))
2971 FirstQualifierInScope,
2972 R, ExplicitTemplateArgs,
2982 bool ForFoldExpression =
false) {
3060 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
3073 =
SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
3113 unsigned NumUserSpecifiedExprs,
3118 InitLoc, LParenLoc, RParenLoc);
3148 return SemaRef.ActOnChooseExpr(BuiltinLoc,
3160 Expr *ControllingExpr,
3165 ControllingExpr, Types, Exprs);
3180 ControllingType, Types, Exprs);
3213 case Stmt::CXXStaticCastExprClass:
3214 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
3215 RAngleLoc, LParenLoc,
3216 SubExpr, RParenLoc);
3218 case Stmt::CXXDynamicCastExprClass:
3219 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
3220 RAngleLoc, LParenLoc,
3221 SubExpr, RParenLoc);
3223 case Stmt::CXXReinterpretCastExprClass:
3224 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
3225 RAngleLoc, LParenLoc,
3229 case Stmt::CXXConstCastExprClass:
3230 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
3231 RAngleLoc, LParenLoc,
3232 SubExpr, RParenLoc);
3234 case Stmt::CXXAddrspaceCastExprClass:
3235 return getDerived().RebuildCXXAddrspaceCastExpr(
3236 OpLoc, LAngleLoc, TInfo, RAngleLoc, LParenLoc, SubExpr, RParenLoc);
3239 llvm_unreachable(
"Invalid C++ named cast");
3317 OpLoc, tok::kw_addrspace_cast, TInfo, SubExpr,
3329 bool ListInitialization) {
3333 if (
auto *PLE = dyn_cast<ParenListExpr>(Sub))
3335 TInfo, LParenLoc,
MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3336 RParenLoc, ListInitialization);
3338 if (
auto *PLE = dyn_cast<CXXParenListInitExpr>(Sub))
3340 TInfo, LParenLoc, PLE->getInitExprs(), RParenLoc, ListInitialization);
3344 ListInitialization);
3408 if (
getSema().CheckCXXThisType(ThisLoc, ThisType))
3418 bool IsThrownVariableInScope) {
3428 Expr *RewrittenExpr) {
3430 RewrittenExpr,
getSema().CurContext);
3464 std::optional<Expr *> ArraySize,
3483 bool IsGlobalDelete,
3534 bool IsAddressOfOperand,
3537 SS.
Adopt(QualifierLoc);
3539 if (TemplateArgs || TemplateKWLoc.
isValid())
3541 SS, TemplateKWLoc, NameInfo, TemplateArgs, IsAddressOfOperand);
3544 SS, NameInfo, IsAddressOfOperand, RecoveryTSI);
3566 bool IsElidable,
MultiExprArg Args,
bool HadMultipleCandidates,
3567 bool ListInitialization,
bool StdInitListInitialization,
3574 FoundCtor =
Constructor->getInheritedConstructor().getConstructor();
3577 if (
getSema().CompleteConstructorCall(FoundCtor,
T, Args, Loc,
3584 HadMultipleCandidates,
3586 StdInitListInitialization,
3587 RequiresZeroInit, ConstructKind,
3595 bool ConstructsVBase,
3596 bool InheritedFromVBase) {
3598 Loc,
T,
Constructor, ConstructsVBase, InheritedFromVBase);
3609 bool ListInitialization) {
3611 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
3622 bool ListInitialization) {
3624 RParenLoc, ListInitialization);
3641 SS.
Adopt(QualifierLoc);
3643 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3644 OperatorLoc, IsArrow,
3646 FirstQualifierInScope,
3648 TemplateArgs,
nullptr);
3664 SS.
Adopt(QualifierLoc);
3666 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3667 OperatorLoc, IsArrow,
3669 FirstQualifierInScope,
3670 R, TemplateArgs,
nullptr);
3678 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3691 RParenLoc, Length, PartialArgs);
3696 Expr *PackIdExpression,
Expr *IndexExpr,
3698 bool FullySubstituted =
false) {
3700 IndexExpr, RSquareLoc, ExpandedExprs,
3730 NamedConcept, TALI);
3748 LocalParameters, RParenLoc, Requirements,
3755 return SemaRef.BuildTypeRequirement(SubstDiag);
3759 return SemaRef.BuildTypeRequirement(
T);
3767 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3774 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3781 return SemaRef.BuildNestedRequirement(InvalidConstraintEntity,
3786 return SemaRef.BuildNestedRequirement(Constraint);
3802 Expr **Elements,
unsigned NumElements) {
3812 RB,
Base, Key, getterMethod, setterMethod);
3831 return SemaRef.ObjC().BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
3843 return SemaRef.ObjC().BuildClassMessage(
3844 ReceiverTypeInfo, ReceiverTypeInfo->
getType(),
3857 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->
getType(),
3860 SelectorLocs, RBracLoc, Args);
3872 return Method->isInstanceMethod()
3873 ?
SemaRef.ObjC().BuildInstanceMessage(
3874 nullptr, SuperType, SuperLoc, Sel,
Method, LBracLoc,
3875 SelectorLocs, RBracLoc, Args)
3876 :
SemaRef.ObjC().BuildClassMessage(
nullptr, SuperType, SuperLoc,
3878 SelectorLocs, RBracLoc, Args);
3887 bool IsArrow,
bool IsFreeIvar) {
3896 if (IsFreeIvar &&
Result.isUsable())
3933 PropertyLoc,
Base));
3962 =
SemaRef.Context.Idents.get(
"__builtin_shufflevector");
3965 assert(!Lookup.
empty() &&
"No __builtin_shufflevector?");
3973 Callee =
SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
3974 CK_BuiltinFnToFnPtr).get();
3990 return SemaRef.ConvertVectorExpr(SrcExpr, DstTInfo, BuiltinLoc, RParenLoc);
4005 EllipsisLoc, NumExpansions);
4029 llvm_unreachable(
"Pack expansion pattern has no parameter packs");
4065 EllipsisLoc, RHS, RParenLoc,
4074 Init->containsUnexpandedParameterPack();
4075 else if (PVD->hasUninstantiatedDefaultArg())
4077 PVD->getUninstantiatedDefaultArg()
4078 ->containsUnexpandedParameterPack();
4232 Exprs.push_back(DevNumExpr);
4233 llvm::append_range(Exprs, QueueIdExprs);
4277 ObjectType, FirstQualifierInScope);
4283 QualType TransformDependentNameType(TypeLocBuilder &TLB,
4284 DependentNameTypeLoc TL,
4285 bool DeducibleTSTContext,
4286 QualType ObjectType = QualType(),
4287 NamedDecl *UnqualLookup =
nullptr);
4290 TransformOpenACCClauseList(OpenACCDirectiveKind DirKind,
4295 OpenACCDirectiveKind DirKind,
4296 const OpenACCClause *OldClause);
4299template <
typename Derived>
4309#define STMT(Node, Parent) \
4310 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
4311#define VALUESTMT(Node, Parent) \
4312 case Stmt::Node##Class: \
4313 return getDerived().Transform##Node(cast<Node>(S), SDK);
4314#define ABSTRACT_STMT(Node)
4315#define EXPR(Node, Parent)
4316#include "clang/AST/StmtNodes.inc"
4319#define STMT(Node, Parent)
4320#define ABSTRACT_STMT(Stmt)
4321#define EXPR(Node, Parent) case Stmt::Node##Class:
4322#include "clang/AST/StmtNodes.inc"
4327 E =
getSema().ActOnStmtExprResult(E);
4335template<
typename Derived>
4343#define GEN_CLANG_CLAUSE_CLASS
4344#define CLAUSE_CLASS(Enum, Str, Class) \
4346 return getDerived().Transform##Class(cast<Class>(S));
4347#include "llvm/Frontend/OpenMP/OMP.inc"
4354template<
typename Derived>
4361#define STMT(Node, Parent) case Stmt::Node##Class: break;
4362#define ABSTRACT_STMT(Stmt)
4363#define EXPR(Node, Parent) \
4364 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
4365#include "clang/AST/StmtNodes.inc"
4371template<
typename Derived>
4379 if (
auto *FE = dyn_cast<FullExpr>(
Init))
4380 Init = FE->getSubExpr();
4382 if (
auto *AIL = dyn_cast<ArrayInitLoopExpr>(
Init)) {
4388 Init = MTE->getSubExpr();
4391 Init = Binder->getSubExpr();
4394 Init = ICE->getSubExprAsWritten();
4397 dyn_cast<CXXStdInitializerListExpr>(
Init))
4434 getSema().currentEvaluationContext().InLifetimeExtendingContext =
4435 getSema().parentEvaluationContext().InLifetimeExtendingContext;
4436 getSema().currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
4437 getSema().parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
4439 bool ArgChanged =
false;
4441 true, NewArgs, &ArgChanged))
4451 if (
Parens.isInvalid()) {
4454 assert(NewArgs.empty() &&
4455 "no parens or braces but have direct init with arguments?");
4462template<
typename Derived>
4468 for (
unsigned I = 0; I != NumInputs; ++I) {
4478 Expr *Pattern = Expansion->getPattern();
4481 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4482 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
4487 bool RetainExpansion =
false;
4488 UnsignedOrNone OrigNumExpansions = Expansion->getNumExpansions();
4492 Unexpanded,
true, Expand,
4493 RetainExpansion, NumExpansions))
4506 Expansion->getEllipsisLoc(),
4508 if (Out.isInvalid())
4513 Outputs.push_back(Out.get());
4519 if (ArgChanged) *ArgChanged =
true;
4523 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4526 if (Out.isInvalid())
4529 if (Out.get()->containsUnexpandedParameterPack()) {
4531 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4532 if (Out.isInvalid())
4536 Outputs.push_back(Out.get());
4541 if (RetainExpansion) {
4542 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
4545 if (Out.isInvalid())
4549 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4550 if (Out.isInvalid())
4553 Outputs.push_back(Out.get());
4560 IsCall ?
getDerived().TransformInitializer(Inputs[I],
false)
4565 if (
Result.get() != Inputs[I] && ArgChanged)
4568 Outputs.push_back(
Result.get());
4574template <
typename Derived>
4585 VarDecl *ConditionVar = cast_or_null<VarDecl>(
4591 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
4600 return getSema().ActOnCondition(
nullptr, Loc, CondExpr.
get(), Kind,
4607template <
typename Derived>
4615 Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix)
4627 llvm_unreachable(
"unexpected null nested name specifier");
4658 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4659 QualifierLoc, ObjectType, FirstQualifierInScope);
4663 FirstQualifierInScope =
nullptr;
4665 SS.
Adopt(QualifierLoc);
4669 if (
SemaRef.BuildCXXNestedNameSpecifier(
nullptr, IdInfo,
4671 FirstQualifierInScope,
false))
4679 T = TransformTypeInObjectScope(TLB, TL, ObjectType,
4680 FirstQualifierInScope);
4686 if (
T->isDependentType() ||
T->isRecordType() ||
4687 (
SemaRef.getLangOpts().CPlusPlus11 &&
T->isEnumeralType())) {
4688 if (
T->isEnumeralType())
4690 diag::warn_cxx98_compat_enum_nested_name_spec);
4697 if (!TTL || !TTL.
getDecl()->isInvalidDecl()) {
4721template<
typename Derived>
4741 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
4748 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
4758 NewTInfo =
getDerived().TransformType(OldTInfo);
4761 NewCanTy =
SemaRef.Context.getCanonicalType(NewTInfo->
getType());
4769 NewCanTy =
SemaRef.Context.getCanonicalType(NewT);
4782 llvm_unreachable(
"Unknown name kind.");
4785template <
typename Derived>
4789 QualType ObjectType,
bool AllowInjectedClassName) {
4791 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, *II, NameLoc,
4792 ObjectType, AllowInjectedClassName);
4794 NameLoc, ObjectType,
4795 AllowInjectedClassName);
4798template <
typename Derived>
4802 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
4804 TemplateName UnderlyingName = QTN->getUnderlyingTemplate();
4807 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4808 QualifierLoc, ObjectType, FirstQualifierInScope);
4815 UnderlyingQualifier, TemplateKWLoc, UnderlyingName, NameLoc, ObjectType,
4816 FirstQualifierInScope, AllowInjectedClassName);
4817 if (NewUnderlyingName.
isNull())
4819 assert(!UnderlyingQualifier &&
"unexpected qualifier");
4823 NewUnderlyingName == UnderlyingName)
4826 SS.
Adopt(QualifierLoc);
4827 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4833 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(
4834 QualifierLoc, ObjectType, FirstQualifierInScope);
4848 SS.
Adopt(QualifierLoc);
4849 return getDerived().RebuildTemplateName(SS, TemplateKWLoc, DTN->getName(),
4850 NameLoc, ObjectType,
4851 AllowInjectedClassName);
4856 assert(!QualifierLoc &&
"Unexpected qualified SubstTemplateTemplateParm");
4863 ReplacementQualifierLoc = Builder.getWithLocInContext(
SemaRef.Context);
4867 ReplacementQualifierLoc, TemplateKWLoc, ReplacementName, NameLoc,
4868 ObjectType, FirstQualifierInScope, AllowInjectedClassName);
4871 Decl *AssociatedDecl =
4872 getDerived().TransformDecl(NameLoc, S->getAssociatedDecl());
4874 AssociatedDecl == S->getAssociatedDecl())
4876 return SemaRef.Context.getSubstTemplateTemplateParm(
4877 NewName, AssociatedDecl, S->getIndex(), S->getPackIndex(),
4882 "DeducedTemplateName should not escape partial ordering");
4886 assert(!QualifierLoc &&
"Unexpected qualifier");
4893 assert(!QualifierLoc &&
4894 "Unexpected qualified SubstTemplateTemplateParmPack");
4896 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4897 SubstPack->getIndex(), SubstPack->getFinal());
4901 llvm_unreachable(
"overloaded function decl survived to here");
4904template <
typename Derived>
4909 QualifierLoc, TemplateKeywordLoc, Name, NameLoc);
4915template<
typename Derived>
4919 Output =
getSema().getTrivialTemplateArgumentLoc(
4923template <
typename Derived>
4931 llvm_unreachable(
"Unexpected TemplateArgument");
4954 if (NewT ==
T && D == NewD)
4971 llvm_unreachable(
"unexpected template argument kind");
5003 llvm_unreachable(
"Caller should expand pack expansions");
5019 E =
SemaRef.ActOnConstantExpression(E);
5034template<
typename Derived,
typename InputIterator>
5042 typedef typename std::iterator_traits<InputIterator>::difference_type
5057 : Self(Self), Iter(Iter) { }
5072 Self.InventTemplateArgumentLoc(*Iter,
Result);
5080 return X.Iter == Y.Iter;
5085 return X.Iter != Y.Iter;
5089template<
typename Derived>
5090template<
typename InputIterator>
5106 PackLocIterator(*
this, In.getArgument().pack_begin()),
5107 PackLocIterator(*
this, In.getArgument().pack_end()), Outputs,
5114 if (In.getArgument().isPackExpansion()) {
5126 std::optional<ForgetSubstitutionRAII> ForgetSubst;
5136 if (Out.getArgument().containsUnexpandedParameterPack()) {
5139 if (Out.getArgument().isNull())
5149 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
5157 if (Out.getArgument().isNull())
5178template <
typename Derived>
5189 Pattern =
getSema().getTemplateArgumentPackExpansionPattern(
5192 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5193 if (IsLateExpansionAttempt) {
5198 return P.first.dyn_cast<
const SubstBuiltinTemplatePackType *>();
5200 if (!SawPackTypes) {
5205 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
5213 Info.
Ellipsis, Pattern.getSourceRange(), Unexpanded,
5219 if (ComputeInfo(In,
false, Info, Pattern))
5231 std::optional<Sema::ArgPackSubstIndexRAII> SubstIndex(
5232 std::in_place,
getSema(), std::nullopt);
5238 if (Out.getArgument().isNull())
5275 ForgetSubstitutionRAII ForgetSubst(
getDerived());
5276 if (ComputeInfo(Out,
true, Info, OutPattern))
5289template<
typename Derived>
5307template<
typename Derived>
5327template<
typename Derived>
5330 switch (
T.getTypeLocClass()) {
5331#define ABSTRACT_TYPELOC(CLASS, PARENT)
5332#define TYPELOC(CLASS, PARENT) \
5333 case TypeLoc::CLASS: \
5334 return getDerived().Transform##CLASS##Type(TLB, \
5335 T.castAs<CLASS##TypeLoc>());
5336#include "clang/AST/TypeLocNodes.def"
5339 llvm_unreachable(
"unhandled type loc!");
5342template<
typename Derived>
5355template<
typename Derived>
5393template<
typename Derived>
5398 TypeLoc UnqualTL =
T.getUnqualifiedLoc();
5399 auto SuppressObjCLifetime =
5400 T.getType().getLocalQualifiers().hasObjCLifetime();
5402 Result = getDerived().TransformTemplateTypeParmType(TLB, TTP,
5403 SuppressObjCLifetime);
5404 }
else if (
auto STTP = UnqualTL.
getAs<SubstTemplateTypeParmPackTypeLoc>()) {
5405 Result = getDerived().TransformSubstTemplateTypeParmPackType(
5406 TLB, STTP, SuppressObjCLifetime);
5408 Result = getDerived().TransformType(TLB, UnqualTL);
5427template <
typename Derived>
5437 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
5444 if (
T.getPointerAuth().isPresent()) {
5445 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_redundant) << TL.
getType();
5448 if (!
T->isDependentType()) {
5449 if (!
T->isSignableType(
SemaRef.getASTContext())) {
5450 SemaRef.Diag(Loc, diag::err_ptrauth_qualifier_invalid_target) <<
T;
5458 if (
T->isFunctionType()) {
5459 T =
SemaRef.getASTContext().getAddrSpaceQualType(
T,
5469 if (
T->isReferenceType()) {
5479 if (!
T->isObjCLifetimeType() && !
T->isDependentType())
5481 else if (
T.getObjCLifetime()) {
5485 const AutoType *AutoTy;
5486 if ((AutoTy = dyn_cast<AutoType>(
T)) && AutoTy->isDeduced()) {
5488 QualType Deduced = AutoTy->getDeducedType();
5493 T =
SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5496 AutoTy->getTypeConstraintConcept(),
5497 AutoTy->getTypeConstraintArguments());
5502 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) <<
T;
5508 return SemaRef.BuildQualifiedType(
T, Loc, Quals);
5511template <
typename Derived>
5512QualType TreeTransform<Derived>::TransformTypeInObjectScope(
5515 assert(!getDerived().AlreadyTransformed(TL.
getType()));
5518 case TypeLoc::TemplateSpecialization:
5519 return getDerived().TransformTemplateSpecializationType(
5521 FirstQualifierInScope,
true);
5522 case TypeLoc::DependentName:
5523 return getDerived().TransformDependentNameType(
5525 ObjectType, FirstQualifierInScope);
5529 return getDerived().TransformType(TLB, TL);
5533template <
class TyLoc>
static inline
5535 TyLoc NewT = TLB.
push<TyLoc>(
T.getType());
5536 NewT.setNameLoc(
T.getNameLoc());
5540template<
typename Derived>
5541QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
5543 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
5544 NewT.setBuiltinLoc(T.getBuiltinLoc());
5545 if (T.needsExtraLocalData())
5546 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
5550template<
typename Derived>
5557template <
typename Derived>
5561 return getDerived().
TransformType(TLB, TL.getOriginalLoc());
5564template<
typename Derived>
5567 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
5568 if (OriginalType.isNull())
5572 if (getDerived().AlwaysRebuild() ||
5573 OriginalType != TL.getOriginalLoc().getType())
5580template <
typename Derived>
5584 QualType OriginalType = getDerived().TransformType(TLB, TL.getElementLoc());
5585 if (OriginalType.isNull())
5589 if (getDerived().AlwaysRebuild() ||
5590 OriginalType != TL.getElementLoc().getType())
5597template<
typename Derived>
5601 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5602 if (PointeeType.isNull())
5606 if (PointeeType->getAs<ObjCObjectType>()) {
5618 if (getDerived().AlwaysRebuild() ||
5619 PointeeType != TL.getPointeeLoc().getType()) {
5620 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
5627 TLB.TypeWasModifiedSafely(
Result->getPointeeType());
5634template<
typename Derived>
5639 = getDerived().TransformType(TLB, TL.getPointeeLoc());
5640 if (PointeeType.isNull())
5644 if (getDerived().AlwaysRebuild() ||
5645 PointeeType != TL.getPointeeLoc().getType()) {
5646 Result = getDerived().RebuildBlockPointerType(PointeeType,
5661template<
typename Derived>
5669 if (PointeeType.
isNull())
5674 PointeeType !=
T->getPointeeTypeAsWritten()) {
5676 T->isSpelledAsLValue(),
5698template<
typename Derived>
5702 return TransformReferenceType(TLB, TL);
5705template<
typename Derived>
5707TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
5708 RValueReferenceTypeLoc TL) {
5709 return TransformReferenceType(TLB, TL);
5712template<
typename Derived>
5716 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
5717 if (PointeeType.isNull())
5724 getDerived().TransformNestedNameSpecifierLoc(OldQualifierLoc);
5725 if (!NewQualifierLoc)
5728 CXXRecordDecl *OldCls =
T->getMostRecentCXXRecordDecl(), *NewCls =
nullptr;
5730 NewCls = cast_or_null<CXXRecordDecl>(
5731 getDerived().TransformDecl(TL.getStarLoc(), OldCls));
5737 if (getDerived().AlwaysRebuild() || PointeeType !=
T->getPointeeType() ||
5738 NewQualifierLoc.getNestedNameSpecifier() !=
5739 OldQualifierLoc.getNestedNameSpecifier() ||
5742 SS.
Adopt(NewQualifierLoc);
5743 Result = getDerived().RebuildMemberPointerType(PointeeType, SS, NewCls,
5752 if (MPT && PointeeType != MPT->getPointeeType()) {
5759 NewTL.setQualifierLoc(NewQualifierLoc);
5764template<
typename Derived>
5769 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5770 if (ElementType.isNull())
5774 Expr *OldSize = TL.getSizeExpr();
5776 OldSize =
const_cast<Expr*
>(
T->getSizeExpr());
5777 Expr *NewSize =
nullptr;
5781 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
5786 if (getDerived().AlwaysRebuild() ||
5787 ElementType !=
T->getElementType() ||
5788 (
T->getSizeExpr() && NewSize != OldSize)) {
5789 Result = getDerived().RebuildConstantArrayType(ElementType,
5790 T->getSizeModifier(),
5791 T->getSize(), NewSize,
5792 T->getIndexTypeCVRQualifiers(),
5793 TL.getBracketsRange());
5804 NewTL.setRBracketLoc(TL.getRBracketLoc());
5805 NewTL.setSizeExpr(NewSize);
5810template<
typename Derived>
5815 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5816 if (ElementType.isNull())
5820 if (getDerived().AlwaysRebuild() ||
5821 ElementType !=
T->getElementType()) {
5822 Result = getDerived().RebuildIncompleteArrayType(ElementType,
5823 T->getSizeModifier(),
5824 T->getIndexTypeCVRQualifiers(),
5825 TL.getBracketsRange());
5832 NewTL.setRBracketLoc(TL.getRBracketLoc());
5833 NewTL.setSizeExpr(
nullptr);
5838template<
typename Derived>
5843 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5844 if (ElementType.isNull())
5851 SizeResult = getDerived().TransformExpr(
T->getSizeExpr());
5853 if (SizeResult.isInvalid())
5857 if (SizeResult.isInvalid())
5863 if (getDerived().AlwaysRebuild() ||
5864 ElementType !=
T->getElementType() ||
5865 Size !=
T->getSizeExpr()) {
5866 Result = getDerived().RebuildVariableArrayType(ElementType,
5867 T->getSizeModifier(),
5869 T->getIndexTypeCVRQualifiers(),
5870 TL.getBracketsRange());
5879 NewTL.setRBracketLoc(TL.getRBracketLoc());
5880 NewTL.setSizeExpr(Size);
5885template<
typename Derived>
5890 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5891 if (ElementType.isNull())
5899 SemaRef.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
5902 Expr *origSize = TL.getSizeExpr();
5903 if (!origSize) origSize =
T->getSizeExpr();
5906 = getDerived().TransformExpr(origSize);
5908 if (sizeResult.isInvalid())
5911 Expr *size = sizeResult.get();
5914 if (getDerived().AlwaysRebuild() ||
5915 ElementType !=
T->getElementType() ||
5917 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
5918 T->getSizeModifier(),
5920 T->getIndexTypeCVRQualifiers(),
5921 TL.getBracketsRange());
5930 NewTL.setRBracketLoc(TL.getRBracketLoc());
5931 NewTL.setSizeExpr(size);
5936template <
typename Derived>
5940 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5941 if (ElementType.isNull())
5949 if (
Size.isInvalid())
5953 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
5954 Size.get() !=
T->getSizeExpr()) {
5955 Result = getDerived().RebuildDependentVectorType(
5956 ElementType,
Size.get(),
T->getAttributeLoc(),
T->getVectorKind());
5974template<
typename Derived>
5981 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
5982 if (ElementType.isNull())
5991 if (
Size.isInvalid())
5995 if (getDerived().AlwaysRebuild() ||
5996 ElementType !=
T->getElementType() ||
5997 Size.get() !=
T->getSizeExpr()) {
5998 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
6000 T->getAttributeLoc());
6018template <
typename Derived>
6023 QualType ElementType = getDerived().TransformType(
T->getElementType());
6024 if (ElementType.isNull())
6028 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType()) {
6029 Result = getDerived().RebuildConstantMatrixType(
6030 ElementType,
T->getNumRows(),
T->getNumColumns());
6037 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6038 NewTL.setAttrRowOperand(TL.getAttrRowOperand());
6039 NewTL.setAttrColumnOperand(TL.getAttrColumnOperand());
6044template <
typename Derived>
6049 QualType ElementType = getDerived().TransformType(
T->getElementType());
6050 if (ElementType.isNull()) {
6058 Expr *origRows = TL.getAttrRowOperand();
6060 origRows =
T->getRowExpr();
6061 Expr *origColumns = TL.getAttrColumnOperand();
6063 origColumns =
T->getColumnExpr();
6065 ExprResult rowResult = getDerived().TransformExpr(origRows);
6067 if (rowResult.isInvalid())
6070 ExprResult columnResult = getDerived().TransformExpr(origColumns);
6072 if (columnResult.isInvalid())
6075 Expr *rows = rowResult.get();
6076 Expr *columns = columnResult.get();
6079 if (getDerived().AlwaysRebuild() || ElementType !=
T->getElementType() ||
6080 rows != origRows || columns != origColumns) {
6081 Result = getDerived().RebuildDependentSizedMatrixType(
6082 ElementType, rows, columns,
T->getAttributeLoc());
6092 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
6093 NewTL.setAttrRowOperand(rows);
6094 NewTL.setAttrColumnOperand(columns);
6098template <
typename Derived>
6104 getDerived().TransformType(TLB, TL.getPointeeTypeLoc());
6106 if (pointeeType.isNull())
6113 ExprResult AddrSpace = getDerived().TransformExpr(
T->getAddrSpaceExpr());
6115 if (AddrSpace.isInvalid())
6119 if (getDerived().AlwaysRebuild() || pointeeType !=
T->getPointeeType() ||
6120 AddrSpace.get() !=
T->getAddrSpaceExpr()) {
6121 Result = getDerived().RebuildDependentAddressSpaceType(
6122 pointeeType, AddrSpace.get(),
T->getAttributeLoc());
6133 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
6134 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
6137 TLB.TypeWasModifiedSafely(
Result);
6143template <
typename Derived>
6147 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6148 if (ElementType.isNull())
6152 if (getDerived().AlwaysRebuild() ||
6153 ElementType !=
T->getElementType()) {
6154 Result = getDerived().RebuildVectorType(ElementType,
T->getNumElements(),
6155 T->getVectorKind());
6166template<
typename Derived>
6170 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
6171 if (ElementType.isNull())
6175 if (getDerived().AlwaysRebuild() ||
6176 ElementType !=
T->getElementType()) {
6177 Result = getDerived().RebuildExtVectorType(ElementType,
6178 T->getNumElements(),
6190template <
typename Derived>
6193 bool ExpectParameterPack) {
6228 if (NewDI == OldDI && indexAdjustment == 0)
6246template <
typename Derived>
6254 unsigned *LastParamTransformed) {
6255 int indexAdjustment = 0;
6257 unsigned NumParams = Params.size();
6258 for (
unsigned i = 0; i != NumParams; ++i) {
6259 if (LastParamTransformed)
6260 *LastParamTransformed = i;
6262 assert(OldParm->getFunctionScopeIndex() == i);
6266 if (OldParm->isParameterPack()) {
6271 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6274 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
6277 bool ShouldExpand =
false;
6278 bool RetainExpansion =
false;
6280 if (Unexpanded.size() > 0) {
6281 OrigNumExpansions = ExpansionTL.
getTypePtr()->getNumExpansions();
6282 NumExpansions = OrigNumExpansions;
6286 ShouldExpand, RetainExpansion, NumExpansions)) {
6291 const AutoType *AT =
6292 Pattern.getType().getTypePtr()->getContainedAutoType();
6293 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6294 "Could not find parameter packs or undeduced auto type!");
6301 getDerived().ExpandingFunctionParameterPack(OldParm);
6302 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6305 =
getDerived().TransformFunctionTypeParam(OldParm,
6313 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6314 OutParamTypes.push_back(NewParm->
getType());
6316 PVars->push_back(NewParm);
6321 if (RetainExpansion) {
6322 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6324 =
getDerived().TransformFunctionTypeParam(OldParm,
6332 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6333 OutParamTypes.push_back(NewParm->
getType());
6335 PVars->push_back(NewParm);
6351 NewParm =
getDerived().TransformFunctionTypeParam(OldParm,
6356 "Parameter pack no longer a parameter pack after "
6359 NewParm =
getDerived().TransformFunctionTypeParam(
6360 OldParm, indexAdjustment, std::nullopt,
6368 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6369 OutParamTypes.push_back(NewParm->
getType());
6371 PVars->push_back(NewParm);
6379 bool IsPackExpansion =
false;
6382 if (
const PackExpansionType *Expansion
6383 = dyn_cast<PackExpansionType>(OldType)) {
6385 QualType Pattern = Expansion->getPattern();
6387 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
6390 bool ShouldExpand =
false;
6391 bool RetainExpansion =
false;
6395 RetainExpansion, NumExpansions)) {
6402 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6409 NewType =
getSema().getASTContext().getPackExpansionType(
6410 NewType, std::nullopt);
6417 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6418 OutParamTypes.push_back(NewType);
6420 PVars->push_back(
nullptr);
6429 if (RetainExpansion) {
6430 ForgetPartiallySubstitutedPackRAII Forget(
getDerived());
6436 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6437 OutParamTypes.push_back(NewType);
6439 PVars->push_back(
nullptr);
6444 OldType = Expansion->getPattern();
6445 IsPackExpansion =
true;
6447 NewType =
getDerived().TransformType(OldType);
6449 NewType =
getDerived().TransformType(OldType);
6455 if (IsPackExpansion)
6456 NewType =
getSema().Context.getPackExpansionType(NewType,
6460 PInfos.
set(OutParamTypes.size(), ParamInfos[i]);
6461 OutParamTypes.push_back(NewType);
6463 PVars->push_back(
nullptr);
6468 for (
unsigned i = 0, e = PVars->size(); i != e; ++i)
6470 assert(parm->getFunctionScopeIndex() == i);
6477template<
typename Derived>
6482 return getDerived().TransformFunctionProtoType(
6486 ExceptionStorage, Changed);
6490template<
typename Derived>
template<
typename Fn>
6509 if (
T->hasTrailingReturn()) {
6513 T->getExtParameterInfosOrNull(),
6514 ParamTypes, &ParamDecls, ExtParamInfos))
6524 auto *RD = dyn_cast<CXXRecordDecl>(
SemaRef.getCurLexicalContext());
6526 SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals);
6541 T->getExtParameterInfosOrNull(),
6542 ParamTypes, &ParamDecls, ExtParamInfos))
6548 bool EPIChanged =
false;
6553 if (
auto NewExtParamInfos =
6569 std::optional<FunctionEffectSet> NewFX;
6581 std::optional<FunctionEffectMode> Mode =
6601 "FunctionEffectMode::None shouldn't be possible here");
6604 if (!
SemaRef.diagnoseConflictingFunctionEffect(*NewFX, NewEC,
6607 NewFX->insert(NewEC, Errs);
6608 assert(Errs.empty());
6618 Result =
getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
6629 for (
unsigned i = 0, e = NewTL.
getNumParams(); i != e; ++i)
6635template<
typename Derived>
6658 getSema().ActOnNoexceptSpec(NoexceptExpr.
get(), EST);
6673 if (
const PackExpansionType *PackExpansion =
6674 T->getAs<PackExpansionType>()) {
6679 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6681 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
6686 bool Expand =
false;
6687 bool RetainExpansion =
false;
6688 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
6693 true, Expand, RetainExpansion,
6706 U =
SemaRef.Context.getPackExpansionType(
U, NumExpansions);
6707 Exceptions.push_back(
U);
6713 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6717 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6720 Exceptions.push_back(
U);
6724 if (
U.isNull() ||
SemaRef.CheckSpecifiedExceptionType(
U, Loc))
6729 Exceptions.push_back(
U);
6739template<
typename Derived>
6749 if (getDerived().AlwaysRebuild() || ResultType !=
T->getReturnType())
6750 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
6761template <
typename Derived>
6762QualType TreeTransform<Derived>::TransformUnresolvedUsingType(
6763 TypeLocBuilder &TLB, UnresolvedUsingTypeLoc TL) {
6765 const UnresolvedUsingType *T = TL.getTypePtr();
6766 bool Changed =
false;
6768 NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
6769 if (NestedNameSpecifierLoc OldQualifierLoc = QualifierLoc) {
6770 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6773 Changed |= QualifierLoc != OldQualifierLoc;
6776 auto *D = getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl());
6782 if (getDerived().AlwaysRebuild() || Changed) {
6783 Result = getDerived().RebuildUnresolvedUsingType(
6784 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), TL.getNameLoc(),
6792 QualifierLoc, TL.getNameLoc());
6795 QualifierLoc, TL.getNameLoc());
6799template <
typename Derived>
6807 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6810 Changed |= QualifierLoc != OldQualifierLoc;
6813 auto *D = cast_or_null<UsingShadowDecl>(
6814 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6819 QualType UnderlyingType = getDerived().TransformType(
T->desugar());
6820 if (UnderlyingType.isNull())
6822 Changed |= UnderlyingType !=
T->desugar();
6825 if (getDerived().AlwaysRebuild() || Changed) {
6826 Result = getDerived().RebuildUsingType(
6827 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(), D,
6837template<
typename Derived>
6845 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
6848 Changed |= QualifierLoc != OldQualifierLoc;
6851 auto *
Typedef = cast_or_null<TypedefNameDecl>(
6852 getDerived().TransformDecl(TL.getNameLoc(),
T->getDecl()));
6860 if (getDerived().AlwaysRebuild() || Changed) {
6861 Result = getDerived().RebuildTypedefType(
6862 T->getKeyword(), QualifierLoc.getNestedNameSpecifier(),
Typedef);
6868 QualifierLoc, TL.getNameLoc());
6872template<
typename Derived>
6880 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
6890 if (getDerived().AlwaysRebuild() || E.get() != TL.getUnderlyingExpr()) {
6892 getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc(), Kind);
6899 NewTL.setLParenLoc(TL.getLParenLoc());
6900 NewTL.setRParenLoc(TL.getRParenLoc());
6905template<
typename Derived>
6909 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
6915 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
6916 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6923 NewTL.setLParenLoc(TL.getLParenLoc());
6924 NewTL.setRParenLoc(TL.getRParenLoc());
6925 NewTL.setUnmodifiedTInfo(New_Under_TI);
6930template<
typename Derived>
6933 const DecltypeType *
T = TL.getTypePtr();
6940 ExprResult E = getDerived().TransformExpr(
T->getUnderlyingExpr());
6944 E = getSema().ActOnDecltypeExpression(E.get());
6949 if (getDerived().AlwaysRebuild() ||
6950 E.get() !=
T->getUnderlyingExpr()) {
6951 Result = getDerived().RebuildDecltypeType(E.get(), TL.getDecltypeLoc());
6959 NewTL.setRParenLoc(TL.getRParenLoc());
6963template <
typename Derived>
6973 IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
6974 if (IndexExpr.isInvalid())
6977 QualType Pattern = TL.getPattern();
6979 const PackIndexingType *PIT = TL.
getTypePtr();
6983 bool NotYetExpanded = Types.empty();
6984 bool FullySubstituted =
true;
6986 if (Types.empty() && !PIT->expandsToEmptyPack())
6990 if (!
T->containsUnexpandedParameterPack()) {
6991 QualType Transformed = getDerived().TransformType(
T);
6992 if (Transformed.isNull())
6994 SubtitutedTypes.push_back(Transformed);
6999 getSema().collectUnexpandedParameterPacks(
T, Unexpanded);
7000 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7003 bool ShouldExpand =
true;
7004 bool RetainExpansion =
false;
7006 if (getDerived().TryExpandParameterPacks(
7009 RetainExpansion, NumExpansions))
7011 if (!ShouldExpand) {
7017 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
7020 if (NotYetExpanded) {
7021 FullySubstituted =
false;
7022 QualType Out = getDerived().RebuildPackIndexingType(
7032 SubtitutedTypes.push_back(Pack);
7035 for (
unsigned I = 0; I != *NumExpansions; ++I) {
7040 SubtitutedTypes.push_back(Out);
7041 FullySubstituted &= !
Out->containsUnexpandedParameterPack();
7045 if (RetainExpansion) {
7046 FullySubstituted =
false;
7047 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
7051 SubtitutedTypes.push_back(Out);
7059 QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
7061 QualType Out = getDerived().RebuildPackIndexingType(
7063 FullySubstituted, SubtitutedTypes);
7072template<
typename Derived>
7077 if (
Result->isDependentType()) {
7078 const UnaryTransformType *
T = TL.getTypePtr();
7081 getDerived().TransformType(TL.getUnderlyingTInfo());
7084 QualType NewBase = NewBaseTSI->getType();
7086 Result = getDerived().RebuildUnaryTransformType(NewBase,
7095 NewTL.setParensRange(TL.getParensRange());
7096 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
7100template<
typename Derived>
7103 const DeducedTemplateSpecializationType *
T = TL.getTypePtr();
7108 TL.getTemplateNameLoc());
7112 QualType OldDeduced =
T->getDeducedType();
7114 if (!OldDeduced.isNull()) {
7115 NewDeduced = getDerived().TransformType(OldDeduced);
7116 if (NewDeduced.isNull())
7120 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
7127 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
7128 NewTL.setQualifierLoc(QualifierLoc);
7132template <
typename Derived>
7139 QualifierLoc =
getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
7144 auto *TD = cast_or_null<TagDecl>(
7151 TD !=
T->getOriginalDecl()) {
7152 if (
T->isCanonicalUnqualified())
7169template <
typename Derived>
7175template <
typename Derived>
7176QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
7178 return getDerived().TransformTagType(TLB, TL);
7181template<
typename Derived>
7188template<
typename Derived>
7192 return getDerived().TransformTemplateTypeParmType(
7197template <
typename Derived>
7203template<
typename Derived>
7204QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
7205 TypeLocBuilder &TLB,
7206 SubstTemplateTypeParmTypeLoc TL) {
7207 const SubstTemplateTypeParmType *T = TL.getTypePtr();
7210 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7215 TemporaryBase Rebase(*
this, TL.getNameLoc(), DeclarationName());
7216 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7217 if (Replacement.isNull())
7221 Replacement, NewReplaced, T->getIndex(), T->getPackIndex(),
7225 SubstTemplateTypeParmTypeLoc NewTL
7226 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
7227 NewTL.setNameLoc(TL.getNameLoc());
7231template <
typename Derived>
7237template<
typename Derived>
7241 return getDerived().TransformSubstTemplateTypeParmPackType(
7245template <
typename Derived>
7251template<
typename Derived>
7252QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
7254 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7255 if (ValueType.isNull())
7258 QualType Result = TL.getType();
7259 if (getDerived().AlwaysRebuild() ||
7260 ValueType != TL.getValueLoc().getType()) {
7261 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
7262 if (Result.isNull())
7268 NewTL.setLParenLoc(TL.getLParenLoc());
7269 NewTL.setRParenLoc(TL.getRParenLoc());
7274template <
typename Derived>
7277 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
7278 if (ValueType.isNull())
7282 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
7285 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
7296template <
typename Derived>
7302 if (getDerived().AlwaysRebuild()) {
7303 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7304 EIT->getNumBits(), TL.getNameLoc());
7314template <
typename Derived>
7321 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7324 if (BitsExpr.isInvalid())
7329 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7330 Result = getDerived().RebuildDependentBitIntType(
7331 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7347template <
typename Derived>
7350 llvm_unreachable(
"This type does not need to be transformed.");
7358 template<
typename ArgLocContainer>
7360 ArgLocContainer *Container;
7385 : Container(&Container), Index(Index) { }
7399 return Container->getArgLoc(Index);
7403 return pointer(Container->getArgLoc(Index));
7408 return X.Container == Y.Container &&
X.Index == Y.Index;
7417template<
typename Derived>
7418QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
7420 const AutoType *T = TL.getTypePtr();
7421 QualType OldDeduced = T->getDeducedType();
7422 QualType NewDeduced;
7423 if (!OldDeduced.isNull()) {
7424 NewDeduced = getDerived().TransformType(OldDeduced);
7425 if (NewDeduced.isNull())
7432 if (
T->isConstrained()) {
7433 assert(TL.getConceptReference());
7434 NewCD = cast_or_null<ConceptDecl>(getDerived().TransformDecl(
7435 TL.getConceptNameLoc(),
T->getTypeConstraintConcept()));
7437 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
7438 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
7440 if (getDerived().TransformTemplateArguments(
7441 ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
7445 if (TL.getNestedNameSpecifierLoc()) {
7447 = getDerived().TransformNestedNameSpecifierLoc(
7448 TL.getNestedNameSpecifierLoc());
7449 if (!NewNestedNameSpec)
7455 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
7456 T->isDependentType() ||
T->isConstrained()) {
7459 NewArgList.reserve(NewTemplateArgs.size());
7460 for (
const auto &ArgLoc : NewTemplateArgs.arguments())
7461 NewArgList.push_back(ArgLoc.getArgument());
7462 Result = getDerived().RebuildAutoType(NewDeduced,
T->getKeyword(), NewCD,
7470 NewTL.setRParenLoc(TL.getRParenLoc());
7471 NewTL.setConceptReference(
nullptr);
7473 if (
T->isConstrained()) {
7475 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7476 TL.getConceptNameLoc(),
7477 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7479 SemaRef.
Context, NewNestedNameSpec, TL.getTemplateKWLoc(), DNI,
7480 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7482 NewTL.setConceptReference(CR);
7488template <
typename Derived>
7491 return getDerived().TransformTemplateSpecializationType(
7496template <
typename Derived>
7499 NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
7500 const TemplateSpecializationType *
T = TL.
getTypePtr();
7506 AllowInjectedClassName);
7515 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
7524 QualType Result = getDerived().RebuildTemplateSpecializationType(
7537template <
typename Derived>
7541 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
7542 if (modifiedType.isNull())
7546 const Attr *oldAttr = TL.getAttr();
7547 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) :
nullptr;
7548 if (oldAttr && !newAttr)
7554 if (getDerived().AlwaysRebuild() ||
7555 modifiedType != oldType->getModifiedType()) {
7568 QualType equivalentType = modifiedType;
7569 if (TL.getModifiedLoc().getType() != TL.getEquivalentTypeLoc().getType()) {
7571 AuxiliaryTLB.
reserve(TL.getFullDataSize());
7573 getDerived().TransformType(AuxiliaryTLB, TL.getEquivalentTypeLoc());
7574 if (equivalentType.isNull())
7580 if (
auto nullability = oldType->getImmediateNullability()) {
7581 if (!modifiedType->canHaveNullability()) {
7582 SemaRef.
Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7583 : TL.getModifiedLoc().getBeginLoc()),
7584 diag::err_nullability_nonpointer)
7601template <
typename Derived>
7605 QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
7606 if (InnerTy.isNull())
7609 Expr *OldCount = TL.getCountExpr();
7610 Expr *NewCount =
nullptr;
7612 ExprResult CountResult = getDerived().TransformExpr(OldCount);
7613 if (CountResult.isInvalid())
7615 NewCount = CountResult.get();
7619 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7620 OldCount != NewCount) {
7623 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7630template <
typename Derived>
7634 llvm_unreachable(
"Unexpected TreeTransform for BTFTagAttributedType");
7637template <
typename Derived>
7641 const HLSLAttributedResourceType *oldType = TL.getTypePtr();
7643 QualType WrappedTy = getDerived().TransformType(TLB, TL.getWrappedLoc());
7644 if (WrappedTy.isNull())
7648 QualType OldContainedTy = oldType->getContainedType();
7649 if (!OldContainedTy.isNull()) {
7650 TypeSourceInfo *oldContainedTSI = TL.getContainedTypeSourceInfo();
7651 if (!oldContainedTSI)
7652 oldContainedTSI = getSema().getASTContext().getTrivialTypeSourceInfo(
7654 TypeSourceInfo *ContainedTSI = getDerived().TransformType(oldContainedTSI);
7657 ContainedTy = ContainedTSI->getType();
7661 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7662 ContainedTy != oldType->getContainedType()) {
7664 WrappedTy, ContainedTy, oldType->getAttrs());
7671template <
typename Derived>
7675 return TL.getType();
7678template<
typename Derived>
7682 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7687 if (getDerived().AlwaysRebuild() ||
7688 Inner != TL.getInnerLoc().getType()) {
7689 Result = getDerived().RebuildParenType(Inner);
7696 NewTL.setRParenLoc(TL.getRParenLoc());
7700template <
typename Derived>
7704 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
7709 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
7711 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
7721template<
typename Derived>
7722QualType TreeTransform<Derived>::TransformDependentNameType(
7724 return TransformDependentNameType(TLB, TL,
false);
7727template <
typename Derived>
7728QualType TreeTransform<Derived>::TransformDependentNameType(
7731 const DependentNameType *
T = TL.getTypePtr();
7735 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(
7736 QualifierLoc, ObjectType, UnqualLookup);
7740 assert((ObjectType.isNull() && !UnqualLookup) &&
7741 "must be transformed by TransformNestedNameSpecifierLoc");
7745 = getDerived().RebuildDependentNameType(
T->getKeyword(),
7746 TL.getElaboratedKeywordLoc(),
7757 NewTL.setQualifierLoc(QualifierLoc);
7758 NewTL.setNameLoc(TL.getNameLoc());
7762 NewTL.setTemplateNameLoc(TL.getNameLoc());
7763 NewTL.setQualifierLoc(QualifierLoc);
7766 QualifierLoc, TL.getNameLoc());
7769 NewTL.
set(TL.getElaboratedKeywordLoc(), QualifierLoc, TL.getNameLoc());
7773 NewTL.setQualifierLoc(QualifierLoc);
7774 NewTL.setNameLoc(TL.getNameLoc());
7779template<
typename Derived>
7783 = getDerived().TransformType(TLB, TL.getPatternLoc());
7784 if (Pattern.isNull())
7788 if (getDerived().AlwaysRebuild() ||
7789 Pattern != TL.getPatternLoc().getType()) {
7790 Result = getDerived().RebuildPackExpansionType(Pattern,
7791 TL.getPatternLoc().getSourceRange(),
7792 TL.getEllipsisLoc(),
7793 TL.getTypePtr()->getNumExpansions());
7803template<
typename Derived>
7808 TLB.pushFullCopy(TL);
7809 return TL.getType();
7812template<
typename Derived>
7816 const ObjCTypeParamType *
T = TL.getTypePtr();
7818 getDerived().TransformDecl(
T->getDecl()->getLocation(),
T->getDecl()));
7823 if (getDerived().AlwaysRebuild() ||
7824 OTP !=
T->getDecl()) {
7825 Result = getDerived().RebuildObjCTypeParamType(
7826 OTP, TL.getProtocolLAngleLoc(),
7827 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7828 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7834 if (TL.getNumProtocols()) {
7835 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7836 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7837 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
7838 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7843template<
typename Derived>
7848 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
7849 if (BaseType.isNull())
7852 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
7856 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
7858 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7859 QualType TypeArg = TypeArgInfo->getType();
7864 const auto *PackExpansion = PackExpansionLoc.getType()
7865 ->castAs<PackExpansionType>();
7869 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
7873 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
7874 bool Expand =
false;
7875 bool RetainExpansion =
false;
7876 UnsignedOrNone NumExpansions = PackExpansion->getNumExpansions();
7877 if (getDerived().TryExpandParameterPacks(
7878 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
7879 Unexpanded,
true, Expand,
7880 RetainExpansion, NumExpansions))
7890 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7891 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
7893 if (NewPatternType.isNull())
7897 NewPatternType, NumExpansions);
7899 NewExpansionLoc.
setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
7900 NewTypeArgInfos.push_back(
7901 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewExpansionType));
7907 for (
unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
7911 TypeArgBuilder.
reserve(PatternLoc.getFullDataSize());
7913 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
7915 if (NewTypeArg.isNull())
7918 NewTypeArgInfos.push_back(
7919 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7926 TypeArgBuilder.
reserve(TypeArgLoc.getFullDataSize());
7928 getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
7929 if (NewTypeArg.isNull())
7933 if (NewTypeArg == TypeArg) {
7934 NewTypeArgInfos.push_back(TypeArgInfo);
7938 NewTypeArgInfos.push_back(
7939 TypeArgBuilder.getTypeSourceInfo(SemaRef.
Context, NewTypeArg));
7944 if (getDerived().AlwaysRebuild() || AnyChanged) {
7946 Result = getDerived().RebuildObjCObjectType(
7947 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
7948 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
7949 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7950 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
7958 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
7959 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
7960 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
7961 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
7962 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
7963 for (
unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
7964 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
7965 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
7969template<
typename Derived>
7973 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
7974 if (PointeeType.isNull())
7978 if (getDerived().AlwaysRebuild() ||
7979 PointeeType != TL.getPointeeLoc().getType()) {
7980 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
7994template<
typename Derived>
8000template<
typename Derived>
8003 return getDerived().TransformCompoundStmt(S,
false);
8006template<
typename Derived>
8013 getSema().resetFPOptions(
8017 bool SubStmtInvalid =
false;
8018 bool SubStmtChanged =
false;
8020 for (
auto *B : S->
body()) {
8022 B, IsStmtExpr && B ==
ExprResult ? StmtDiscardKind::StmtExprResult
8023 : StmtDiscardKind::Discarded);
8025 if (
Result.isInvalid()) {
8032 SubStmtInvalid =
true;
8036 SubStmtChanged = SubStmtChanged || Result.get() != B;
8037 Statements.push_back(Result.getAs<Stmt>());
8043 if (!getDerived().AlwaysRebuild() &&
8047 return getDerived().RebuildCompoundStmt(S->
getLBracLoc(),
8053template<
typename Derived>
8062 LHS = getDerived().TransformExpr(S->getLHS());
8064 if (LHS.isInvalid())
8068 RHS = getDerived().TransformExpr(S->getRHS());
8070 if (RHS.isInvalid())
8077 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8079 S->getEllipsisLoc(),
8082 if (Case.isInvalid())
8087 getDerived().TransformStmt(S->getSubStmt());
8088 if (SubStmt.isInvalid())
8092 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
8095template <
typename Derived>
8099 getDerived().TransformStmt(S->getSubStmt());
8100 if (SubStmt.isInvalid())
8104 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8108template<
typename Derived>
8111 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8112 if (SubStmt.isInvalid())
8115 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8123 if (LD == S->getDecl())
8124 S->getDecl()->setStmt(
nullptr);
8127 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8132template <
typename Derived>
8141 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
8142#include "clang/Basic/AttrList.inc"
8147template <
typename Derived>
8158 return getDerived().TransformStmt##X##Attr(OrigS, InstS, cast<X##Attr>(R));
8159#include "clang/Basic/AttrList.inc"
8164template <
typename Derived>
8167 StmtDiscardKind SDK) {
8172 bool AttrsChanged =
false;
8176 for (
const auto *I : S->
getAttrs()) {
8178 getDerived().TransformStmtAttr(S->
getSubStmt(), SubStmt.
get(), I);
8179 AttrsChanged |= (I != R);
8192 return getDerived().RebuildAttributedStmt(S->
getAttrLoc(), Attrs,
8196template<
typename Derived>
8201 if (
Init.isInvalid())
8205 if (!S->isConsteval()) {
8207 Cond = getDerived().TransformCondition(
8208 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8211 if (
Cond.isInvalid())
8216 std::optional<bool> ConstexprConditionValue;
8217 if (S->isConstexpr())
8218 ConstexprConditionValue =
Cond.getKnownValue();
8222 if (!ConstexprConditionValue || *ConstexprConditionValue) {
8226 S->isNonNegatedConsteval());
8228 Then = getDerived().TransformStmt(S->getThen());
8229 if (Then.isInvalid())
8235 Then =
new (getSema().Context)
8236 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8241 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
8245 S->isNegatedConsteval());
8247 Else = getDerived().TransformStmt(S->getElse());
8248 if (Else.isInvalid())
8250 }
else if (S->getElse() && ConstexprConditionValue &&
8251 *ConstexprConditionValue) {
8255 Else =
new (getSema().Context)
8256 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8259 if (!getDerived().AlwaysRebuild() &&
8260 Init.get() == S->getInit() &&
8261 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8262 Then.get() == S->getThen() &&
8263 Else.get() == S->getElse())
8266 return getDerived().RebuildIfStmt(
8267 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(),
Cond,
8268 S->getRParenLoc(),
Init.get(), Then.get(), S->getElseLoc(), Else.get());
8271template<
typename Derived>
8276 if (
Init.isInvalid())
8281 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8283 if (
Cond.isInvalid())
8288 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8289 Init.get(),
Cond, S->getRParenLoc());
8294 StmtResult Body = getDerived().TransformStmt(S->getBody());
8295 if (Body.isInvalid())
8299 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(),
Switch.get(),
8303template<
typename Derived>
8308 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8310 if (
Cond.isInvalid())
8319 StmtResult Body = getDerived().TransformStmt(S->getBody());
8320 if (Body.isInvalid())
8323 if (!getDerived().AlwaysRebuild() &&
8324 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8325 Body.get() == S->getBody())
8328 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8329 Cond, S->getRParenLoc(), Body.get());
8332template<
typename Derived>
8341 StmtResult Body = getDerived().TransformStmt(S->getBody());
8342 if (Body.isInvalid())
8347 if (
Cond.isInvalid())
8350 if (!getDerived().AlwaysRebuild() &&
8351 Cond.get() == S->getCond() &&
8352 Body.get() == S->getBody())
8355 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8356 S->getWhileLoc(),
Cond.get(),
8360template<
typename Derived>
8363 if (getSema().getLangOpts().OpenMP)
8364 getSema().OpenMP().startOpenMPLoop();
8368 if (
Init.isInvalid())
8373 if (getSema().getLangOpts().OpenMP &&
Init.isUsable())
8374 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8379 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8381 if (
Cond.isInvalid())
8386 if (
Inc.isInvalid())
8390 if (S->getInc() && !FullInc.get())
8397 S->getBeginLoc(), S->getInit(),
Init.get(), S->getCond(),
8398 Cond.get().second, S->getInc(),
Inc.get());
8401 StmtResult Body = getDerived().TransformStmt(S->getBody());
8402 if (Body.isInvalid())
8407 if (!getDerived().AlwaysRebuild() &&
8408 Init.get() == S->getInit() &&
8409 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8410 Inc.get() == S->getInc() &&
8411 Body.get() == S->getBody())
8414 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8416 S->getRParenLoc(), Body.get());
8419template<
typename Derived>
8422 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8428 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8432template<
typename Derived>
8440 if (!getDerived().AlwaysRebuild() &&
8441 Target.get() == S->getTarget())
8444 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8448template<
typename Derived>
8451 if (!S->hasLabelTarget())
8454 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8463template<
typename Derived>
8466 if (!S->hasLabelTarget())
8469 Decl *LD = getDerived().TransformDecl(S->getLabelDecl()->getLocation(),
8478template<
typename Derived>
8488 return getDerived().RebuildReturnStmt(S->getReturnLoc(),
Result.get());
8491template<
typename Derived>
8494 bool DeclChanged =
false;
8497 for (
auto *D : S->decls()) {
8498 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8502 if (Transformed != D)
8506 if (
auto *TD = dyn_cast<TypeDecl>(Transformed)) {
8507 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD)) {
8508 LSI->ContainsUnexpandedParameterPack |=
8509 TN->getUnderlyingType()->containsUnexpandedParameterPack();
8511 LSI->ContainsUnexpandedParameterPack |=
8514 .getTypeDeclType(TD)
8515 ->containsUnexpandedParameterPack();
8518 if (
auto *VD = dyn_cast<VarDecl>(Transformed))
8519 LSI->ContainsUnexpandedParameterPack |=
8520 VD->getType()->containsUnexpandedParameterPack();
8523 Decls.push_back(Transformed);
8526 if (!getDerived().AlwaysRebuild() && !DeclChanged)
8529 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8532template<
typename Derived>
8542 bool ExprsChanged =
false;
8544 auto RebuildString = [&](
Expr *E) {
8549 ExprsChanged =
true;
8556 for (
unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8557 Names.push_back(S->getOutputIdentifier(I));
8563 Constraints.push_back(
Result.get());
8566 Expr *OutputExpr = S->getOutputExpr(I);
8567 Result = getDerived().TransformExpr(OutputExpr);
8571 ExprsChanged |=
Result.get() != OutputExpr;
8573 Exprs.push_back(
Result.get());
8577 for (
unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8578 Names.push_back(S->getInputIdentifier(I));
8584 Constraints.push_back(
Result.get());
8587 Expr *InputExpr = S->getInputExpr(I);
8588 Result = getDerived().TransformExpr(InputExpr);
8592 ExprsChanged |=
Result.get() != InputExpr;
8594 Exprs.push_back(
Result.get());
8598 for (
unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8599 Names.push_back(S->getLabelIdentifier(I));
8604 ExprsChanged |=
Result.get() != S->getLabelExpr(I);
8605 Exprs.push_back(
Result.get());
8609 for (
unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) {
8613 Clobbers.push_back(
Result.get());
8616 ExprResult AsmString = RebuildString(S->getAsmStringExpr());
8617 if (AsmString.isInvalid())
8620 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
8623 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8624 S->isVolatile(), S->getNumOutputs(),
8625 S->getNumInputs(), Names.data(),
8626 Constraints, Exprs, AsmString.get(),
8627 Clobbers, S->getNumLabels(),
8631template<
typename Derived>
8636 bool HadError =
false, HadChange =
false;
8640 TransformedExprs.reserve(SrcExprs.size());
8641 for (
unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
8643 if (!
Result.isUsable()) {
8646 HadChange |= (
Result.get() != SrcExprs[i]);
8647 TransformedExprs.push_back(
Result.get());
8652 if (!HadChange && !getDerived().AlwaysRebuild())
8655 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8656 AsmToks, S->getAsmString(),
8657 S->getNumOutputs(), S->getNumInputs(),
8658 S->getAllConstraints(), S->getClobbers(),
8659 TransformedExprs, S->getEndLoc());
8663template<
typename Derived>
8668 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8669 ScopeInfo->NeedsCoroutineSuspends &&
8670 ScopeInfo->CoroutineSuspends.first ==
nullptr &&
8671 ScopeInfo->CoroutineSuspends.second ==
nullptr &&
8672 "expected clean scope info");
8676 ScopeInfo->setNeedsCoroutineSuspends(
false);
8689 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8690 ScopeInfo->CoroutinePromise = Promise;
8695 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8696 if (InitSuspend.isInvalid())
8699 getDerived().TransformStmt(S->getFinalSuspendStmt());
8700 if (FinalSuspend.isInvalid() ||
8703 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8706 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8707 if (BodyRes.isInvalid())
8711 if (Builder.isInvalid())
8714 Expr *ReturnObject = S->getReturnValueInit();
8715 assert(ReturnObject &&
"the return object is expected to be valid");
8716 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
8718 if (Res.isInvalid())
8720 Builder.ReturnValue = Res.get();
8725 if (S->hasDependentPromiseType()) {
8728 if (!Promise->getType()->isDependentType()) {
8729 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8730 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8731 "these nodes should not have been built yet");
8732 if (!Builder.buildDependentStatements())
8736 if (
auto *OnFallthrough = S->getFallthroughHandler()) {
8737 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
8738 if (Res.isInvalid())
8740 Builder.OnFallthrough = Res.get();
8743 if (
auto *OnException = S->getExceptionHandler()) {
8744 StmtResult Res = getDerived().TransformStmt(OnException);
8745 if (Res.isInvalid())
8747 Builder.OnException = Res.get();
8750 if (
auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8751 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
8752 if (Res.isInvalid())
8754 Builder.ReturnStmtOnAllocFailure = Res.get();
8758 assert(S->getAllocate() && S->getDeallocate() &&
8759 "allocation and deallocation calls must already be built");
8760 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8761 if (AllocRes.isInvalid())
8763 Builder.Allocate = AllocRes.get();
8765 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8766 if (DeallocRes.isInvalid())
8768 Builder.Deallocate = DeallocRes.get();
8770 if (
auto *ResultDecl = S->getResultDecl()) {
8771 StmtResult Res = getDerived().TransformStmt(ResultDecl);
8772 if (Res.isInvalid())
8774 Builder.ResultDecl = Res.get();
8779 if (Res.isInvalid())
8781 Builder.ReturnStmt = Res.get();
8785 return getDerived().RebuildCoroutineBodyStmt(Builder);
8788template<
typename Derived>
8798 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(),
Result.get(),
8802template <
typename Derived>
8815 ExprResult Lookup = getSema().BuildOperatorCoawaitLookupExpr(
8816 getSema().getCurScope(), E->getKeywordLoc());
8820 return getDerived().RebuildCoawaitExpr(
8821 E->getKeywordLoc(),
Operand.get(),
8825template <
typename Derived>
8828 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8830 if (OperandResult.isInvalid())
8834 E->getOperatorCoawaitLookup());
8841 return getDerived().RebuildDependentCoawaitExpr(
8842 E->getKeywordLoc(), OperandResult.get(),
8846template<
typename Derived>
8856 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(),
Result.get());
8861template<
typename Derived>
8865 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8866 if (TryBody.isInvalid())
8870 bool AnyCatchChanged =
false;
8872 for (
unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8873 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8874 if (Catch.isInvalid())
8876 if (Catch.get() != S->getCatchStmt(I))
8877 AnyCatchChanged =
true;
8878 CatchStmts.push_back(Catch.get());
8883 if (S->getFinallyStmt()) {
8884 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8885 if (Finally.isInvalid())
8890 if (!getDerived().AlwaysRebuild() &&
8891 TryBody.get() == S->getTryBody() &&
8893 Finally.get() == S->getFinallyStmt())
8897 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8898 CatchStmts, Finally.get());
8901template<
typename Derived>
8906 if (
VarDecl *FromVar = S->getCatchParamDecl()) {
8908 if (FromVar->getTypeSourceInfo()) {
8909 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8916 T = TSInfo->getType();
8918 T = getDerived().TransformType(FromVar->getType());
8923 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo,
T);
8928 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8929 if (Body.isInvalid())
8932 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8937template<
typename Derived>
8941 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8942 if (Body.isInvalid())
8946 if (!getDerived().AlwaysRebuild() &&
8947 Body.get() == S->getFinallyBody())
8951 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8955template<
typename Derived>
8959 if (S->getThrowExpr()) {
8960 Operand = getDerived().TransformExpr(S->getThrowExpr());
8965 if (!getDerived().AlwaysRebuild() &&
8966 Operand.get() == S->getThrowExpr())
8969 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(),
Operand.get());
8972template<
typename Derived>
8981 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8987 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8988 if (Body.isInvalid())
8992 if (!getDerived().AlwaysRebuild() &&
8993 Object.get() == S->getSynchExpr() &&
8994 Body.get() == S->getSynchBody())
8998 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8999 Object.get(), Body.get());
9002template<
typename Derived>
9007 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
9008 if (Body.isInvalid())
9012 if (!getDerived().AlwaysRebuild() &&
9013 Body.get() == S->getSubStmt())
9017 return getDerived().RebuildObjCAutoreleasePoolStmt(
9018 S->getAtLoc(), Body.get());
9021template<
typename Derived>
9026 StmtResult Element = getDerived().TransformStmt(
9027 S->getElement(), StmtDiscardKind::NotDiscarded);
9028 if (Element.isInvalid())
9032 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9033 if (Collection.isInvalid())
9037 StmtResult Body = getDerived().TransformStmt(S->getBody());
9038 if (Body.isInvalid())
9042 if (!getDerived().AlwaysRebuild() &&
9043 Element.get() == S->getElement() &&
9044 Collection.get() == S->getCollection() &&
9045 Body.get() == S->getBody())
9049 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9056template <
typename Derived>
9060 if (
VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9062 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9066 Var = getDerived().RebuildExceptionDecl(
9067 ExceptionDecl,
T, ExceptionDecl->getInnerLocStart(),
9068 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9069 if (!Var || Var->isInvalidDecl())
9074 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9075 if (Handler.isInvalid())
9078 if (!getDerived().AlwaysRebuild() && !Var &&
9079 Handler.get() == S->getHandlerBlock())
9082 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9085template <
typename Derived>
9088 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9089 if (TryBlock.isInvalid())
9093 bool HandlerChanged =
false;
9095 for (
unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9096 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9097 if (Handler.isInvalid())
9100 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9101 Handlers.push_back(Handler.getAs<
Stmt>());
9104 getSema().DiagnoseExceptionUse(S->getTryLoc(),
true);
9106 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9110 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9114template<
typename Derived>
9125 auto &LastRecord = getSema().currentEvaluationContext();
9126 LastRecord.InLifetimeExtendingContext =
true;
9127 LastRecord.RebuildDefaultArgOrDefaultInit =
true;
9130 S->getInit() ? getDerived().TransformStmt(S->getInit()) :
StmtResult();
9131 if (
Init.isInvalid())
9135 if (
Range.isInvalid())
9140 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps.empty());
9141 auto ForRangeLifetimeExtendTemps =
9142 getSema().ExprEvalContexts.back().ForRangeLifetimeExtendTemps;
9144 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9145 if (Begin.isInvalid())
9147 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9148 if (End.isInvalid())
9152 if (
Cond.isInvalid())
9156 if (
Cond.isInvalid())
9162 if (
Inc.isInvalid())
9167 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9168 if (LoopVar.isInvalid())
9172 if (getDerived().AlwaysRebuild() ||
9173 Init.get() != S->getInit() ||
9174 Range.get() != S->getRangeStmt() ||
9175 Begin.get() != S->getBeginStmt() ||
9176 End.get() != S->getEndStmt() ||
9177 Cond.get() != S->getCond() ||
9178 Inc.get() != S->getInc() ||
9179 LoopVar.get() != S->getLoopVarStmt()) {
9180 NewStmt = getDerived().RebuildCXXForRangeStmt(
9181 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9182 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9183 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9184 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9186 getSema().ActOnInitializerError(
9197 StmtResult Body = getDerived().TransformStmt(S->getBody());
9198 if (Body.isInvalid())
9205 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9206 NewStmt = getDerived().RebuildCXXForRangeStmt(
9207 S->getForLoc(), S->getCoawaitLoc(),
Init.get(), S->getColonLoc(),
9208 Range.get(), Begin.get(), End.get(),
Cond.get(),
Inc.get(),
9209 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9210 if (NewStmt.isInvalid())
9214 if (NewStmt.get() == S)
9217 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
9220template<
typename Derived>
9226 if (S->getQualifierLoc()) {
9228 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9235 if (NameInfo.getName()) {
9236 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9237 if (!NameInfo.getName())
9242 if (!getDerived().AlwaysRebuild() &&
9243 QualifierLoc == S->getQualifierLoc() &&
9244 NameInfo.getName() == S->getNameInfo().getName())
9249 SS.
Adopt(QualifierLoc);
9251 switch (getSema().CheckMicrosoftIfExistsSymbol(
nullptr, SS, NameInfo)) {
9253 if (S->isIfExists())
9256 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9259 if (S->isIfNotExists())
9262 return new (getSema().Context)
NullStmt(S->getKeywordLoc());
9273 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9274 if (SubStmt.isInvalid())
9282 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9289template<
typename Derived>
9293 if (E->getQualifierLoc()) {
9295 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9301 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9306 if (
Base.isInvalid())
9312 QualifierLoc, E->getMemberLoc());
9315template <
typename Derived>
9319 if (BaseRes.isInvalid())
9321 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9322 if (IdxRes.isInvalid())
9325 if (!getDerived().AlwaysRebuild() &&
9326 BaseRes.get() == E->getBase() &&
9327 IdxRes.get() == E->getIdx())
9330 return getDerived().RebuildArraySubscriptExpr(
9331 BaseRes.get(),
SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9334template <
typename Derived>
9336 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9337 if (TryBlock.isInvalid())
9340 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9341 if (Handler.isInvalid())
9344 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9345 Handler.get() == S->getHandler())
9348 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9349 TryBlock.get(), Handler.get());
9352template <
typename Derived>
9355 if (
Block.isInvalid())
9358 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(),
Block.get());
9361template <
typename Derived>
9363 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9364 if (FilterExpr.isInvalid())
9368 if (
Block.isInvalid())
9371 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9375template <
typename Derived>
9383template<
typename Derived>
9393template <
typename Derived>
9395TreeTransform<Derived>::TransformOMPCanonicalLoop(OMPCanonicalLoop *L) {
9399 return getDerived().TransformStmt(L->getLoopStmt());
9402template <
typename Derived>
9409 TClauses.reserve(Clauses.size());
9413 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9415 getDerived().getSema().OpenMP().EndOpenMPClause();
9417 TClauses.push_back(Clause);
9419 TClauses.push_back(
nullptr);
9423 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9424 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9425 D->getDirectiveKind(),
9431 if (D->getDirectiveKind() == OMPD_atomic ||
9432 D->getDirectiveKind() == OMPD_critical ||
9433 D->getDirectiveKind() == OMPD_section ||
9434 D->getDirectiveKind() == OMPD_master)
9435 CS = D->getAssociatedStmt();
9437 CS = D->getRawStmt();
9440 getSema().getLangOpts().OpenMPIRBuilder)
9444 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9449 if (TClauses.size() != Clauses.size()) {
9455 if (D->getDirectiveKind() == OMPD_critical) {
9457 DirName =
getDerived().TransformDeclarationNameInfo(DirName);
9460 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9462 }
else if (D->getDirectiveKind() == OMPD_cancel) {
9466 return getDerived().RebuildOMPExecutableDirective(
9467 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9468 AssociatedStmt.
get(), D->getBeginLoc(), D->getEndLoc());
9476template <
typename Derived>
9483 TClauses.reserve(Clauses.size());
9486 getDerived().getSema().OpenMP().StartOpenMPClause(
C->getClauseKind());
9488 getDerived().getSema().OpenMP().EndOpenMPClause();
9490 TClauses.push_back(Clause);
9492 TClauses.push_back(
nullptr);
9496 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9497 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9498 D->getDirectiveKind(),
9503 assert(D->getDirectiveKind() == OMPD_assume &&
9504 "Unexpected informational directive");
9505 Stmt *CS = D->getAssociatedStmt();
9509 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9513 if (TClauses.size() != Clauses.size())
9518 return getDerived().RebuildOMPInformationalDirective(
9519 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.
get(),
9520 D->getBeginLoc(), D->getEndLoc());
9523template <
typename Derived>
9528 SemaRef.
Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9529 << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion);
9533template <
typename Derived>
9535TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
9536 DeclarationNameInfo DirName;
9537 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9538 OMPD_parallel, DirName,
nullptr, D->getBeginLoc());
9539 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9540 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9544template <
typename Derived>
9548 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9549 OMPD_simd, DirName,
nullptr, D->getBeginLoc());
9550 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9551 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9555template <
typename Derived>
9559 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9560 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9561 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9562 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9566template <
typename Derived>
9570 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9571 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9572 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9573 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9577template <
typename Derived>
9581 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9582 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9583 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9584 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9588template <
typename Derived>
9592 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9593 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9594 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9595 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9599template <
typename Derived>
9601 OMPInterchangeDirective *D) {
9603 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9604 D->getDirectiveKind(), DirName,
nullptr, D->getBeginLoc());
9605 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9606 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9610template <
typename Derived>
9614 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9615 OMPD_for, DirName,
nullptr, D->getBeginLoc());
9616 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9617 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9621template <
typename Derived>
9625 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9626 OMPD_for_simd, DirName,
nullptr, D->getBeginLoc());
9627 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9628 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9632template <
typename Derived>
9636 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9637 OMPD_sections, DirName,
nullptr, D->getBeginLoc());
9638 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9639 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9643template <
typename Derived>
9647 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9648 OMPD_section, DirName,
nullptr, D->getBeginLoc());
9649 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9650 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9654template <
typename Derived>
9658 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9659 OMPD_scope, DirName,
nullptr, D->getBeginLoc());
9660 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9661 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9665template <
typename Derived>
9669 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9670 OMPD_single, DirName,
nullptr, D->getBeginLoc());
9671 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9672 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9676template <
typename Derived>
9680 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9681 OMPD_master, DirName,
nullptr, D->getBeginLoc());
9682 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9683 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9687template <
typename Derived>
9691 OMPD_critical, D->getDirectiveName(),
nullptr, D->getBeginLoc());
9692 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9693 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9697template <
typename Derived>
9699 OMPParallelForDirective *D) {
9701 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9702 OMPD_parallel_for, DirName,
nullptr, D->getBeginLoc());
9703 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9704 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9708template <
typename Derived>
9710 OMPParallelForSimdDirective *D) {
9712 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9713 OMPD_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
9714 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9715 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9719template <
typename Derived>
9721 OMPParallelMasterDirective *D) {
9723 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9724 OMPD_parallel_master, DirName,
nullptr, D->getBeginLoc());
9725 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9726 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9730template <
typename Derived>
9732 OMPParallelMaskedDirective *D) {
9734 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9735 OMPD_parallel_masked, DirName,
nullptr, D->getBeginLoc());
9736 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9737 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9741template <
typename Derived>
9743 OMPParallelSectionsDirective *D) {
9745 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9746 OMPD_parallel_sections, DirName,
nullptr, D->getBeginLoc());
9747 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9748 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9752template <
typename Derived>
9756 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9757 OMPD_task, DirName,
nullptr, D->getBeginLoc());
9758 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9759 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9763template <
typename Derived>
9765 OMPTaskyieldDirective *D) {
9767 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9768 OMPD_taskyield, DirName,
nullptr, D->getBeginLoc());
9769 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9770 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9774template <
typename Derived>
9778 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9779 OMPD_barrier, DirName,
nullptr, D->getBeginLoc());
9780 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9781 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9785template <
typename Derived>
9789 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9790 OMPD_taskwait, DirName,
nullptr, D->getBeginLoc());
9791 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9792 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9796template <
typename Derived>
9800 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9801 OMPD_assume, DirName,
nullptr, D->getBeginLoc());
9802 StmtResult Res = getDerived().TransformOMPInformationalDirective(D);
9803 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9807template <
typename Derived>
9811 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9812 OMPD_error, DirName,
nullptr, D->getBeginLoc());
9813 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9814 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9818template <
typename Derived>
9820 OMPTaskgroupDirective *D) {
9822 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9823 OMPD_taskgroup, DirName,
nullptr, D->getBeginLoc());
9824 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9825 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9829template <
typename Derived>
9833 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9834 OMPD_flush, DirName,
nullptr, D->getBeginLoc());
9835 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9836 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9840template <
typename Derived>
9844 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9845 OMPD_depobj, DirName,
nullptr, D->getBeginLoc());
9846 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9847 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9851template <
typename Derived>
9855 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9856 OMPD_scan, DirName,
nullptr, D->getBeginLoc());
9857 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9858 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9862template <
typename Derived>
9866 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9867 OMPD_ordered, DirName,
nullptr, D->getBeginLoc());
9868 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9869 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9873template <
typename Derived>
9877 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9878 OMPD_atomic, DirName,
nullptr, D->getBeginLoc());
9879 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9880 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9884template <
typename Derived>
9888 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9889 OMPD_target, DirName,
nullptr, D->getBeginLoc());
9890 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9891 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9895template <
typename Derived>
9897 OMPTargetDataDirective *D) {
9899 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9900 OMPD_target_data, DirName,
nullptr, D->getBeginLoc());
9901 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9902 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9906template <
typename Derived>
9908 OMPTargetEnterDataDirective *D) {
9910 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9911 OMPD_target_enter_data, DirName,
nullptr, D->getBeginLoc());
9912 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9913 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9917template <
typename Derived>
9919 OMPTargetExitDataDirective *D) {
9921 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9922 OMPD_target_exit_data, DirName,
nullptr, D->getBeginLoc());
9923 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9924 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9928template <
typename Derived>
9930 OMPTargetParallelDirective *D) {
9932 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9933 OMPD_target_parallel, DirName,
nullptr, D->getBeginLoc());
9934 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9935 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9939template <
typename Derived>
9941 OMPTargetParallelForDirective *D) {
9943 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9944 OMPD_target_parallel_for, DirName,
nullptr, D->getBeginLoc());
9945 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9946 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9950template <
typename Derived>
9952 OMPTargetUpdateDirective *D) {
9954 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9955 OMPD_target_update, DirName,
nullptr, D->getBeginLoc());
9956 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9957 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9961template <
typename Derived>
9965 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9966 OMPD_teams, DirName,
nullptr, D->getBeginLoc());
9967 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9968 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9972template <
typename Derived>
9974 OMPCancellationPointDirective *D) {
9976 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9977 OMPD_cancellation_point, DirName,
nullptr, D->getBeginLoc());
9978 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9979 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9983template <
typename Derived>
9987 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9988 OMPD_cancel, DirName,
nullptr, D->getBeginLoc());
9989 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
9990 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9994template <
typename Derived>
9998 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9999 OMPD_taskloop, DirName,
nullptr, D->getBeginLoc());
10000 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10001 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10005template <
typename Derived>
10007 OMPTaskLoopSimdDirective *D) {
10009 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10010 OMPD_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10011 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10012 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10016template <
typename Derived>
10018 OMPMasterTaskLoopDirective *D) {
10020 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10021 OMPD_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10022 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10023 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10027template <
typename Derived>
10029 OMPMaskedTaskLoopDirective *D) {
10031 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10032 OMPD_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10033 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10034 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10038template <
typename Derived>
10040 OMPMasterTaskLoopSimdDirective *D) {
10042 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10043 OMPD_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10044 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10045 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10049template <
typename Derived>
10051 OMPMaskedTaskLoopSimdDirective *D) {
10053 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10054 OMPD_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10055 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10056 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10060template <
typename Derived>
10062 OMPParallelMasterTaskLoopDirective *D) {
10064 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10065 OMPD_parallel_master_taskloop, DirName,
nullptr, D->getBeginLoc());
10066 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10067 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10071template <
typename Derived>
10073 OMPParallelMaskedTaskLoopDirective *D) {
10075 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10076 OMPD_parallel_masked_taskloop, DirName,
nullptr, D->getBeginLoc());
10077 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10078 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10082template <
typename Derived>
10085 OMPParallelMasterTaskLoopSimdDirective *D) {
10087 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10088 OMPD_parallel_master_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10089 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10090 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10094template <
typename Derived>
10097 OMPParallelMaskedTaskLoopSimdDirective *D) {
10099 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10100 OMPD_parallel_masked_taskloop_simd, DirName,
nullptr, D->getBeginLoc());
10101 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10102 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10106template <
typename Derived>
10108 OMPDistributeDirective *D) {
10110 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10111 OMPD_distribute, DirName,
nullptr, D->getBeginLoc());
10112 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10113 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10117template <
typename Derived>
10119 OMPDistributeParallelForDirective *D) {
10121 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10122 OMPD_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10123 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10124 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10128template <
typename Derived>
10131 OMPDistributeParallelForSimdDirective *D) {
10133 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10134 OMPD_distribute_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10135 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10136 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10140template <
typename Derived>
10142 OMPDistributeSimdDirective *D) {
10144 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10145 OMPD_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10146 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10147 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10151template <
typename Derived>
10153 OMPTargetParallelForSimdDirective *D) {
10155 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10156 OMPD_target_parallel_for_simd, DirName,
nullptr, D->getBeginLoc());
10157 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10158 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10162template <
typename Derived>
10164 OMPTargetSimdDirective *D) {
10166 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10167 OMPD_target_simd, DirName,
nullptr, D->getBeginLoc());
10168 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10169 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10173template <
typename Derived>
10175 OMPTeamsDistributeDirective *D) {
10177 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10178 OMPD_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10179 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10180 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10184template <
typename Derived>
10186 OMPTeamsDistributeSimdDirective *D) {
10188 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10189 OMPD_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10190 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10191 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10195template <
typename Derived>
10197 OMPTeamsDistributeParallelForSimdDirective *D) {
10199 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10200 OMPD_teams_distribute_parallel_for_simd, DirName,
nullptr,
10202 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10203 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10207template <
typename Derived>
10209 OMPTeamsDistributeParallelForDirective *D) {
10211 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10212 OMPD_teams_distribute_parallel_for, DirName,
nullptr, D->getBeginLoc());
10213 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10214 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10218template <
typename Derived>
10220 OMPTargetTeamsDirective *D) {
10222 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10223 OMPD_target_teams, DirName,
nullptr, D->getBeginLoc());
10224 auto Res = getDerived().TransformOMPExecutableDirective(D);
10225 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10229template <
typename Derived>
10231 OMPTargetTeamsDistributeDirective *D) {
10233 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10234 OMPD_target_teams_distribute, DirName,
nullptr, D->getBeginLoc());
10235 auto Res = getDerived().TransformOMPExecutableDirective(D);
10236 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10240template <
typename Derived>
10243 OMPTargetTeamsDistributeParallelForDirective *D) {
10245 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10246 OMPD_target_teams_distribute_parallel_for, DirName,
nullptr,
10248 auto Res = getDerived().TransformOMPExecutableDirective(D);
10249 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10253template <
typename Derived>
10256 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
10258 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10259 OMPD_target_teams_distribute_parallel_for_simd, DirName,
nullptr,
10261 auto Res = getDerived().TransformOMPExecutableDirective(D);
10262 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10266template <
typename Derived>
10269 OMPTargetTeamsDistributeSimdDirective *D) {
10271 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10272 OMPD_target_teams_distribute_simd, DirName,
nullptr, D->getBeginLoc());
10273 auto Res = getDerived().TransformOMPExecutableDirective(D);
10274 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10278template <
typename Derived>
10282 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10283 OMPD_interop, DirName,
nullptr, D->getBeginLoc());
10284 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10285 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10289template <
typename Derived>
10293 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10294 OMPD_dispatch, DirName,
nullptr, D->getBeginLoc());
10295 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10296 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10300template <
typename Derived>
10304 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10305 OMPD_masked, DirName,
nullptr, D->getBeginLoc());
10306 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10307 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10311template <
typename Derived>
10313 OMPGenericLoopDirective *D) {
10315 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10316 OMPD_loop, DirName,
nullptr, D->getBeginLoc());
10317 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10318 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10322template <
typename Derived>
10324 OMPTeamsGenericLoopDirective *D) {
10326 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10327 OMPD_teams_loop, DirName,
nullptr, D->getBeginLoc());
10328 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10329 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10333template <
typename Derived>
10335 OMPTargetTeamsGenericLoopDirective *D) {
10337 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10338 OMPD_target_teams_loop, DirName,
nullptr, D->getBeginLoc());
10339 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10340 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10344template <
typename Derived>
10346 OMPParallelGenericLoopDirective *D) {
10348 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10349 OMPD_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10350 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10351 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10355template <
typename Derived>
10358 OMPTargetParallelGenericLoopDirective *D) {
10360 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10361 OMPD_target_parallel_loop, DirName,
nullptr, D->getBeginLoc());
10362 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
10363 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10370template <
typename Derived>
10373 if (
Cond.isInvalid())
10375 return getDerived().RebuildOMPIfClause(
10376 C->getNameModifier(),
Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10377 C->getNameModifierLoc(),
C->getColonLoc(),
C->getEndLoc());
10380template <
typename Derived>
10383 if (
Cond.isInvalid())
10385 return getDerived().RebuildOMPFinalClause(
Cond.get(),
C->getBeginLoc(),
10386 C->getLParenLoc(),
C->getEndLoc());
10389template <
typename Derived>
10392 ExprResult NumThreads = getDerived().TransformExpr(
C->getNumThreads());
10393 if (NumThreads.isInvalid())
10395 return getDerived().RebuildOMPNumThreadsClause(
10396 C->getModifier(), NumThreads.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10397 C->getModifierLoc(),
C->getEndLoc());
10400template <
typename Derived>
10403 ExprResult E = getDerived().TransformExpr(
C->getSafelen());
10406 return getDerived().RebuildOMPSafelenClause(
10407 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10410template <
typename Derived>
10413 ExprResult E = getDerived().TransformExpr(
C->getAllocator());
10416 return getDerived().RebuildOMPAllocatorClause(
10417 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10420template <
typename Derived>
10423 ExprResult E = getDerived().TransformExpr(
C->getSimdlen());
10426 return getDerived().RebuildOMPSimdlenClause(
10427 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10430template <
typename Derived>
10433 TransformedSizes.reserve(
C->getNumSizes());
10435 for (
Expr *E :
C->getSizesRefs()) {
10437 TransformedSizes.push_back(
nullptr);
10446 TransformedSizes.push_back(
T.get());
10449 if (!Changed && !getDerived().AlwaysRebuild())
10451 return RebuildOMPSizesClause(TransformedSizes,
C->getBeginLoc(),
10452 C->getLParenLoc(),
C->getEndLoc());
10455template <
typename Derived>
10459 TransformedArgs.reserve(
C->getNumLoops());
10461 for (
Expr *E :
C->getArgsRefs()) {
10463 TransformedArgs.push_back(
nullptr);
10472 TransformedArgs.push_back(
T.get());
10475 if (!Changed && !getDerived().AlwaysRebuild())
10477 return RebuildOMPPermutationClause(TransformedArgs,
C->getBeginLoc(),
10478 C->getLParenLoc(),
C->getEndLoc());
10481template <
typename Derived>
10483 if (!getDerived().AlwaysRebuild())
10485 return RebuildOMPFullClause(
C->getBeginLoc(),
C->getEndLoc());
10488template <
typename Derived>
10491 ExprResult T = getDerived().TransformExpr(
C->getFactor());
10494 Expr *Factor =
T.get();
10495 bool Changed = Factor !=
C->getFactor();
10497 if (!Changed && !getDerived().AlwaysRebuild())
10499 return RebuildOMPPartialClause(Factor,
C->getBeginLoc(),
C->getLParenLoc(),
10503template <
typename Derived>
10506 ExprResult E = getDerived().TransformExpr(
C->getNumForLoops());
10509 return getDerived().RebuildOMPCollapseClause(
10510 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10513template <
typename Derived>
10517 C->getDefaultKind(),
C->getDefaultKindKwLoc(),
C->getDefaultVC(),
10518 C->getDefaultVCLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
10522template <
typename Derived>
10526 C->getProcBindKind(),
C->getProcBindKindKwLoc(),
C->getBeginLoc(),
10527 C->getLParenLoc(),
C->getEndLoc());
10530template <
typename Derived>
10533 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
10536 return getDerived().RebuildOMPScheduleClause(
10537 C->getFirstScheduleModifier(),
C->getSecondScheduleModifier(),
10538 C->getScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
10539 C->getFirstScheduleModifierLoc(),
C->getSecondScheduleModifierLoc(),
10540 C->getScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
10543template <
typename Derived>
10547 if (
auto *
Num =
C->getNumForLoops()) {
10548 E = getDerived().TransformExpr(
Num);
10552 return getDerived().RebuildOMPOrderedClause(
C->getBeginLoc(),
C->getEndLoc(),
10553 C->getLParenLoc(), E.get());
10556template <
typename Derived>
10560 if (
Expr *Evt =
C->getEventHandler()) {
10561 E = getDerived().TransformExpr(Evt);
10565 return getDerived().RebuildOMPDetachClause(E.get(),
C->getBeginLoc(),
10566 C->getLParenLoc(),
C->getEndLoc());
10569template <
typename Derived>
10576template <
typename Derived>
10583template <
typename Derived>
10590template <
typename Derived>
10596template <
typename Derived>
10602template <
typename Derived>
10609template <
typename Derived>
10616template <
typename Derived>
10623template <
typename Derived>
10629template <
typename Derived>
10635template <
typename Derived>
10637 ExprResult E = getDerived().TransformExpr(
C->getExpr());
10640 return getDerived().RebuildOMPHoldsClause(E.get(),
C->getBeginLoc(),
10641 C->getLParenLoc(),
C->getEndLoc());
10644template <
typename Derived>
10650template <
typename Derived>
10655template <
typename Derived>
10660template <
typename Derived>
10665template <
typename Derived>
10671template <
typename Derived>
10678template <
typename Derived>
10685template <
typename Derived>
10692template <
typename Derived>
10699template <
typename Derived>
10706template <
typename Derived>
10712template <
typename Derived>
10719template <
typename Derived>
10725template <
typename Derived>
10732template <
typename Derived>
10734 ExprResult IVR = getDerived().TransformExpr(
C->getInteropVar());
10735 if (IVR.isInvalid())
10739 InteropInfo.PreferTypes.reserve(
C->varlist_size() - 1);
10740 for (
Expr *E : llvm::drop_begin(
C->varlist())) {
10742 if (ER.isInvalid())
10744 InteropInfo.PreferTypes.push_back(ER.get());
10746 return getDerived().RebuildOMPInitClause(IVR.get(), InteropInfo,
10747 C->getBeginLoc(),
C->getLParenLoc(),
10748 C->getVarLoc(),
C->getEndLoc());
10751template <
typename Derived>
10753 ExprResult ER = getDerived().TransformExpr(
C->getInteropVar());
10754 if (ER.isInvalid())
10756 return getDerived().RebuildOMPUseClause(ER.get(),
C->getBeginLoc(),
10757 C->getLParenLoc(),
C->getVarLoc(),
10761template <
typename Derived>
10765 if (
Expr *IV =
C->getInteropVar()) {
10766 ER = getDerived().TransformExpr(IV);
10767 if (ER.isInvalid())
10770 return getDerived().RebuildOMPDestroyClause(ER.get(),
C->getBeginLoc(),
10771 C->getLParenLoc(),
C->getVarLoc(),
10775template <
typename Derived>
10779 if (
Cond.isInvalid())
10781 return getDerived().RebuildOMPNovariantsClause(
10782 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10785template <
typename Derived>
10789 if (
Cond.isInvalid())
10791 return getDerived().RebuildOMPNocontextClause(
10792 Cond.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10795template <
typename Derived>
10798 ExprResult ThreadID = getDerived().TransformExpr(
C->getThreadID());
10799 if (ThreadID.isInvalid())
10801 return getDerived().RebuildOMPFilterClause(ThreadID.get(),
C->getBeginLoc(),
10802 C->getLParenLoc(),
C->getEndLoc());
10805template <
typename Derived>
10807 ExprResult E = getDerived().TransformExpr(
C->getAlignment());
10810 return getDerived().RebuildOMPAlignClause(E.get(),
C->getBeginLoc(),
10811 C->getLParenLoc(),
C->getEndLoc());
10814template <
typename Derived>
10817 llvm_unreachable(
"unified_address clause cannot appear in dependent context");
10820template <
typename Derived>
10824 "unified_shared_memory clause cannot appear in dependent context");
10827template <
typename Derived>
10830 llvm_unreachable(
"reverse_offload clause cannot appear in dependent context");
10833template <
typename Derived>
10837 "dynamic_allocators clause cannot appear in dependent context");
10840template <
typename Derived>
10844 "atomic_default_mem_order clause cannot appear in dependent context");
10847template <
typename Derived>
10850 llvm_unreachable(
"self_maps clause cannot appear in dependent context");
10853template <
typename Derived>
10856 C->getBeginLoc(),
C->getLParenLoc(),
10860template <
typename Derived>
10864 C->getSeverityKind(),
C->getSeverityKindKwLoc(),
C->getBeginLoc(),
10865 C->getLParenLoc(),
C->getEndLoc());
10868template <
typename Derived>
10871 ExprResult E = getDerived().TransformExpr(
C->getMessageString());
10874 return getDerived().RebuildOMPMessageClause(
10875 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10878template <
typename Derived>
10882 Vars.reserve(
C->varlist_size());
10883 for (
auto *
VE :
C->varlist()) {
10885 if (EVar.isInvalid())
10887 Vars.push_back(EVar.get());
10889 return getDerived().RebuildOMPPrivateClause(
10890 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10893template <
typename Derived>
10897 Vars.reserve(
C->varlist_size());
10898 for (
auto *
VE :
C->varlist()) {
10900 if (EVar.isInvalid())
10902 Vars.push_back(EVar.get());
10904 return getDerived().RebuildOMPFirstprivateClause(
10905 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
10908template <
typename Derived>
10912 Vars.reserve(
C->varlist_size());
10913 for (
auto *
VE :
C->varlist()) {
10915 if (EVar.isInvalid())
10917 Vars.push_back(EVar.get());
10919 return getDerived().RebuildOMPLastprivateClause(
10920 Vars,
C->getKind(),
C->getKindLoc(),
C->getColonLoc(),
C->getBeginLoc(),
10921 C->getLParenLoc(),
C->getEndLoc());
10924template <
typename Derived>
10928 Vars.reserve(
C->varlist_size());
10929 for (
auto *
VE :
C->varlist()) {
10931 if (EVar.isInvalid())
10933 Vars.push_back(EVar.get());
10935 return getDerived().RebuildOMPSharedClause(Vars,
C->getBeginLoc(),
10936 C->getLParenLoc(),
C->getEndLoc());
10939template <
typename Derived>
10943 Vars.reserve(
C->varlist_size());
10944 for (
auto *
VE :
C->varlist()) {
10946 if (EVar.isInvalid())
10948 Vars.push_back(EVar.get());
10951 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
10954 if (NameInfo.getName()) {
10955 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
10956 if (!NameInfo.getName())
10962 for (
auto *E :
C->reduction_ops()) {
10967 for (
auto *D : ULE->decls()) {
10970 Decls.addDecl(InstD, InstD->getAccess());
10974 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
10975 true, Decls.begin(), Decls.end(),
10978 UnresolvedReductions.push_back(
nullptr);
10980 return getDerived().RebuildOMPReductionClause(
10981 Vars,
C->getModifier(),
C->getOriginalSharingModifier(),
C->getBeginLoc(),
10982 C->getLParenLoc(),
C->getModifierLoc(),
C->getColonLoc(),
C->getEndLoc(),
10983 ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10986template <
typename Derived>
10990 Vars.reserve(
C->varlist_size());
10991 for (
auto *
VE :
C->varlist()) {
10993 if (EVar.isInvalid())
10995 Vars.push_back(EVar.get());
10998 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11001 if (NameInfo.getName()) {
11002 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11003 if (!NameInfo.getName())
11009 for (
auto *E :
C->reduction_ops()) {
11014 for (
auto *D : ULE->decls()) {
11017 Decls.addDecl(InstD, InstD->getAccess());
11021 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11022 true, Decls.begin(), Decls.end(),
11025 UnresolvedReductions.push_back(
nullptr);
11027 return getDerived().RebuildOMPTaskReductionClause(
11028 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11029 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11032template <
typename Derived>
11036 Vars.reserve(
C->varlist_size());
11037 for (
auto *
VE :
C->varlist()) {
11039 if (EVar.isInvalid())
11041 Vars.push_back(EVar.get());
11044 ReductionIdScopeSpec.
Adopt(
C->getQualifierLoc());
11047 if (NameInfo.getName()) {
11048 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
11049 if (!NameInfo.getName())
11055 for (
auto *E :
C->reduction_ops()) {
11060 for (
auto *D : ULE->decls()) {
11063 Decls.addDecl(InstD, InstD->getAccess());
11067 ReductionIdScopeSpec.getWithLocInContext(SemaRef.
Context), NameInfo,
11068 true, Decls.begin(), Decls.end(),
11071 UnresolvedReductions.push_back(
nullptr);
11073 return getDerived().RebuildOMPInReductionClause(
11074 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
11075 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11078template <
typename Derived>
11082 Vars.reserve(
C->varlist_size());
11083 for (
auto *
VE :
C->varlist()) {
11085 if (EVar.isInvalid())
11087 Vars.push_back(EVar.get());
11089 ExprResult Step = getDerived().TransformExpr(
C->getStep());
11090 if (Step.isInvalid())
11092 return getDerived().RebuildOMPLinearClause(
11093 Vars, Step.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getModifier(),
11094 C->getModifierLoc(),
C->getColonLoc(),
C->getStepModifierLoc(),
11098template <
typename Derived>
11102 Vars.reserve(
C->varlist_size());
11103 for (
auto *
VE :
C->varlist()) {
11105 if (EVar.isInvalid())
11107 Vars.push_back(EVar.get());
11109 ExprResult Alignment = getDerived().TransformExpr(
C->getAlignment());
11110 if (Alignment.isInvalid())
11112 return getDerived().RebuildOMPAlignedClause(
11113 Vars, Alignment.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11114 C->getColonLoc(),
C->getEndLoc());
11117template <
typename Derived>
11121 Vars.reserve(
C->varlist_size());
11122 for (
auto *
VE :
C->varlist()) {
11124 if (EVar.isInvalid())
11126 Vars.push_back(EVar.get());
11128 return getDerived().RebuildOMPCopyinClause(Vars,
C->getBeginLoc(),
11129 C->getLParenLoc(),
C->getEndLoc());
11132template <
typename Derived>
11136 Vars.reserve(
C->varlist_size());
11137 for (
auto *
VE :
C->varlist()) {
11139 if (EVar.isInvalid())
11141 Vars.push_back(EVar.get());
11143 return getDerived().RebuildOMPCopyprivateClause(
11144 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11147template <
typename Derived>
11150 Vars.reserve(
C->varlist_size());
11151 for (
auto *
VE :
C->varlist()) {
11153 if (EVar.isInvalid())
11155 Vars.push_back(EVar.get());
11157 return getDerived().RebuildOMPFlushClause(Vars,
C->getBeginLoc(),
11158 C->getLParenLoc(),
C->getEndLoc());
11161template <
typename Derived>
11164 ExprResult E = getDerived().TransformExpr(
C->getDepobj());
11167 return getDerived().RebuildOMPDepobjClause(E.get(),
C->getBeginLoc(),
11168 C->getLParenLoc(),
C->getEndLoc());
11171template <
typename Derived>
11175 Expr *DepModifier =
C->getModifier();
11177 ExprResult DepModRes = getDerived().TransformExpr(DepModifier);
11178 if (DepModRes.isInvalid())
11180 DepModifier = DepModRes.get();
11182 Vars.reserve(
C->varlist_size());
11183 for (
auto *
VE :
C->varlist()) {
11185 if (EVar.isInvalid())
11187 Vars.push_back(EVar.get());
11189 return getDerived().RebuildOMPDependClause(
11190 {
C->getDependencyKind(),
C->getDependencyLoc(),
C->getColonLoc(),
11191 C->getOmpAllMemoryLoc()},
11192 DepModifier, Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11195template <
typename Derived>
11198 ExprResult E = getDerived().TransformExpr(
C->getDevice());
11201 return getDerived().RebuildOMPDeviceClause(
11202 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11203 C->getModifierLoc(),
C->getEndLoc());
11206template <
typename Derived,
class T>
11213 Vars.reserve(
C->varlist_size());
11214 for (
auto *
VE :
C->varlist()) {
11218 Vars.push_back(EVar.
get());
11222 if (
C->getMapperQualifierLoc()) {
11223 QualifierLoc = TT.
getDerived().TransformNestedNameSpecifierLoc(
11224 C->getMapperQualifierLoc());
11228 MapperIdScopeSpec.
Adopt(QualifierLoc);
11229 MapperIdInfo =
C->getMapperIdInfo();
11230 if (MapperIdInfo.
getName()) {
11231 MapperIdInfo = TT.
getDerived().TransformDeclarationNameInfo(MapperIdInfo);
11237 for (
auto *E :
C->mapperlists()) {
11242 for (
auto *D : ULE->decls()) {
11245 Decls.addDecl(InstD, InstD->
getAccess());
11250 MapperIdInfo,
true, Decls.begin(), Decls.end(),
11253 UnresolvedMappers.push_back(
nullptr);
11259template <
typename Derived>
11260OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *
C) {
11261 OMPVarListLocTy Locs(
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11263 Expr *IteratorModifier =
C->getIteratorModifier();
11264 if (IteratorModifier) {
11265 ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
11266 if (MapModRes.isInvalid())
11268 IteratorModifier = MapModRes.
get();
11274 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11276 return getDerived().RebuildOMPMapClause(
11277 IteratorModifier,
C->getMapTypeModifiers(),
C->getMapTypeModifiersLoc(),
11278 MapperIdScopeSpec, MapperIdInfo,
C->getMapType(),
C->isImplicitMapType(),
11279 C->getMapLoc(),
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11282template <
typename Derived>
11285 Expr *Allocator =
C->getAllocator();
11287 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
11288 if (AllocatorRes.isInvalid())
11290 Allocator = AllocatorRes.get();
11292 Expr *Alignment =
C->getAlignment();
11294 ExprResult AlignmentRes = getDerived().TransformExpr(Alignment);
11295 if (AlignmentRes.isInvalid())
11297 Alignment = AlignmentRes.get();
11300 Vars.reserve(
C->varlist_size());
11301 for (
auto *
VE :
C->varlist()) {
11303 if (EVar.isInvalid())
11305 Vars.push_back(EVar.get());
11307 return getDerived().RebuildOMPAllocateClause(
11308 Allocator, Alignment,
C->getFirstAllocateModifier(),
11309 C->getFirstAllocateModifierLoc(),
C->getSecondAllocateModifier(),
11310 C->getSecondAllocateModifierLoc(), Vars,
C->getBeginLoc(),
11311 C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc());
11314template <
typename Derived>
11318 Vars.reserve(
C->varlist_size());
11319 for (
auto *
VE :
C->varlist()) {
11321 if (EVar.isInvalid())
11323 Vars.push_back(EVar.get());
11325 return getDerived().RebuildOMPNumTeamsClause(
11326 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11329template <
typename Derived>
11333 Vars.reserve(
C->varlist_size());
11334 for (
auto *
VE :
C->varlist()) {
11336 if (EVar.isInvalid())
11338 Vars.push_back(EVar.get());
11340 return getDerived().RebuildOMPThreadLimitClause(
11341 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11344template <
typename Derived>
11347 ExprResult E = getDerived().TransformExpr(
C->getPriority());
11350 return getDerived().RebuildOMPPriorityClause(
11351 E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11354template <
typename Derived>
11357 ExprResult E = getDerived().TransformExpr(
C->getGrainsize());
11360 return getDerived().RebuildOMPGrainsizeClause(
11361 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11362 C->getModifierLoc(),
C->getEndLoc());
11365template <
typename Derived>
11368 ExprResult E = getDerived().TransformExpr(
C->getNumTasks());
11371 return getDerived().RebuildOMPNumTasksClause(
11372 C->getModifier(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11373 C->getModifierLoc(),
C->getEndLoc());
11376template <
typename Derived>
11378 ExprResult E = getDerived().TransformExpr(
C->getHint());
11381 return getDerived().RebuildOMPHintClause(E.get(),
C->getBeginLoc(),
11382 C->getLParenLoc(),
C->getEndLoc());
11385template <
typename Derived>
11388 ExprResult E = getDerived().TransformExpr(
C->getChunkSize());
11391 return getDerived().RebuildOMPDistScheduleClause(
11392 C->getDistScheduleKind(), E.get(),
C->getBeginLoc(),
C->getLParenLoc(),
11393 C->getDistScheduleKindLoc(),
C->getCommaLoc(),
C->getEndLoc());
11396template <
typename Derived>
11402 C->getDefaultmapKind(),
11405 C->getDefaultmapModifierLoc(),
11406 C->getDefaultmapKindLoc(),
11410template <
typename Derived>
11418 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11420 return getDerived().RebuildOMPToClause(
11421 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11422 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11425template <
typename Derived>
11433 *
this,
C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
11435 return getDerived().RebuildOMPFromClause(
11436 C->getMotionModifiers(),
C->getMotionModifiersLoc(), MapperIdScopeSpec,
11437 MapperIdInfo,
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11440template <
typename Derived>
11444 Vars.reserve(
C->varlist_size());
11445 for (
auto *
VE :
C->varlist()) {
11447 if (EVar.isInvalid())
11449 Vars.push_back(EVar.get());
11452 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
11455template <
typename Derived>
11459 Vars.reserve(
C->varlist_size());
11460 for (
auto *
VE :
C->varlist()) {
11462 if (EVar.isInvalid())
11464 Vars.push_back(EVar.get());
11467 return getDerived().RebuildOMPUseDeviceAddrClause(Vars, Locs);
11470template <
typename Derived>
11474 Vars.reserve(
C->varlist_size());
11475 for (
auto *
VE :
C->varlist()) {
11477 if (EVar.isInvalid())
11479 Vars.push_back(EVar.get());
11482 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
11485template <
typename Derived>
11489 Vars.reserve(
C->varlist_size());
11490 for (
auto *
VE :
C->varlist()) {
11492 if (EVar.isInvalid())
11494 Vars.push_back(EVar.get());
11497 return getDerived().RebuildOMPHasDeviceAddrClause(Vars, Locs);
11500template <
typename Derived>
11504 Vars.reserve(
C->varlist_size());
11505 for (
auto *
VE :
C->varlist()) {
11507 if (EVar.isInvalid())
11509 Vars.push_back(EVar.get());
11511 return getDerived().RebuildOMPNontemporalClause(
11512 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11515template <
typename Derived>
11519 Vars.reserve(
C->varlist_size());
11520 for (
auto *
VE :
C->varlist()) {
11522 if (EVar.isInvalid())
11524 Vars.push_back(EVar.get());
11526 return getDerived().RebuildOMPInclusiveClause(
11527 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11530template <
typename Derived>
11534 Vars.reserve(
C->varlist_size());
11535 for (
auto *
VE :
C->varlist()) {
11537 if (EVar.isInvalid())
11539 Vars.push_back(EVar.get());
11541 return getDerived().RebuildOMPExclusiveClause(
11542 Vars,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11545template <
typename Derived>
11549 Data.reserve(
C->getNumberOfAllocators());
11550 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
11552 ExprResult Allocator = getDerived().TransformExpr(D.Allocator);
11553 if (Allocator.isInvalid())
11556 if (
Expr *AT = D.AllocatorTraits) {
11557 AllocatorTraits = getDerived().TransformExpr(AT);
11558 if (AllocatorTraits.isInvalid())
11562 NewD.Allocator = Allocator.get();
11563 NewD.AllocatorTraits = AllocatorTraits.get();
11564 NewD.LParenLoc = D.LParenLoc;
11565 NewD.RParenLoc = D.RParenLoc;
11567 return getDerived().RebuildOMPUsesAllocatorsClause(
11568 Data,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11571template <
typename Derived>
11575 Locators.reserve(
C->varlist_size());
11577 if (
Expr *Modifier =
C->getModifier()) {
11578 ModifierRes = getDerived().TransformExpr(Modifier);
11579 if (ModifierRes.isInvalid())
11582 for (
Expr *E :
C->varlist()) {
11583 ExprResult Locator = getDerived().TransformExpr(E);
11584 if (Locator.isInvalid())
11586 Locators.push_back(Locator.get());
11588 return getDerived().RebuildOMPAffinityClause(
11589 C->getBeginLoc(),
C->getLParenLoc(),
C->getColonLoc(),
C->getEndLoc(),
11590 ModifierRes.get(), Locators);
11593template <
typename Derived>
11596 C->getKind(),
C->getKindKwLoc(),
C->getBeginLoc(),
C->getLParenLoc(),
11597 C->getEndLoc(),
C->getModifier(),
C->getModifierKwLoc());
11600template <
typename Derived>
11603 C->getBindKind(),
C->getBindKindLoc(),
C->getBeginLoc(),
11604 C->getLParenLoc(),
C->getEndLoc());
11607template <
typename Derived>
11611 if (
Size.isInvalid())
11613 return getDerived().RebuildOMPXDynCGroupMemClause(
11614 Size.get(),
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11617template <
typename Derived>
11621 Vars.reserve(
C->varlist_size());
11622 for (
auto *
VE :
C->varlist()) {
11624 if (EVar.isInvalid())
11626 Vars.push_back(EVar.get());
11628 return getDerived().RebuildOMPDoacrossClause(
11629 C->getDependenceType(),
C->getDependenceLoc(),
C->getColonLoc(), Vars,
11630 C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11633template <
typename Derived>
11637 for (
auto *A :
C->getAttrs())
11638 NewAttrs.push_back(getDerived().TransformAttr(A));
11639 return getDerived().RebuildOMPXAttributeClause(
11640 NewAttrs,
C->getBeginLoc(),
C->getLParenLoc(),
C->getEndLoc());
11643template <
typename Derived>
11652template <
typename Derived>
11653class OpenACCClauseTransform final
11655 TreeTransform<Derived> &Self;
11656 ArrayRef<const OpenACCClause *> ExistingClauses;
11657 SemaOpenACC::OpenACCParsedClause &ParsedClause;
11658 OpenACCClause *NewClause =
nullptr;
11661 ExprResult Res = Self.TransformExpr(VarRef);
11663 if (!Res.isUsable())
11666 Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11667 ParsedClause.getClauseKind(),
11673 llvm::SmallVector<Expr *> VisitVarList(ArrayRef<Expr *> VarList) {
11674 llvm::SmallVector<Expr *> InstantiatedVarList;
11675 for (Expr *CurVar : VarList) {
11678 if (VarRef.isUsable())
11679 InstantiatedVarList.push_back(VarRef.get());
11682 return InstantiatedVarList;
11686 OpenACCClauseTransform(TreeTransform<Derived> &Self,
11687 ArrayRef<const OpenACCClause *> ExistingClauses,
11688 SemaOpenACC::OpenACCParsedClause &PC)
11689 : Self(Self), ExistingClauses(ExistingClauses), ParsedClause(PC) {}
11691 OpenACCClause *CreatedClause()
const {
return NewClause; }
11693#define VISIT_CLAUSE(CLAUSE_NAME) \
11694 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
11695#include "clang/Basic/OpenACCClauses.def"
11698template <
typename Derived>
11699void OpenACCClauseTransform<Derived>::VisitDefaultClause(
11701 ParsedClause.setDefaultDetails(
C.getDefaultClauseKind());
11704 Self.getSema().getASTContext(), ParsedClause.getDefaultClauseKind(),
11705 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11706 ParsedClause.getEndLoc());
11709template <
typename Derived>
11710void OpenACCClauseTransform<Derived>::VisitIfClause(
const OpenACCIfClause &
C) {
11712 assert(
Cond &&
"If constructed with invalid Condition");
11716 if (Res.isInvalid() || !Res.get().second)
11719 ParsedClause.setConditionDetails(Res.get().second);
11722 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11723 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11724 ParsedClause.getEndLoc());
11727template <
typename Derived>
11728void OpenACCClauseTransform<Derived>::VisitSelfClause(
11734 for (
Expr *CurVar :
C.getVarList()) {
11737 if (!Res.isUsable())
11740 Res =
Self.getSema().OpenACC().ActOnVar(ParsedClause.getDirectiveKind(),
11741 ParsedClause.getClauseKind(),
11744 if (Res.isUsable())
11745 InstantiatedVarList.push_back(Res.get());
11748 ParsedClause.setVarListDetails(InstantiatedVarList,
11752 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11753 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11754 ParsedClause.getEndLoc());
11757 if (
C.hasConditionExpr()) {
11760 Self.TransformCondition(
Cond->getExprLoc(),
nullptr,
Cond,
11763 if (Res.isInvalid() || !Res.get().second)
11766 ParsedClause.setConditionDetails(Res.get().second);
11770 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11771 ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(),
11772 ParsedClause.getEndLoc());
11776template <
typename Derived>
11777void OpenACCClauseTransform<Derived>::VisitNumGangsClause(
11781 for (
Expr *CurIntExpr :
C.getIntExprs()) {
11784 if (!Res.isUsable())
11789 C.getBeginLoc(), Res.get());
11790 if (!Res.isUsable())
11793 InstantiatedIntExprs.push_back(Res.get());
11796 ParsedClause.setIntExprDetails(InstantiatedIntExprs);
11798 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11799 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
11800 ParsedClause.getEndLoc());
11803template <
typename Derived>
11804void OpenACCClauseTransform<Derived>::VisitPrivateClause(
11809 for (
const auto [RefExpr, InitRecipe] :
11810 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11813 if (VarRef.isUsable()) {
11814 InstantiatedVarList.push_back(VarRef.get());
11818 if (InitRecipe.isSet())
11819 InitRecipes.push_back(InitRecipe);
11821 InitRecipes.push_back(
11822 Self.getSema().OpenACC().CreatePrivateInitRecipe(VarRef.get()));
11825 ParsedClause.setVarListDetails(InstantiatedVarList,
11829 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11830 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11831 ParsedClause.getEndLoc());
11834template <
typename Derived>
11835void OpenACCClauseTransform<Derived>::VisitHostClause(
11837 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11841 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11842 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11843 ParsedClause.getEndLoc());
11846template <
typename Derived>
11847void OpenACCClauseTransform<Derived>::VisitDeviceClause(
11849 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11853 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11854 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11855 ParsedClause.getEndLoc());
11858template <
typename Derived>
11859void OpenACCClauseTransform<Derived>::VisitFirstPrivateClause(
11864 for (
const auto [RefExpr, InitRecipe] :
11865 llvm::zip(
C.getVarList(),
C.getInitRecipes())) {
11868 if (VarRef.isUsable()) {
11869 InstantiatedVarList.push_back(VarRef.get());
11873 if (InitRecipe.isSet())
11874 InitRecipes.push_back(InitRecipe);
11876 InitRecipes.push_back(
11877 Self.getSema().OpenACC().CreateFirstPrivateInitRecipe(
11881 ParsedClause.setVarListDetails(InstantiatedVarList,
11885 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11886 ParsedClause.getLParenLoc(), ParsedClause.getVarList(), InitRecipes,
11887 ParsedClause.getEndLoc());
11890template <
typename Derived>
11891void OpenACCClauseTransform<Derived>::VisitNoCreateClause(
11893 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11897 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11898 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11899 ParsedClause.getEndLoc());
11902template <
typename Derived>
11903void OpenACCClauseTransform<Derived>::VisitPresentClause(
11905 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11909 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
11910 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
11911 ParsedClause.getEndLoc());
11914template <
typename Derived>
11915void OpenACCClauseTransform<Derived>::VisitCopyClause(
11917 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11918 C.getModifierList());
11921 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
11922 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11923 ParsedClause.getModifierList(), ParsedClause.getVarList(),
11924 ParsedClause.getEndLoc());
11927template <
typename Derived>
11928void OpenACCClauseTransform<Derived>::VisitLinkClause(
11930 llvm_unreachable(
"link clause not valid unless a decl transform");
11933template <
typename Derived>
11934void OpenACCClauseTransform<Derived>::VisitDeviceResidentClause(
11936 llvm_unreachable(
"device_resident clause not valid unless a decl transform");
11938template <
typename Derived>
11939void OpenACCClauseTransform<Derived>::VisitNoHostClause(
11941 llvm_unreachable(
"nohost clause not valid unless a decl transform");
11943template <
typename Derived>
11944void OpenACCClauseTransform<Derived>::VisitBindClause(
11946 llvm_unreachable(
"bind clause not valid unless a decl transform");
11949template <
typename Derived>
11950void OpenACCClauseTransform<Derived>::VisitCopyInClause(
11952 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11953 C.getModifierList());
11956 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
11957 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11958 ParsedClause.getModifierList(), ParsedClause.getVarList(),
11959 ParsedClause.getEndLoc());
11962template <
typename Derived>
11963void OpenACCClauseTransform<Derived>::VisitCopyOutClause(
11965 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11966 C.getModifierList());
11969 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
11970 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11971 ParsedClause.getModifierList(), ParsedClause.getVarList(),
11972 ParsedClause.getEndLoc());
11975template <
typename Derived>
11976void OpenACCClauseTransform<Derived>::VisitCreateClause(
11978 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
11979 C.getModifierList());
11982 Self.getSema().getASTContext(), ParsedClause.getClauseKind(),
11983 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
11984 ParsedClause.getModifierList(), ParsedClause.getVarList(),
11985 ParsedClause.getEndLoc());
11987template <
typename Derived>
11988void OpenACCClauseTransform<Derived>::VisitAttachClause(
11993 llvm::erase_if(VarList, [&](
Expr *E) {
11994 return Self.getSema().OpenACC().CheckVarIsPointerType(
12000 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12001 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12002 ParsedClause.getEndLoc());
12005template <
typename Derived>
12006void OpenACCClauseTransform<Derived>::VisitDetachClause(
12011 llvm::erase_if(VarList, [&](
Expr *E) {
12012 return Self.getSema().OpenACC().CheckVarIsPointerType(
12018 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12019 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12020 ParsedClause.getEndLoc());
12023template <
typename Derived>
12024void OpenACCClauseTransform<Derived>::VisitDeleteClause(
12026 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12029 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12030 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12031 ParsedClause.getEndLoc());
12034template <
typename Derived>
12035void OpenACCClauseTransform<Derived>::VisitUseDeviceClause(
12037 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
12040 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12041 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12042 ParsedClause.getEndLoc());
12045template <
typename Derived>
12046void OpenACCClauseTransform<Derived>::VisitDevicePtrClause(
12051 llvm::erase_if(VarList, [&](
Expr *E) {
12052 return Self.getSema().OpenACC().CheckVarIsPointerType(
12058 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12059 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
12060 ParsedClause.getEndLoc());
12063template <
typename Derived>
12064void OpenACCClauseTransform<Derived>::VisitNumWorkersClause(
12066 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12067 assert(IntExpr &&
"num_workers clause constructed with invalid int expr");
12070 if (!Res.isUsable())
12075 C.getBeginLoc(), Res.get());
12076 if (!Res.isUsable())
12079 ParsedClause.setIntExprDetails(Res.get());
12081 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12082 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12083 ParsedClause.getEndLoc());
12086template <
typename Derived>
12087void OpenACCClauseTransform<Derived>::VisitDeviceNumClause (
12089 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12090 assert(IntExpr &&
"device_num clause constructed with invalid int expr");
12093 if (!Res.isUsable())
12098 C.getBeginLoc(), Res.get());
12099 if (!Res.isUsable())
12102 ParsedClause.setIntExprDetails(Res.get());
12104 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12105 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12106 ParsedClause.getEndLoc());
12109template <
typename Derived>
12110void OpenACCClauseTransform<Derived>::VisitDefaultAsyncClause(
12112 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12113 assert(IntExpr &&
"default_async clause constructed with invalid int expr");
12116 if (!Res.isUsable())
12121 C.getBeginLoc(), Res.get());
12122 if (!Res.isUsable())
12125 ParsedClause.setIntExprDetails(Res.get());
12127 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12128 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12129 ParsedClause.getEndLoc());
12132template <
typename Derived>
12133void OpenACCClauseTransform<Derived>::VisitVectorLengthClause(
12135 Expr *IntExpr =
const_cast<Expr *
>(
C.getIntExpr());
12136 assert(IntExpr &&
"vector_length clause constructed with invalid int expr");
12139 if (!Res.isUsable())
12144 C.getBeginLoc(), Res.get());
12145 if (!Res.isUsable())
12148 ParsedClause.setIntExprDetails(Res.get());
12150 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12151 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs()[0],
12152 ParsedClause.getEndLoc());
12155template <
typename Derived>
12156void OpenACCClauseTransform<Derived>::VisitAsyncClause(
12158 if (
C.hasIntExpr()) {
12160 if (!Res.isUsable())
12165 C.getBeginLoc(), Res.get());
12166 if (!Res.isUsable())
12168 ParsedClause.setIntExprDetails(Res.get());
12172 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12173 ParsedClause.getLParenLoc(),
12174 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12176 ParsedClause.getEndLoc());
12179template <
typename Derived>
12180void OpenACCClauseTransform<Derived>::VisitWorkerClause(
12182 if (
C.hasIntExpr()) {
12187 if (!Res.isUsable())
12192 C.getBeginLoc(), Res.get());
12193 if (!Res.isUsable())
12195 ParsedClause.setIntExprDetails(Res.get());
12199 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12200 ParsedClause.getLParenLoc(),
12201 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12203 ParsedClause.getEndLoc());
12206template <
typename Derived>
12207void OpenACCClauseTransform<Derived>::VisitVectorClause(
12209 if (
C.hasIntExpr()) {
12214 if (!Res.isUsable())
12219 C.getBeginLoc(), Res.get());
12220 if (!Res.isUsable())
12222 ParsedClause.setIntExprDetails(Res.get());
12226 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12227 ParsedClause.getLParenLoc(),
12228 ParsedClause.getNumIntExprs() != 0 ? ParsedClause.getIntExprs()[0]
12230 ParsedClause.getEndLoc());
12233template <
typename Derived>
12234void OpenACCClauseTransform<Derived>::VisitWaitClause(
12236 if (
C.hasExprs()) {
12237 Expr *DevNumExpr =
nullptr;
12241 if (
C.getDevNumExpr()) {
12243 if (!Res.isUsable())
12247 C.getBeginLoc(), Res.get());
12248 if (!Res.isUsable())
12251 DevNumExpr = Res.get();
12255 for (
Expr *CurQueueIdExpr :
C.getQueueIdExprs()) {
12257 if (!Res.isUsable())
12261 C.getBeginLoc(), Res.get());
12262 if (!Res.isUsable())
12265 InstantiatedQueueIdExprs.push_back(Res.get());
12268 ParsedClause.setWaitDetails(DevNumExpr,
C.getQueuesLoc(),
12269 std::move(InstantiatedQueueIdExprs));
12273 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12274 ParsedClause.getLParenLoc(), ParsedClause.getDevNumExpr(),
12275 ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
12276 ParsedClause.getEndLoc());
12279template <
typename Derived>
12280void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
12284 Self.getSema().getASTContext(),
C.getClauseKind(),
12285 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12286 C.getArchitectures(), ParsedClause.getEndLoc());
12289template <
typename Derived>
12290void OpenACCClauseTransform<Derived>::VisitAutoClause(
12294 ParsedClause.getBeginLoc(),
12295 ParsedClause.getEndLoc());
12298template <
typename Derived>
12299void OpenACCClauseTransform<Derived>::VisitIndependentClause(
12302 ParsedClause.getBeginLoc(),
12303 ParsedClause.getEndLoc());
12306template <
typename Derived>
12307void OpenACCClauseTransform<Derived>::VisitSeqClause(
12310 ParsedClause.getBeginLoc(),
12311 ParsedClause.getEndLoc());
12313template <
typename Derived>
12314void OpenACCClauseTransform<Derived>::VisitFinalizeClause(
12317 ParsedClause.getBeginLoc(),
12318 ParsedClause.getEndLoc());
12321template <
typename Derived>
12322void OpenACCClauseTransform<Derived>::VisitIfPresentClause(
12325 ParsedClause.getBeginLoc(),
12326 ParsedClause.getEndLoc());
12329template <
typename Derived>
12330void OpenACCClauseTransform<Derived>::VisitReductionClause(
12336 for (
const auto [Var, OrigRecipe] :
12337 llvm::zip(TransformedVars,
C.getRecipes())) {
12339 ParsedClause.getDirectiveKind(),
C.getReductionOp(), Var);
12340 if (Res.isUsable()) {
12341 ValidVars.push_back(Res.get());
12343 if (OrigRecipe.isSet())
12344 Recipes.push_back(OrigRecipe);
12346 Recipes.push_back(
Self.getSema().OpenACC().CreateReductionInitRecipe(
12347 C.getReductionOp(), Res.get()));
12351 NewClause =
Self.getSema().OpenACC().CheckReductionClause(
12352 ExistingClauses, ParsedClause.getDirectiveKind(),
12353 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12354 C.getReductionOp(), ValidVars, Recipes, ParsedClause.getEndLoc());
12357template <
typename Derived>
12358void OpenACCClauseTransform<Derived>::VisitCollapseClause(
12360 Expr *LoopCount =
const_cast<Expr *
>(
C.getLoopCount());
12361 assert(LoopCount &&
"collapse clause constructed with invalid loop count");
12365 NewLoopCount =
Self.getSema().OpenACC().ActOnIntExpr(
12367 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12370 Self.getSema().OpenACC().CheckCollapseLoopCount(NewLoopCount.get());
12372 ParsedClause.setCollapseDetails(
C.hasForce(), NewLoopCount.get());
12374 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12375 ParsedClause.getLParenLoc(), ParsedClause.isForce(),
12376 ParsedClause.getLoopCount(), ParsedClause.getEndLoc());
12379template <
typename Derived>
12380void OpenACCClauseTransform<Derived>::VisitTileClause(
12385 for (
Expr *E :
C.getSizeExprs()) {
12388 if (!NewSizeExpr.isUsable())
12391 NewSizeExpr =
Self.getSema().OpenACC().ActOnIntExpr(
12393 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12395 NewSizeExpr =
Self.getSema().OpenACC().CheckTileSizeExpr(NewSizeExpr.get());
12397 if (!NewSizeExpr.isUsable())
12399 TransformedExprs.push_back(NewSizeExpr.get());
12402 ParsedClause.setIntExprDetails(TransformedExprs);
12404 Self.getSema().getASTContext(), ParsedClause.getBeginLoc(),
12405 ParsedClause.getLParenLoc(), ParsedClause.getIntExprs(),
12406 ParsedClause.getEndLoc());
12408template <
typename Derived>
12409void OpenACCClauseTransform<Derived>::VisitGangClause(
12414 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
12416 if (!ER.isUsable())
12419 ER =
Self.getSema().OpenACC().CheckGangExpr(ExistingClauses,
12420 ParsedClause.getDirectiveKind(),
12421 C.getExpr(I).first, ER.get());
12422 if (!ER.isUsable())
12424 TransformedGangKinds.push_back(
C.getExpr(I).first);
12425 TransformedIntExprs.push_back(ER.get());
12428 NewClause =
Self.getSema().OpenACC().CheckGangClause(
12429 ParsedClause.getDirectiveKind(), ExistingClauses,
12430 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
12431 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
12434template <
typename Derived>
12435OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
12440 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12441 ParsedClause.setEndLoc(OldClause->getEndLoc());
12443 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
12444 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12446 OpenACCClauseTransform<Derived> Transform{*
this, ExistingClauses,
12448 Transform.Visit(OldClause);
12450 return Transform.CreatedClause();
12453template <
typename Derived>
12455TreeTransform<Derived>::TransformOpenACCClauseList(
12458 for (
const auto *Clause : OldClauses) {
12459 if (
OpenACCClause *TransformedClause = getDerived().TransformOpenACCClause(
12460 TransformedClauses, DirKind, Clause))
12461 TransformedClauses.push_back(TransformedClause);
12463 return TransformedClauses;
12466template <
typename Derived>
12469 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12472 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12475 if (getSema().OpenACC().ActOnStartStmtDirective(
12476 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12481 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12482 C->clauses(), TransformedClauses);
12483 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12484 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12485 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12487 return getDerived().RebuildOpenACCComputeConstruct(
12488 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12489 C->getEndLoc(), TransformedClauses, StrBlock);
12492template <
typename Derived>
12496 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12499 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12502 if (getSema().OpenACC().ActOnStartStmtDirective(
12503 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12508 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12509 C->clauses(), TransformedClauses);
12511 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12512 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12514 return getDerived().RebuildOpenACCLoopConstruct(
12515 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12516 TransformedClauses,
Loop);
12519template <
typename Derived>
12521 OpenACCCombinedConstruct *
C) {
12522 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12525 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12528 if (getSema().OpenACC().ActOnStartStmtDirective(
12529 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12534 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12535 C->clauses(), TransformedClauses);
12537 Loop = getSema().OpenACC().ActOnAssociatedStmt(
12538 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses,
Loop);
12540 return getDerived().RebuildOpenACCCombinedConstruct(
12541 C->getDirectiveKind(),
C->getBeginLoc(),
C->getDirectiveLoc(),
12542 C->getEndLoc(), TransformedClauses,
Loop);
12545template <
typename Derived>
12548 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12551 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12553 if (getSema().OpenACC().ActOnStartStmtDirective(
12554 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12558 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12559 C->clauses(), TransformedClauses);
12560 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12561 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12562 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12564 return getDerived().RebuildOpenACCDataConstruct(
12565 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12566 TransformedClauses, StrBlock);
12569template <
typename Derived>
12571 OpenACCEnterDataConstruct *
C) {
12572 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12575 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12577 if (getSema().OpenACC().ActOnStartStmtDirective(
12578 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12581 return getDerived().RebuildOpenACCEnterDataConstruct(
12582 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12583 TransformedClauses);
12586template <
typename Derived>
12588 OpenACCExitDataConstruct *
C) {
12589 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12592 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12594 if (getSema().OpenACC().ActOnStartStmtDirective(
12595 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12598 return getDerived().RebuildOpenACCExitDataConstruct(
12599 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12600 TransformedClauses);
12603template <
typename Derived>
12605 OpenACCHostDataConstruct *
C) {
12606 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12609 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12611 if (getSema().OpenACC().ActOnStartStmtDirective(
12612 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12616 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(),
12617 C->clauses(), TransformedClauses);
12618 StmtResult StrBlock = getDerived().TransformStmt(
C->getStructuredBlock());
12619 StrBlock = getSema().OpenACC().ActOnAssociatedStmt(
12620 C->getBeginLoc(),
C->getDirectiveKind(), TransformedClauses, StrBlock);
12622 return getDerived().RebuildOpenACCHostDataConstruct(
12623 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12624 TransformedClauses, StrBlock);
12627template <
typename Derived>
12630 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12633 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12635 if (getSema().OpenACC().ActOnStartStmtDirective(
12636 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12639 return getDerived().RebuildOpenACCInitConstruct(
12640 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12641 TransformedClauses);
12644template <
typename Derived>
12646 OpenACCShutdownConstruct *
C) {
12647 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12650 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12652 if (getSema().OpenACC().ActOnStartStmtDirective(
12653 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12656 return getDerived().RebuildOpenACCShutdownConstruct(
12657 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12658 TransformedClauses);
12660template <
typename Derived>
12663 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12666 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12668 if (getSema().OpenACC().ActOnStartStmtDirective(
12669 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12672 return getDerived().RebuildOpenACCSetConstruct(
12673 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12674 TransformedClauses);
12677template <
typename Derived>
12679 OpenACCUpdateConstruct *
C) {
12680 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12683 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12685 if (getSema().OpenACC().ActOnStartStmtDirective(
12686 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12689 return getDerived().RebuildOpenACCUpdateConstruct(
12690 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getEndLoc(),
12691 TransformedClauses);
12694template <
typename Derived>
12697 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12700 if (
C->hasDevNumExpr()) {
12701 DevNumExpr = getDerived().TransformExpr(
C->getDevNumExpr());
12703 if (DevNumExpr.isUsable())
12704 DevNumExpr = getSema().OpenACC().ActOnIntExpr(
12706 C->getBeginLoc(), DevNumExpr.get());
12711 for (
Expr *QE :
C->getQueueIdExprs()) {
12712 assert(QE &&
"Null queue id expr?");
12713 ExprResult NewEQ = getDerived().TransformExpr(QE);
12715 if (!NewEQ.isUsable())
12719 C->getBeginLoc(), NewEQ.get());
12720 if (NewEQ.isUsable())
12721 QueueIdExprs.push_back(NewEQ.get());
12725 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12728 if (getSema().OpenACC().ActOnStartStmtDirective(
12729 C->getDirectiveKind(),
C->getBeginLoc(), TransformedClauses))
12732 return getDerived().RebuildOpenACCWaitConstruct(
12733 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12734 DevNumExpr.isUsable() ? DevNumExpr.get() :
nullptr,
C->getQueuesLoc(),
12735 QueueIdExprs,
C->getRParenLoc(),
C->getEndLoc(), TransformedClauses);
12737template <
typename Derived>
12739 OpenACCCacheConstruct *
C) {
12740 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12743 for (
Expr *Var :
C->getVarList()) {
12744 assert(Var &&
"Null var listexpr?");
12746 ExprResult NewVar = getDerived().TransformExpr(Var);
12748 if (!NewVar.isUsable())
12751 NewVar = getSema().OpenACC().ActOnVar(
12753 if (!NewVar.isUsable())
12756 TransformedVarList.push_back(NewVar.get());
12759 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12760 C->getBeginLoc(), {}))
12763 return getDerived().RebuildOpenACCCacheConstruct(
12764 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getLParenLoc(),
12765 C->getReadOnlyLoc(), TransformedVarList,
C->getRParenLoc(),
12769template <
typename Derived>
12771 OpenACCAtomicConstruct *
C) {
12772 getSema().OpenACC().ActOnConstruct(
C->getDirectiveKind(),
C->getBeginLoc());
12775 getDerived().TransformOpenACCClauseList(
C->getDirectiveKind(),
12778 if (getSema().OpenACC().ActOnStartStmtDirective(
C->getDirectiveKind(),
12779 C->getBeginLoc(), {}))
12784 getSema().OpenACC(),
C->getDirectiveKind(),
C->getDirectiveLoc(), {}, {});
12786 StmtResult AssocStmt = getDerived().TransformStmt(
C->getAssociatedStmt());
12787 AssocStmt = getSema().OpenACC().ActOnAssociatedStmt(
12788 C->getBeginLoc(),
C->getDirectiveKind(),
C->getAtomicKind(), {},
12791 return getDerived().RebuildOpenACCAtomicConstruct(
12792 C->getBeginLoc(),
C->getDirectiveLoc(),
C->getAtomicKind(),
12793 C->getEndLoc(), TransformedClauses, AssocStmt);
12796template <
typename Derived>
12799 if (getDerived().AlwaysRebuild())
12808template<
typename Derived>
12811 return TransformExpr(E->getSubExpr());
12814template <
typename Derived>
12817 if (!E->isTypeDependent())
12820 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12825 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12828 return getDerived().RebuildSYCLUniqueStableNameExpr(
12829 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12832template<
typename Derived>
12835 if (!E->isTypeDependent())
12839 E->getIdentKind());
12842template<
typename Derived>
12846 if (E->getQualifierLoc()) {
12848 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12854 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
12856 if (!ND || ND->isInvalidDecl())
12860 if (E->getFoundDecl() != E->getDecl()) {
12861 Found = cast_or_null<NamedDecl>(
12862 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
12868 if (NameInfo.getName()) {
12869 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
12870 if (!NameInfo.getName())
12874 if (!getDerived().AlwaysRebuild() &&
12875 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12876 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
12877 Found == E->getFoundDecl() &&
12878 NameInfo.getName() == E->getDecl()->getDeclName() &&
12879 !E->hasExplicitTemplateArgs()) {
12889 if (E->hasExplicitTemplateArgs()) {
12890 TemplateArgs = &TransArgs;
12891 TransArgs.setLAngleLoc(E->getLAngleLoc());
12892 TransArgs.setRAngleLoc(E->getRAngleLoc());
12893 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
12894 E->getNumTemplateArgs(),
12899 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
12900 Found, TemplateArgs);
12903template<
typename Derived>
12909template <
typename Derived>
12915template<
typename Derived>
12921template<
typename Derived>
12927template<
typename Derived>
12933template<
typename Derived>
12939template<
typename Derived>
12942 return getDerived().TransformCallExpr(E);
12945template<
typename Derived>
12950 if (E->isExprPredicate())
12951 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
12953 ControllingType = getDerived().TransformType(E->getControllingType());
12955 if (ControllingExpr.isInvalid() && !ControllingType)
12966 AssocTypes.push_back(AssocType);
12968 AssocTypes.push_back(
nullptr);
12972 getDerived().TransformExpr(Assoc.getAssociationExpr());
12973 if (AssocExpr.isInvalid())
12975 AssocExprs.push_back(AssocExpr.get());
12978 if (!ControllingType)
12979 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
12980 E->getDefaultLoc(),
12982 ControllingExpr.get(),
12985 return getDerived().RebuildGenericSelectionExpr(
12986 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
12987 ControllingType, AssocTypes, AssocExprs);
12990template<
typename Derived>
12993 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
12994 if (SubExpr.isInvalid())
12997 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
13000 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
13007template<
typename Derived>
13011 return getDerived().TransformDependentScopeDeclRefExpr(
13012 DRE,
true,
nullptr);
13014 return getDerived().TransformUnresolvedLookupExpr(
13020template<
typename Derived>
13025 SubExpr = TransformAddressOfOperand(E->
getSubExpr());
13031 if (!getDerived().AlwaysRebuild() && SubExpr.
get() == E->
getSubExpr())
13039template<
typename Derived>
13041TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
13043 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13053 bool ExprChanged =
false;
13054 typedef Sema::OffsetOfComponent Component;
13056 for (
unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
13057 const OffsetOfNode &ON = E->getComponent(I);
13059 Comp.isBrackets =
true;
13060 Comp.LocStart = ON.getSourceRange().getBegin();
13061 Comp.LocEnd = ON.getSourceRange().getEnd();
13062 switch (ON.getKind()) {
13064 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
13065 ExprResult Index = getDerived().TransformExpr(FromIndex);
13066 if (Index.isInvalid())
13069 ExprChanged = ExprChanged || Index.get() != FromIndex;
13070 Comp.isBrackets =
true;
13071 Comp.U.E = Index.get();
13077 Comp.isBrackets =
false;
13078 Comp.U.IdentInfo = ON.getFieldName();
13079 if (!
Comp.U.IdentInfo)
13089 Components.push_back(Comp);
13093 if (!getDerived().AlwaysRebuild() &&
13094 Type == E->getTypeSourceInfo() &&
13099 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(),
Type,
13100 Components, E->getRParenLoc());
13103template<
typename Derived>
13106 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
13107 "opaque value expression requires transformation");
13111template <
typename Derived>
13115 for (
Expr *
C : E->subExpressions()) {
13117 if (NewC.isInvalid())
13123 if (!getDerived().AlwaysRebuild() && !Changed)
13125 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
13129template<
typename Derived>
13139 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
13140 if (result.isInvalid())
return ExprError();
13145 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
13151template<
typename Derived>
13155 if (E->isArgumentType()) {
13162 if (!getDerived().AlwaysRebuild() && OldT == NewT)
13165 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
13167 E->getSourceRange());
13181 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13183 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) :
nullptr)
13184 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
13185 PE, DRE,
false, &RecoveryTSI);
13187 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13190 return getDerived().RebuildUnaryExprOrTypeTrait(
13191 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13192 }
else if (SubExpr.isInvalid())
13195 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13198 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
13199 E->getOperatorLoc(),
13201 E->getSourceRange());
13204template<
typename Derived>
13207 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13208 if (LHS.isInvalid())
13211 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13212 if (RHS.isInvalid())
13216 if (!getDerived().AlwaysRebuild() &&
13217 LHS.get() == E->getLHS() &&
13218 RHS.get() == E->getRHS())
13221 return getDerived().RebuildArraySubscriptExpr(
13223 E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13226template <
typename Derived>
13230 if (
Base.isInvalid())
13233 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13234 if (RowIdx.isInvalid())
13237 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13238 if (ColumnIdx.isInvalid())
13241 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13242 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13245 return getDerived().RebuildMatrixSubscriptExpr(
13246 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13249template <
typename Derived>
13253 if (
Base.isInvalid())
13257 if (E->getLowerBound()) {
13258 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13259 if (LowerBound.isInvalid())
13264 if (E->getLength()) {
13265 Length = getDerived().TransformExpr(E->getLength());
13266 if (Length.isInvalid())
13271 if (E->isOMPArraySection()) {
13272 if (
Expr *Str = E->getStride()) {
13273 Stride = getDerived().TransformExpr(Str);
13274 if (Stride.isInvalid())
13279 if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase() &&
13280 LowerBound.get() == E->getLowerBound() &&
13281 Length.get() == E->getLength() &&
13282 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13285 return getDerived().RebuildArraySectionExpr(
13286 E->isOMPArraySection(),
Base.get(), E->getBase()->getEndLoc(),
13287 LowerBound.get(), E->getColonLocFirst(),
13288 E->isOMPArraySection() ? E->getColonLocSecond() :
SourceLocation{},
13289 Length.get(), Stride.get(), E->getRBracketLoc());
13292template <
typename Derived>
13296 if (
Base.isInvalid())
13300 bool ErrorFound =
false;
13301 for (
Expr *
Dim : E->getDimensions()) {
13303 if (DimRes.isInvalid()) {
13307 Dims.push_back(DimRes.get());
13312 return getDerived().RebuildOMPArrayShapingExpr(
Base.get(), E->getLParenLoc(),
13313 E->getRParenLoc(), Dims,
13314 E->getBracketsRanges());
13317template <
typename Derived>
13320 unsigned NumIterators = E->numOfIterators();
13323 bool ErrorFound =
false;
13324 bool NeedToRebuild = getDerived().AlwaysRebuild();
13325 for (
unsigned I = 0; I < NumIterators; ++I) {
13327 Data[I].DeclIdent = D->getIdentifier();
13328 Data[I].DeclIdentLoc = D->getLocation();
13329 if (D->getLocation() == D->getBeginLoc()) {
13331 "Implicit type must be int.");
13333 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13341 ErrorFound = ErrorFound ||
13342 !(!D->getTypeSourceInfo() || (
Data[I].
Type.getAsOpaquePtr() &&
13343 !
Data[I].Type.get().isNull())) ||
13344 Begin.isInvalid() || End.isInvalid() || Step.isInvalid();
13347 Data[I].Range.Begin = Begin.get();
13348 Data[I].Range.End = End.get();
13349 Data[I].Range.Step = Step.get();
13350 Data[I].AssignLoc = E->getAssignLoc(I);
13351 Data[I].ColonLoc = E->getColonLoc(I);
13352 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13355 (D->getTypeSourceInfo() &&
Data[I].
Type.get().getTypePtrOrNull() !=
13356 D->getType().getTypePtrOrNull()) ||
13362 if (!NeedToRebuild)
13365 ExprResult Res = getDerived().RebuildOMPIteratorExpr(
13366 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(),
Data);
13367 if (!Res.isUsable())
13370 for (
unsigned I = 0; I < NumIterators; ++I)
13371 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13372 IE->getIteratorDecl(I));
13376template<
typename Derived>
13385 bool ArgChanged =
false;
13387 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
13391 if (!getDerived().AlwaysRebuild() &&
13392 Callee.get() == E->getCallee() &&
13398 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
13401 if (E->hasStoredFPFeatures()) {
13403 getSema().CurFPFeatures =
13405 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13408 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
13410 E->getRParenLoc());
13413template<
typename Derived>
13417 if (
Base.isInvalid())
13421 if (E->hasQualifier()) {
13423 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13431 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13432 E->getMemberDecl()));
13436 NamedDecl *FoundDecl = E->getFoundDecl();
13437 if (FoundDecl == E->getMemberDecl()) {
13440 FoundDecl = cast_or_null<NamedDecl>(
13441 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13446 if (!getDerived().AlwaysRebuild() &&
13447 Base.get() == E->getBase() &&
13448 QualifierLoc == E->getQualifierLoc() &&
13449 Member == E->getMemberDecl() &&
13450 FoundDecl == E->getFoundDecl() &&
13451 !E->hasExplicitTemplateArgs()) {
13456 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13466 if (E->hasExplicitTemplateArgs()) {
13467 TransArgs.setLAngleLoc(E->getLAngleLoc());
13468 TransArgs.setRAngleLoc(E->getRAngleLoc());
13469 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13470 E->getNumTemplateArgs(),
13483 NamedDecl *FirstQualifierInScope =
nullptr;
13485 if (MemberNameInfo.getName()) {
13486 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
13487 if (!MemberNameInfo.getName())
13491 return getDerived().RebuildMemberExpr(
Base.get(), FakeOperatorLoc,
13498 (E->hasExplicitTemplateArgs()
13499 ? &TransArgs :
nullptr),
13500 FirstQualifierInScope);
13503template<
typename Derived>
13506 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13507 if (LHS.isInvalid())
13511 getDerived().TransformInitializer(E->getRHS(),
false);
13512 if (RHS.isInvalid())
13515 if (!getDerived().AlwaysRebuild() &&
13516 LHS.get() == E->getLHS() &&
13517 RHS.get() == E->getRHS())
13520 if (E->isCompoundAssignmentOp())
13522 return getDerived().RebuildBinaryOperator(
13523 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13526 getSema().CurFPFeatures =
13527 NewOverrides.applyOverrides(getSema().getLangOpts());
13528 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13529 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13530 LHS.get(), RHS.get());
13533template <
typename Derived>
13538 ExprResult LHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.LHS));
13539 if (LHS.isInvalid())
13542 ExprResult RHS = getDerived().TransformExpr(
const_cast<Expr*
>(Decomp.RHS));
13543 if (RHS.isInvalid())
13549 bool ChangedAnyLookups =
false;
13550 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13551 const_cast<Expr *
>(Decomp.InnerBinOp)};
13552 for (
Expr *PossibleBinOp : PossibleBinOps) {
13553 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13556 auto *
Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13562 NamedDecl *
Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
13563 E->getOperatorLoc(),
Callee->getFoundDecl()));
13567 ChangedAnyLookups =
true;
13568 UnqualLookups.addDecl(
Found);
13571 if (!getDerived().AlwaysRebuild() && !ChangedAnyLookups &&
13572 LHS.get() == Decomp.LHS && RHS.get() == Decomp.RHS) {
13578 const Expr *StopAt[] = {Decomp.LHS, Decomp.RHS};
13583 return getDerived().RebuildCXXRewrittenBinaryOperator(
13584 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13587template<
typename Derived>
13593 getSema().CurFPFeatures =
13594 NewOverrides.applyOverrides(getSema().getLangOpts());
13595 getSema().FpPragmaStack.CurrentValue = NewOverrides;
13596 return getDerived().TransformBinaryOperator(E);
13599template<
typename Derived>
13605 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13606 if (commonExpr.isInvalid())
13609 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13610 if (rhs.isInvalid())
13613 if (!getDerived().AlwaysRebuild() &&
13614 commonExpr.get() == e->getCommon() &&
13615 rhs.get() == e->getFalseExpr())
13618 return getDerived().RebuildConditionalOperator(commonExpr.get(),
13619 e->getQuestionLoc(),
13625template<
typename Derived>
13629 if (
Cond.isInvalid())
13632 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13633 if (LHS.isInvalid())
13636 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13637 if (RHS.isInvalid())
13640 if (!getDerived().AlwaysRebuild() &&
13641 Cond.get() == E->getCond() &&
13642 LHS.get() == E->getLHS() &&
13643 RHS.get() == E->getRHS())
13646 return getDerived().RebuildConditionalOperator(
Cond.get(),
13647 E->getQuestionLoc(),
13653template<
typename Derived>
13658 return getDerived().
TransformExpr(E->getSubExprAsWritten());
13661template<
typename Derived>
13669 = getDerived().TransformExpr(E->getSubExprAsWritten());
13670 if (SubExpr.isInvalid())
13673 if (!getDerived().AlwaysRebuild() &&
13674 Type == E->getTypeInfoAsWritten() &&
13675 SubExpr.get() == E->getSubExpr())
13678 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13684template<
typename Derived>
13692 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13693 if (
Init.isInvalid())
13696 if (!getDerived().AlwaysRebuild() &&
13698 Init.get() == E->getInitializer())
13705 return getDerived().RebuildCompoundLiteralExpr(
13706 E->getLParenLoc(), NewT,
13707 E->getInitializer()->getEndLoc(),
Init.get());
13710template<
typename Derived>
13714 if (
Base.isInvalid())
13717 if (!getDerived().AlwaysRebuild() &&
13718 Base.get() == E->getBase())
13724 return getDerived().RebuildExtVectorElementExpr(
13725 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13729template<
typename Derived>
13735 bool InitChanged =
false;
13741 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(),
false,
13742 Inits, &InitChanged))
13745 if (!getDerived().AlwaysRebuild() && !InitChanged) {
13752 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13753 E->getRBraceLoc());
13756template<
typename Derived>
13763 if (
Init.isInvalid())
13768 bool ExprChanged =
false;
13770 if (D.isFieldDesignator()) {
13771 if (D.getFieldDecl()) {
13773 getDerived().TransformDecl(D.getFieldLoc(), D.getFieldDecl()));
13774 if (Field != D.getFieldDecl())
13777 ExprChanged =
true;
13778 if (
Field->isAnonymousStructOrUnion())
13784 ExprChanged =
true;
13787 D.getFieldName(), D.getDotLoc(), D.getFieldLoc()));
13791 if (D.isArrayDesignator()) {
13792 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13793 if (Index.isInvalid())
13796 Desig.AddDesignator(
13799 ExprChanged = ExprChanged || Index.get() != E->getArrayIndex(D);
13800 ArrayExprs.push_back(Index.get());
13804 assert(D.isArrayRangeDesignator() &&
"New kind of designator?");
13806 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13807 if (Start.isInvalid())
13810 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13811 if (End.isInvalid())
13815 Start.get(), End.get(), D.getLBracketLoc(), D.getEllipsisLoc()));
13817 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13818 End.get() != E->getArrayRangeEnd(D);
13820 ArrayExprs.push_back(Start.get());
13821 ArrayExprs.push_back(End.get());
13824 if (!getDerived().AlwaysRebuild() &&
13825 Init.get() == E->getInit() &&
13829 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
13830 E->getEqualOrColonLoc(),
13831 E->usesGNUSyntax(),
Init.get());
13836template<
typename Derived>
13840 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
13845template<
typename Derived>
13849 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
13853template<
typename Derived>
13856 llvm_unreachable(
"Unexpected ArrayInitLoopExpr outside of initializer");
13860template<
typename Derived>
13863 llvm_unreachable(
"Unexpected ArrayInitIndexExpr outside of initializer");
13867template<
typename Derived>
13875 QualType T = getDerived().TransformType(E->getType());
13879 if (!getDerived().AlwaysRebuild() &&
13883 return getDerived().RebuildImplicitValueInitExpr(
T);
13886template<
typename Derived>
13889 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
13893 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13894 if (SubExpr.isInvalid())
13897 if (!getDerived().AlwaysRebuild() &&
13898 TInfo == E->getWrittenTypeInfo() &&
13899 SubExpr.get() == E->getSubExpr())
13902 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
13903 TInfo, E->getRParenLoc());
13906template<
typename Derived>
13909 bool ArgumentChanged =
false;
13911 if (TransformExprs(E->getExprs(), E->getNumExprs(),
true, Inits,
13915 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
13917 E->getRParenLoc());
13925template<
typename Derived>
13928 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
13933 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
13937template<
typename Derived>
13942 = getDerived().TransformCompoundStmt(E->getSubStmt(),
true);
13943 if (SubStmt.isInvalid()) {
13948 unsigned OldDepth = E->getTemplateDepth();
13949 unsigned NewDepth = getDerived().TransformTemplateDepth(OldDepth);
13951 if (!getDerived().AlwaysRebuild() && OldDepth == NewDepth &&
13952 SubStmt.get() == E->getSubStmt()) {
13958 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
13959 E->getRParenLoc(), NewDepth);
13962template<
typename Derived>
13966 if (
Cond.isInvalid())
13969 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13970 if (LHS.isInvalid())
13973 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13974 if (RHS.isInvalid())
13977 if (!getDerived().AlwaysRebuild() &&
13978 Cond.get() == E->getCond() &&
13979 LHS.get() == E->getLHS() &&
13980 RHS.get() == E->getRHS())
13983 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
13984 Cond.get(), LHS.get(), RHS.get(),
13985 E->getRParenLoc());
13988template<
typename Derived>
13994template<
typename Derived>
13997 switch (E->getOperator()) {
14001 case OO_Array_Delete:
14002 llvm_unreachable(
"new and delete operators cannot use CXXOperatorCallExpr");
14007 assert(E->getNumArgs() >= 1 &&
"Object call is missing arguments");
14020 if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14021 FakeLParenLoc = EndLoc;
14025 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1,
true,
14029 if (E->getOperator() == OO_Subscript)
14030 return getDerived().RebuildCxxSubscriptExpr(
Object.get(), FakeLParenLoc,
14031 Args, E->getEndLoc());
14033 return getDerived().RebuildCallExpr(
Object.get(), FakeLParenLoc, Args,
14037#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \
14041#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
14042#include "clang/Basic/OperatorKinds.def"
14044 case OO_Conditional:
14045 llvm_unreachable(
"conditional operator is not actually overloadable");
14049 llvm_unreachable(
"not an overloaded operator?");
14053 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
14054 First = getDerived().TransformAddressOfOperand(E->getArg(0));
14056 First = getDerived().TransformExpr(E->getArg(0));
14057 if (
First.isInvalid())
14061 if (E->getNumArgs() == 2) {
14063 getDerived().TransformInitializer(E->getArg(1),
false);
14064 if (Second.isInvalid())
14070 getSema().CurFPFeatures =
14071 NewOverrides.applyOverrides(getSema().getLangOpts());
14072 getSema().FpPragmaStack.CurrentValue = NewOverrides;
14076 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
14078 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
14081 return getDerived().RebuildCXXOperatorCallExpr(
14082 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14083 ULE->requiresADL(), R.asUnresolvedSet(),
First.get(), Second.get());
14088 Callee = ICE->getSubExprAsWritten();
14090 ValueDecl *VD = cast_or_null<ValueDecl>(
14091 getDerived().TransformDecl(DR->getLocation(), DR));
14096 Functions.addDecl(VD);
14098 return getDerived().RebuildCXXOperatorCallExpr(
14099 E->getOperator(), E->getOperatorLoc(),
Callee->getBeginLoc(),
14100 false, Functions,
First.get(), Second.get());
14103template<
typename Derived>
14106 return getDerived().TransformCallExpr(E);
14109template <
typename Derived>
14112 getSema().CurContext != E->getParentContext();
14114 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
14117 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
14118 E->getBeginLoc(), E->getEndLoc(),
14119 getSema().CurContext);
14122template <
typename Derived>
14127template<
typename Derived>
14136 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
14137 if (EC.isInvalid())
14141 bool ArgChanged =
false;
14143 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
14147 if (!getDerived().AlwaysRebuild() &&
14148 Callee.get() == E->getCallee() &&
14154 = ((
Expr *)
Callee.get())->getSourceRange().getBegin();
14155 return getDerived().RebuildCallExpr(
Callee.get(), FakeLParenLoc,
14157 E->getRParenLoc(), EC.get());
14160template<
typename Derived>
14176 return getDerived().RebuildCXXNamedCastExpr(
14183template<
typename Derived>
14192 if (Sub.isInvalid())
14195 return getDerived().RebuildBuiltinBitCastExpr(BCE->
getBeginLoc(), TSI,
14199template<
typename Derived>
14201TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
14202 return getDerived().TransformCXXNamedCastExpr(E);
14205template<
typename Derived>
14211template<
typename Derived>
14218template<
typename Derived>
14224template<
typename Derived>
14230template<
typename Derived>
14235 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14240 = getDerived().TransformExpr(E->getSubExprAsWritten());
14241 if (SubExpr.isInvalid())
14244 if (!getDerived().AlwaysRebuild() &&
14245 Type == E->getTypeInfoAsWritten() &&
14246 SubExpr.get() == E->getSubExpr())
14249 return getDerived().RebuildCXXFunctionalCastExpr(
Type,
14253 E->isListInitialization());
14256template<
typename Derived>
14259 if (E->isTypeOperand()) {
14261 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14265 if (!getDerived().AlwaysRebuild() &&
14266 TInfo == E->getTypeOperandSourceInfo())
14269 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14270 TInfo, E->getEndLoc());
14276 Expr *Op = E->getExprOperand();
14278 if (E->isGLValue())
14279 if (
auto *RD = Op->getType()->getAsCXXRecordDecl();
14280 RD && RD->isPolymorphic())
14286 ExprResult SubExpr = getDerived().TransformExpr(Op);
14287 if (SubExpr.isInvalid())
14290 if (!getDerived().AlwaysRebuild() &&
14291 SubExpr.get() == E->getExprOperand())
14294 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14295 SubExpr.get(), E->getEndLoc());
14298template<
typename Derived>
14301 if (E->isTypeOperand()) {
14303 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14307 if (!getDerived().AlwaysRebuild() &&
14308 TInfo == E->getTypeOperandSourceInfo())
14311 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14312 TInfo, E->getEndLoc());
14318 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14319 if (SubExpr.isInvalid())
14322 if (!getDerived().AlwaysRebuild() &&
14323 SubExpr.get() == E->getExprOperand())
14326 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14327 SubExpr.get(), E->getEndLoc());
14330template<
typename Derived>
14336template<
typename Derived>
14343template<
typename Derived>
14359 auto &S = getSema();
14360 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14361 return S.getCurrentThisType();
14362 if (S.getCurLambda())
14363 return getDerived().TransformType(E->getType());
14364 return S.getCurrentThisType();
14367 if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
14368 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter()) {
14371 getSema().MarkThisReferenced(E);
14375 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(),
T, E->isImplicit());
14378template<
typename Derived>
14381 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14382 if (SubExpr.isInvalid())
14385 getSema().DiagnoseExceptionUse(E->getThrowLoc(),
false);
14387 if (!getDerived().AlwaysRebuild() &&
14388 SubExpr.get() == E->getSubExpr())
14391 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14392 E->isThrownVariableInScope());
14395template<
typename Derived>
14399 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14404 if (E->hasRewrittenInit()) {
14405 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14406 if (InitRes.isInvalid())
14410 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14411 E->getUsedContext() == SemaRef.
CurContext &&
14412 InitRes.get() == E->getRewrittenExpr())
14415 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14419template<
typename Derived>
14423 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14427 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14431 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14434template<
typename Derived>
14438 TypeSourceInfo *
T = getDerived().TransformType(E->getTypeSourceInfo());
14442 if (!getDerived().AlwaysRebuild() &&
14443 T == E->getTypeSourceInfo())
14446 return getDerived().RebuildCXXScalarValueInitExpr(
T,
14447 T->getTypeLoc().getEndLoc(),
14448 E->getRParenLoc());
14451template<
typename Derived>
14456 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14457 if (!AllocTypeInfo)
14461 std::optional<Expr *> ArraySize;
14462 if (E->isArray()) {
14464 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14465 NewArraySize = getDerived().TransformExpr(*OldArraySize);
14466 if (NewArraySize.isInvalid())
14469 ArraySize = NewArraySize.get();
14473 bool ArgumentChanged =
false;
14475 if (getDerived().TransformExprs(E->getPlacementArgs(),
14476 E->getNumPlacementArgs(),
true,
14477 PlacementArgs, &ArgumentChanged))
14481 Expr *OldInit = E->getInitializer();
14484 NewInit = getDerived().TransformInitializer(OldInit,
true);
14485 if (NewInit.isInvalid())
14490 if (E->getOperatorNew()) {
14491 OperatorNew = cast_or_null<FunctionDecl>(
14492 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14498 if (E->getOperatorDelete()) {
14499 OperatorDelete = cast_or_null<FunctionDecl>(
14500 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14501 if (!OperatorDelete)
14505 if (!getDerived().AlwaysRebuild() &&
14506 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14507 ArraySize == E->getArraySize() &&
14508 NewInit.get() == OldInit &&
14509 OperatorNew == E->getOperatorNew() &&
14510 OperatorDelete == E->getOperatorDelete() &&
14511 !ArgumentChanged) {
14516 if (OperatorDelete)
14519 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14531 QualType AllocType = AllocTypeInfo->getType();
14542 = dyn_cast<ConstantArrayType>(ArrayT)) {
14546 AllocType = ConsArrayT->getElementType();
14548 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
14549 if (DepArrayT->getSizeExpr()) {
14550 ArraySize = DepArrayT->getSizeExpr();
14551 AllocType = DepArrayT->getElementType();
14556 return getDerived().RebuildCXXNewExpr(
14557 E->getBeginLoc(), E->isGlobalNew(),
14558 E->getBeginLoc(), PlacementArgs,
14559 E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14560 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14563template<
typename Derived>
14572 if (E->getOperatorDelete()) {
14573 OperatorDelete = cast_or_null<FunctionDecl>(
14574 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14575 if (!OperatorDelete)
14579 if (!getDerived().AlwaysRebuild() &&
14580 Operand.get() == E->getArgument() &&
14581 OperatorDelete == E->getOperatorDelete()) {
14584 if (OperatorDelete)
14587 if (!E->getArgument()->isTypeDependent()) {
14589 E->getDestroyedType());
14590 if (
auto *
Record = Destroyed->getAsCXXRecordDecl())
14598 return getDerived().RebuildCXXDeleteExpr(
14599 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(),
Operand.get());
14602template<
typename Derived>
14607 if (
Base.isInvalid())
14611 bool MayBePseudoDestructor =
false;
14613 E->getOperatorLoc(),
14614 E->isArrow()? tok::arrow : tok::period,
14616 MayBePseudoDestructor);
14617 if (
Base.isInvalid())
14620 QualType ObjectType = ObjectTypePtr.get();
14622 if (QualifierLoc) {
14624 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
14629 SS.
Adopt(QualifierLoc);
14632 if (E->getDestroyedTypeInfo()) {
14633 TypeSourceInfo *DestroyedTypeInfo = getDerived().TransformTypeInObjectScope(
14634 E->getDestroyedTypeInfo(), ObjectType,
14636 if (!DestroyedTypeInfo)
14638 Destroyed = DestroyedTypeInfo;
14639 }
else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14643 E->getDestroyedTypeLoc());
14647 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14648 nullptr, SS, ObjectTypePtr,
false);
14654 E->getDestroyedTypeLoc());
14658 if (E->getScopeTypeInfo()) {
14659 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
14660 E->getScopeTypeInfo(), ObjectType,
nullptr);
14661 if (!ScopeTypeInfo)
14665 return getDerived().RebuildCXXPseudoDestructorExpr(
Base.get(),
14666 E->getOperatorLoc(),
14670 E->getColonColonLoc(),
14675template <
typename Derived>
14680 bool AllEmptyPacks =
true;
14681 for (
auto *OldD : Old->
decls()) {
14697 if (
auto *UPD = dyn_cast<UsingPackDecl>(InstD))
14698 Decls = UPD->expansions();
14701 for (
auto *D : Decls) {
14702 if (
auto *UD = dyn_cast<UsingDecl>(D)) {
14703 for (
auto *SD : UD->shadows())
14710 AllEmptyPacks &= Decls.empty();
14719 if (AllEmptyPacks && !RequiresADL) {
14731 getSema().FilterAcceptableTemplateNames(R,
14738 diag::err_template_kw_refers_to_non_template)
14742 diag::note_template_kw_refers_to_non_template)
14751template <
typename Derived>
14757template <
typename Derived>
14760 bool IsAddressOfOperand) {
14765 if (TransformOverloadExprDecls(Old, Old->
requiresADL(), R))
14772 = getDerived().TransformNestedNameSpecifierLoc(Old->
getQualifierLoc());
14776 SS.
Adopt(QualifierLoc);
14780 CXXRecordDecl *NamingClass
14781 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
14784 if (!NamingClass) {
14789 R.setNamingClass(NamingClass);
14810 SS, TemplateKWLoc, R,
14817 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->
requiresADL());
14820 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
14824template<
typename Derived>
14827 bool ArgChanged =
false;
14829 for (
unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14831 TypeLoc FromTL = From->getTypeLoc();
14834 TLB.
reserve(FromTL.getFullDataSize());
14835 QualType To = getDerived().TransformType(TLB, FromTL);
14839 if (To == From->getType())
14840 Args.push_back(From);
14842 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14852 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
14858 bool Expand =
true;
14859 bool RetainExpansion =
false;
14861 ExpansionTL.getTypePtr()->getNumExpansions();
14863 if (getDerived().TryExpandParameterPacks(
14864 ExpansionTL.getEllipsisLoc(), PatternTL.getSourceRange(),
14865 Unexpanded,
true, Expand,
14866 RetainExpansion, NumExpansions))
14876 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14878 QualType To = getDerived().TransformType(TLB, PatternTL);
14882 To = getDerived().RebuildPackExpansionType(To,
14883 PatternTL.getSourceRange(),
14884 ExpansionTL.getEllipsisLoc(),
14892 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14898 for (
unsigned I = 0; I != *NumExpansions; ++I) {
14901 TLB.
reserve(PatternTL.getFullDataSize());
14902 QualType To = getDerived().TransformType(TLB, PatternTL);
14906 if (To->containsUnexpandedParameterPack()) {
14907 To = getDerived().RebuildPackExpansionType(To,
14908 PatternTL.getSourceRange(),
14909 ExpansionTL.getEllipsisLoc(),
14919 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14922 if (!RetainExpansion)
14927 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
14930 TLB.
reserve(From->getTypeLoc().getFullDataSize());
14932 QualType To = getDerived().TransformType(TLB, PatternTL);
14936 To = getDerived().RebuildPackExpansionType(To,
14937 PatternTL.getSourceRange(),
14938 ExpansionTL.getEllipsisLoc(),
14946 Args.push_back(TLB.getTypeSourceInfo(SemaRef.
Context, To));
14949 if (!getDerived().AlwaysRebuild() && !ArgChanged)
14952 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
14956template<
typename Derived>
14962 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14963 Old->NumTemplateArgs, TransArgs))
14966 return getDerived().RebuildConceptSpecializationExpr(
14967 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
14968 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
14972template<
typename Derived>
14986 getSema().Context, getSema().CurContext,
14987 E->getBody()->getBeginLoc());
14991 ExprResult TypeParamResult = getDerived().TransformRequiresTypeParams(
14992 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
14993 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
14997 Param->setDeclContext(Body);
15003 if (!TypeParamResult.isUnset())
15004 return TypeParamResult;
15007 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
15012 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
15013 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
15014 ER->getReturnTypeRequirement()
15015 .getTypeConstraintTemplateParameterList()->getParam(0)
15016 ->setDeclContext(Body);
15021 return getDerived().RebuildRequiresExpr(
15022 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
15023 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
15026template<
typename Derived>
15032 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
15033 TransReq =
getDerived().TransformTypeRequirement(TypeReq);
15034 else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
15035 TransReq =
getDerived().TransformExprRequirement(ExprReq);
15037 TransReq =
getDerived().TransformNestedRequirement(
15041 Transformed.push_back(TransReq);
15046template<
typename Derived>
15059 return getDerived().RebuildTypeRequirement(TransType);
15062template<
typename Derived>
15065 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
15071 TransExprRes =
SemaRef.CheckPlaceholderExpr(TransExprRes.
get());
15074 TransExpr = TransExprRes.
get();
15077 std::optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
15079 if (RetReq.isEmpty())
15080 TransRetReq.emplace();
15081 else if (RetReq.isSubstitutionFailure())
15082 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
15083 else if (RetReq.isTypeConstraint()) {
15085 RetReq.getTypeConstraintTemplateParameterList();
15087 getDerived().TransformTemplateParameterList(OrigTPL);
15090 TransRetReq.emplace(TPL);
15092 assert(TransRetReq &&
"All code paths leading here must set TransRetReq");
15093 if (
Expr *E = dyn_cast<Expr *>(TransExpr))
15096 std::move(*TransRetReq));
15102template<
typename Derived>
15108 return getDerived().RebuildNestedRequirement(
15116 return getDerived().RebuildNestedRequirement(TransConstraint.
get());
15119template<
typename Derived>
15126 if (!getDerived().AlwaysRebuild() &&
15143template<
typename Derived>
15150 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
15151 if (SubExpr.isInvalid())
15154 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
15158 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
15159 SubExpr.get(), E->getEndLoc());
15162template <
typename Derived>
15167 DRE, AddrTaken, RecoveryTSI);
15180template <
typename Derived>
15187template <
typename Derived>
15203 getDerived().TransformDeclarationNameInfo(E->
getNameInfo());
15208 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->
getQualifierLoc() &&
15214 return getDerived().RebuildDependentScopeDeclRefExpr(
15215 QualifierLoc, TemplateKWLoc, NameInfo,
nullptr,
15216 IsAddressOfOperand, RecoveryTSI);
15220 if (getDerived().TransformTemplateArguments(
15224 return getDerived().RebuildDependentScopeDeclRefExpr(
15225 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
15229template<
typename Derived>
15235 if (getDerived().AllowSkippingCXXConstructExpr() &&
15236 ((E->getNumArgs() == 1 ||
15237 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15238 (!getDerived().DropCallArgument(E->getArg(0))) &&
15239 !E->isListInitialization()))
15245 QualType T = getDerived().TransformType(E->getType());
15250 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15254 bool ArgumentChanged =
false;
15259 E->isListInitialization());
15260 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15265 if (!getDerived().AlwaysRebuild() &&
15266 T == E->getType() &&
15268 !ArgumentChanged) {
15275 return getDerived().RebuildCXXConstructExpr(
15276 T, E->getBeginLoc(),
Constructor, E->isElidable(), Args,
15277 E->hadMultipleCandidates(), E->isListInitialization(),
15278 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15279 E->getConstructionKind(), E->getParenOrBraceRange());
15282template<
typename Derived>
15285 QualType T = getDerived().TransformType(E->getType());
15290 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15294 if (!getDerived().AlwaysRebuild() &&
15295 T == E->getType() &&
15303 return getDerived().RebuildCXXInheritedCtorInitExpr(
15305 E->constructsVBase(), E->inheritedFromVBase());
15312template<
typename Derived>
15315 if (
auto *Dtor = E->getTemporary()->getDestructor())
15318 return getDerived().TransformExpr(E->getSubExpr());
15326template<
typename Derived>
15332template<
typename Derived>
15337 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15342 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15346 bool ArgumentChanged =
false;
15348 Args.reserve(E->getNumArgs());
15352 E->isListInitialization());
15353 if (TransformExprs(E->getArgs(), E->getNumArgs(),
true, Args,
15357 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15358 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15359 if (Res.isInvalid())
15361 Args = {Res.get()};
15365 if (!getDerived().AlwaysRebuild() &&
15366 T == E->getTypeSourceInfo() &&
15368 !ArgumentChanged) {
15375 return getDerived().RebuildCXXTemporaryObjectExpr(
15376 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15379template<
typename Derived>
15384 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
15385 struct TransformedInitCapture {
15387 SourceLocation EllipsisLoc;
15389 SmallVector<InitCaptureInfoTy, 4> Expansions;
15392 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15394 CEnd = E->capture_end();
15396 if (!E->isInitCapture(
C))
15399 TransformedInitCapture &
Result = InitCaptures[
C - E->capture_begin()];
15404 ExprResult NewExprInitResult = getDerived().TransformInitializer(
15407 if (NewExprInitResult.isInvalid()) {
15411 Expr *NewExprInit = NewExprInitResult.get();
15414 getSema().buildLambdaInitCaptureInitialization(
15415 C->getLocation(),
C->getCaptureKind() ==
LCK_ByRef,
15416 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15420 Result.Expansions.push_back(
15421 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
15425 if (OldVD->isParameterPack()) {
15434 bool Expand =
true;
15435 bool RetainExpansion =
false;
15437 ExpansionTL.getTypePtr()->getNumExpansions();
15439 if (getDerived().TryExpandParameterPacks(
15440 ExpansionTL.getEllipsisLoc(), OldVD->getInit()->getSourceRange(),
15441 Unexpanded,
true, Expand,
15442 RetainExpansion, NumExpansions))
15444 assert(!RetainExpansion &&
"Should not need to retain expansion after a "
15445 "capture since it cannot be extended");
15447 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15452 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
15453 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
15490 while (DC->isRequiresExprBody())
15492 if ((getSema().isUnevaluatedContext() ||
15493 getSema().isConstantEvaluatedContext()) &&
15494 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15499 E->getIntroducerRange(),
nullptr, DependencyKind,
15500 E->getCaptureDefault());
15501 getDerived().transformedLocalDecl(OldClass, {
Class});
15504 getSema().CreateLambdaCallOperator(E->getIntroducerRange(),
Class);
15507 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15508 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15509 E->hasExplicitParameters(), E->isMutable());
15519 CEnd = E->capture_end();
15523 if (
C->isImplicit())
15527 if (
C->capturesThis()) {
15535 dyn_cast_if_present<CXXRecordDecl>(
15536 getSema().getFunctionLevelDeclContext()),
15538 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15545 if (
C->capturesVLAType())
15549 if (E->isInitCapture(
C)) {
15550 TransformedInitCapture &NewC = InitCaptures[
C - E->capture_begin()];
15555 for (InitCaptureInfoTy &Info : NewC.Expansions) {
15557 QualType InitQualType = Info.second;
15558 if (
Init.isInvalid() || InitQualType.isNull()) {
15562 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
15563 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15564 OldVD->getIdentifier(), OldVD->getInitStyle(),
Init.get(),
15565 getSema().CurContext);
15570 NewVDs.push_back(NewVD);
15571 getSema().addInitCapture(LSI, NewVD,
C->getCaptureKind() ==
LCK_ByRef);
15576 if (NewC.EllipsisLoc.isInvalid())
15577 LSI->ContainsUnexpandedParameterPack |=
15578 Init.get()->containsUnexpandedParameterPack();
15584 getDerived().transformedLocalDecl(OldVD, NewVDs);
15588 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15596 if (
C->isPackExpansion()) {
15598 bool ShouldExpand =
false;
15599 bool RetainExpansion =
false;
15601 if (getDerived().TryExpandParameterPacks(
15602 C->getEllipsisLoc(),
C->getLocation(), Unexpanded,
15603 true, ShouldExpand,
15604 RetainExpansion, NumExpansions)) {
15609 if (ShouldExpand) {
15614 for (
unsigned I = 0; I != *NumExpansions; ++I) {
15616 ValueDecl *CapturedVar = cast_if_present<ValueDecl>(
15617 getDerived().TransformDecl(
C->getLocation(), Pack));
15618 if (!CapturedVar) {
15624 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind);
15632 EllipsisLoc =
C->getEllipsisLoc();
15636 auto *CapturedVar = cast_or_null<ValueDecl>(
15637 getDerived().TransformDecl(
C->getLocation(),
C->getCapturedVar()));
15638 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15645 if (
auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !
C->isPackExpansion())
15646 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15649 getSema().tryCaptureVariable(CapturedVar,
C->getLocation(), Kind,
15652 getSema().finishLambdaExplicitCaptures(LSI);
15656 auto TPL = getDerived().TransformTemplateParameterList(
15657 E->getTemplateParameterList());
15658 LSI->GLTemplateParameterList = TPL;
15660 getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator,
Class,
15662 LSI->ContainsUnexpandedParameterPack |=
15663 TPL->containsUnexpandedParameterPack();
15668 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15670 getDerived().TransformType(NewCallOpTLBuilder, OldCallOpTypeLoc);
15671 if (NewCallOpType.isNull())
15673 LSI->ContainsUnexpandedParameterPack |=
15674 NewCallOpType->containsUnexpandedParameterPack();
15676 NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);
15681 assert(FPTL &&
"Not a FunctionProtoType?");
15684 if (!TRC.ArgPackSubstIndex)
15687 getSema().CompleteLambdaCallOperator(
15688 NewCallOperator, E->getCallOperator()->getLocation(),
15689 E->getCallOperator()->getInnerLocStart(), TRC, NewCallOpTSI,
15690 E->getCallOperator()->getConstexprKind(),
15691 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15692 E->hasExplicitResultType());
15694 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15695 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15701 std::optional<CXXRecordDecl::LambdaNumbering> Numbering;
15702 if (getDerived().ReplacingOriginal()) {
15703 Numbering = OldClass->getLambdaNumbering();
15706 getSema().handleLambdaNumbering(
Class, NewCallOperator, Numbering);
15711 getSema().PushExpressionEvaluationContextForFunction(
15713 E->getCallOperator());
15717 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15718 getSema().pushCodeSynthesisContext(
C);
15722 Invalid ?
StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
15724 getSema().popCodeSynthesisContext();
15727 FuncScopeCleanup.disable();
15729 if (Body.isInvalid()) {
15730 SavedContext.pop();
15731 getSema().ActOnLambdaError(E->getBeginLoc(),
nullptr,
15736 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
15739 SavedContext.pop();
15774 DependencyKind = getDerived().ComputeLambdaDependency(LSI);
15775 Class->setLambdaDependencyKind(DependencyKind);
15777 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15778 Body.get()->getEndLoc(), LSI);
15781template<
typename Derived>
15787template<
typename Derived>
15796 if (!
C->isImplicit())
15800 if (
C->capturesThis()) {
15801 getSema().CheckCXXThisCapture(
C->getLocation(),
C->isExplicit(),
15808 if (
C->capturesVLAType())
15811 assert(
C->capturesVariable() &&
"unexpected kind of lambda capture");
15815 VarDecl *CapturedVar = cast_or_null<VarDecl>(
15821 getSema().tryCaptureVariable(CapturedVar,
C->getLocation());
15827template<
typename Derived>
15836 bool ArgumentChanged =
false;
15848 if (!getDerived().AlwaysRebuild() &&
15854 return getDerived().RebuildCXXUnresolvedConstructExpr(
15858template<
typename Derived>
15867 if (!E->isImplicitAccess()) {
15868 OldBase = E->getBase();
15869 Base = getDerived().TransformExpr(OldBase);
15870 if (
Base.isInvalid())
15875 bool MayBePseudoDestructor =
false;
15877 E->getOperatorLoc(),
15878 E->isArrow()? tok::arrow : tok::period,
15880 MayBePseudoDestructor);
15881 if (
Base.isInvalid())
15884 ObjectType = ObjectTy.get();
15885 BaseType = ((
Expr*)
Base.get())->getType();
15888 BaseType = getDerived().TransformType(E->getBaseType());
15895 = getDerived().TransformFirstQualifierInScope(
15896 E->getFirstQualifierFoundInScope(),
15897 E->getQualifierLoc().getBeginLoc());
15900 if (E->getQualifier()) {
15902 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
15904 FirstQualifierInScope);
15916 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
15917 if (!NameInfo.getName())
15920 if (!E->hasExplicitTemplateArgs()) {
15923 if (!getDerived().AlwaysRebuild() &&
15924 Base.get() == OldBase &&
15925 BaseType == E->getBaseType() &&
15926 QualifierLoc == E->getQualifierLoc() &&
15927 NameInfo.getName() == E->getMember() &&
15928 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
15931 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15934 E->getOperatorLoc(),
15937 FirstQualifierInScope,
15943 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
15944 E->getNumTemplateArgs(),
15948 return getDerived().RebuildCXXDependentScopeMemberExpr(
Base.get(),
15951 E->getOperatorLoc(),
15954 FirstQualifierInScope,
15959template <
typename Derived>
15965 if (!Old->isImplicitAccess()) {
15966 Base = getDerived().TransformExpr(Old->getBase());
15967 if (
Base.isInvalid())
15970 getSema().PerformMemberExprBaseConversion(
Base.get(), Old->isArrow());
15971 if (
Base.isInvalid())
15973 BaseType =
Base.get()->getType();
15975 BaseType = getDerived().TransformType(Old->getBaseType());
15979 if (Old->getQualifierLoc()) {
15981 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
15991 if (TransformOverloadExprDecls(Old,
false, R))
15995 if (Old->getNamingClass()) {
15997 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
16001 R.setNamingClass(NamingClass);
16005 if (Old->hasExplicitTemplateArgs()) {
16006 TransArgs.setLAngleLoc(Old->getLAngleLoc());
16007 TransArgs.setRAngleLoc(Old->getRAngleLoc());
16008 if (getDerived().TransformTemplateArguments(
16009 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
16017 NamedDecl *FirstQualifierInScope =
nullptr;
16019 return getDerived().RebuildUnresolvedMemberExpr(
16020 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
16021 TemplateKWLoc, FirstQualifierInScope, R,
16022 (Old->hasExplicitTemplateArgs() ? &TransArgs :
nullptr));
16025template<
typename Derived>
16030 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
16031 if (SubExpr.isInvalid())
16034 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
16037 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
16040template<
typename Derived>
16043 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
16044 if (Pattern.isInvalid())
16047 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
16050 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
16051 E->getNumExpansions());
16054template <
typename Derived>
16059 if (!Arg.isPackExpansion()) {
16071 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
16072 OrigNumExpansions);
16084 if (!NumExpansions) {
16096template<
typename Derived>
16115 bool ShouldExpand =
false;
16116 bool RetainExpansion =
false;
16117 UnsignedOrNone NumExpansions = std::nullopt;
16118 if (getDerived().TryExpandParameterPacks(
16120 true, ShouldExpand,
16121 RetainExpansion, NumExpansions))
16126 if (ShouldExpand) {
16128 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
16129 ArgStorage = getSema().Context.getPackExpansionType(
16130 getSema().Context.getTypeDeclType(TTPD), std::nullopt);
16131 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
16135 ExprResult DRE = getSema().BuildDeclRefExpr(
16136 VD, VD->getType().getNonLValueExprType(getSema().Context),
16139 if (DRE.isInvalid())
16142 new (getSema().Context)
16146 PackArgs = ArgStorage;
16151 if (!PackArgs.size()) {
16152 auto *Pack = cast_or_null<NamedDecl>(
16156 return getDerived().RebuildSizeOfPackExpr(
16163 getDerived().ComputeSizeOfPackExprWithoutSubstitution(PackArgs);
16175 TemporaryBase Rebase(*
this, E->
getPackLoc(), getBaseEntity());
16178 if (TransformTemplateArguments(PackLocIterator(*
this, PackArgs.begin()),
16179 PackLocIterator(*
this, PackArgs.end()),
16180 TransformedPackArgs,
true))
16187 bool PartialSubstitution =
false;
16188 for (
auto &Loc : TransformedPackArgs.arguments()) {
16189 Args.push_back(Loc.getArgument());
16190 if (Loc.getArgument().isPackExpansion())
16191 PartialSubstitution =
true;
16194 if (PartialSubstitution)
16195 return getDerived().RebuildSizeOfPackExpr(
16197 std::nullopt, Args);
16199 return getDerived().RebuildSizeOfPackExpr(
16201 static_cast<unsigned>(Args.size()),
16205template <
typename Derived>
16208 if (!E->isValueDependent())
16216 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16217 if (IndexExpr.isInvalid())
16222 bool FullySubstituted =
true;
16223 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16224 Expr *Pattern = E->getPackIdExpression();
16226 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16228 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16232 bool ShouldExpand =
true;
16233 bool RetainExpansion =
false;
16235 NumExpansions = std::nullopt;
16236 if (getDerived().TryExpandParameterPacks(
16237 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16238 true, ShouldExpand,
16239 RetainExpansion, NumExpansions))
16241 if (!ShouldExpand) {
16243 ExprResult Pack = getDerived().TransformExpr(Pattern);
16244 if (Pack.isInvalid())
16246 return getDerived().RebuildPackIndexingExpr(
16247 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16250 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16253 if (
Out.isInvalid())
16255 if (
Out.get()->containsUnexpandedParameterPack()) {
16256 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16257 OrigNumExpansions);
16258 if (
Out.isInvalid())
16260 FullySubstituted =
false;
16262 ExpandedExprs.push_back(
Out.get());
16266 if (RetainExpansion) {
16267 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16270 if (
Out.isInvalid())
16273 Out = getDerived().RebuildPackExpansion(
Out.get(), E->getEllipsisLoc(),
16274 OrigNumExpansions);
16275 if (
Out.isInvalid())
16277 FullySubstituted =
false;
16278 ExpandedExprs.push_back(
Out.get());
16280 }
else if (!E->expandsToEmptyPack()) {
16281 if (getDerived().TransformExprs(E->getExpressions().data(),
16282 E->getExpressions().size(),
false,
16287 return getDerived().RebuildPackIndexingExpr(
16288 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16289 IndexExpr.get(), ExpandedExprs, FullySubstituted);
16292template<
typename Derived>
16300template<
typename Derived>
16308template<
typename Derived>
16315template<
typename Derived>
16322template<
typename Derived>
16326 if (
Expr *OldCallee = E->getCallee()) {
16327 ExprResult CalleeResult = getDerived().TransformExpr(OldCallee);
16328 if (CalleeResult.isInvalid())
16333 Expr *Pattern = E->getPattern();
16336 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
16337 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16341 bool Expand =
true;
16342 bool RetainExpansion =
false;
16344 NumExpansions = OrigNumExpansions;
16345 if (getDerived().TryExpandParameterPacks(
16346 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16347 true, Expand, RetainExpansion,
16357 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) :
ExprResult();
16358 if (LHS.isInvalid())
16362 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) :
ExprResult();
16363 if (RHS.isInvalid())
16366 if (!getDerived().AlwaysRebuild() &&
16367 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16370 return getDerived().RebuildCXXFoldExpr(
16371 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16372 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16378 if (NumExpansions && SemaRef.
getLangOpts().BracketDepth < *NumExpansions) {
16379 SemaRef.
Diag(E->getEllipsisLoc(),
16380 clang::diag::err_fold_expression_limit_exceeded)
16381 << *NumExpansions << SemaRef.
getLangOpts().BracketDepth
16382 << E->getSourceRange();
16383 SemaRef.
Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16392 bool LeftFold = E->isLeftFold();
16396 if (!LeftFold && RetainExpansion) {
16397 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16400 if (
Out.isInvalid())
16403 Result = getDerived().RebuildCXXFoldExpr(
16404 Callee, E->getBeginLoc(),
Out.get(), E->getOperator(),
16405 E->getEllipsisLoc(),
Result.get(), E->getEndLoc(), OrigNumExpansions);
16410 bool WarnedOnComparison =
false;
16411 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16413 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16415 if (
Out.isInvalid())
16418 if (
Out.get()->containsUnexpandedParameterPack()) {
16420 Result = getDerived().RebuildCXXFoldExpr(
16421 Callee, E->getBeginLoc(), LeftFold ?
Result.get() :
Out.get(),
16422 E->getOperator(), E->getEllipsisLoc(),
16423 LeftFold ?
Out.get() :
Result.get(), E->getEndLoc(),
16424 OrigNumExpansions);
16425 }
else if (
Result.isUsable()) {
16432 Result = getDerived().RebuildCXXOperatorCallExpr(
16434 E->getEllipsisLoc(),
Callee->getBeginLoc(),
Callee->requiresADL(),
16435 Functions, LHS, RHS);
16437 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16438 E->getOperator(), LHS, RHS,
16440 if (!WarnedOnComparison &&
Result.isUsable()) {
16441 if (
auto *BO = dyn_cast<BinaryOperator>(
Result.get());
16442 BO && BO->isComparisonOp()) {
16443 WarnedOnComparison =
true;
16444 SemaRef.
Diag(BO->getBeginLoc(),
16445 diag::warn_comparison_in_fold_expression)
16446 << BO->getOpcodeStr();
16459 if (LeftFold && RetainExpansion) {
16460 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
16463 if (
Out.isInvalid())
16466 Result = getDerived().RebuildCXXFoldExpr(
16467 Callee, E->getBeginLoc(),
Result.get(), E->getOperator(),
16468 E->getEllipsisLoc(),
Out.get(), E->getEndLoc(), OrigNumExpansions);
16474 PE->setIsProducedByFoldExpansion();
16479 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16484template <
typename Derived>
16490 QualType T = getDerived().TransformType(E->getType());
16492 bool ArgChanged =
false;
16494 if (getDerived().TransformExprs(InitExprs.data(), InitExprs.size(),
true,
16495 TransformedInits, &ArgChanged))
16498 if (!getDerived().AlwaysRebuild() && !ArgChanged &&
T == E->getType())
16501 return getDerived().RebuildCXXParenListInitExpr(
16502 TransformedInits,
T, E->getUserSpecifiedInitExprs().size(),
16503 E->getInitLoc(), E->getBeginLoc(), E->getEndLoc());
16506template<
typename Derived>
16513template<
typename Derived>
16519template<
typename Derived>
16525template<
typename Derived>
16528 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16529 if (SubExpr.isInvalid())
16532 if (!getDerived().AlwaysRebuild() &&
16533 SubExpr.get() == E->getSubExpr())
16536 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16539template<
typename Derived>
16544 bool ArgChanged =
false;
16545 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16546 false, Elements, &ArgChanged))
16549 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16552 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16557template<
typename Derived>
16563 bool ArgChanged =
false;
16564 for (
unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16567 if (OrigElement.isPackExpansion()) {
16570 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
16571 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
16572 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
16576 bool Expand =
true;
16577 bool RetainExpansion =
false;
16580 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16581 OrigElement.Value->getEndLoc());
16582 if (getDerived().TryExpandParameterPacks(
16583 OrigElement.EllipsisLoc, PatternRange, Unexpanded,
16584 true, Expand, RetainExpansion,
16593 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16594 if (Key.isInvalid())
16597 if (Key.get() != OrigElement.Key)
16601 if (
Value.isInvalid())
16608 Key.get(),
Value.get(), OrigElement.EllipsisLoc, NumExpansions
16610 Elements.push_back(Expansion);
16620 for (
unsigned I = 0; I != *NumExpansions; ++I) {
16622 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16623 if (Key.isInvalid())
16627 if (
Value.isInvalid())
16637 if (Key.get()->containsUnexpandedParameterPack() ||
16638 Value.get()->containsUnexpandedParameterPack())
16639 Element.EllipsisLoc = OrigElement.EllipsisLoc;
16641 Elements.push_back(Element);
16651 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
16652 if (Key.isInvalid())
16655 if (Key.get() != OrigElement.Key)
16660 = getDerived().TransformExpr(OrigElement.Value);
16661 if (
Value.isInvalid())
16669 Elements.push_back(Element);
16672 if (!getDerived().AlwaysRebuild() && !ArgChanged)
16675 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16679template<
typename Derived>
16683 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16684 if (!EncodedTypeInfo)
16687 if (!getDerived().AlwaysRebuild() &&
16688 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16691 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16693 E->getRParenLoc());
16696template<
typename Derived>
16706template<
typename Derived>
16710 = getDerived().TransformType(E->getTypeInfoAsWritten());
16718 if (!getDerived().AlwaysRebuild() &&
16719 TSInfo == E->getTypeInfoAsWritten() &&
16720 Result.get() == E->getSubExpr())
16724 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16728template <
typename Derived>
16734template<
typename Derived>
16738 bool ArgChanged =
false;
16740 Args.reserve(E->getNumArgs());
16741 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(),
false, Args,
16748 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16749 if (!ReceiverTypeInfo)
16753 if (!getDerived().AlwaysRebuild() &&
16754 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16759 E->getSelectorLocs(SelLocs);
16760 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
16763 E->getMethodDecl(),
16770 if (!E->getMethodDecl())
16775 E->getSelectorLocs(SelLocs);
16776 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16779 E->getReceiverType(),
16780 E->getMethodDecl(),
16788 "Only class and instance messages may be instantiated");
16790 = getDerived().TransformExpr(E->getInstanceReceiver());
16791 if (Receiver.isInvalid())
16795 if (!getDerived().AlwaysRebuild() &&
16796 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
16801 E->getSelectorLocs(SelLocs);
16802 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
16805 E->getMethodDecl(),
16811template<
typename Derived>
16817template<
typename Derived>
16823template<
typename Derived>
16828 if (
Base.isInvalid())
16834 if (!getDerived().AlwaysRebuild() &&
16835 Base.get() == E->getBase())
16838 return getDerived().RebuildObjCIvarRefExpr(
Base.get(), E->getDecl(),
16840 E->isArrow(), E->isFreeIvar());
16843template<
typename Derived>
16848 if (!E->isObjectReceiver())
16853 if (
Base.isInvalid())
16859 if (!getDerived().AlwaysRebuild() &&
16860 Base.get() == E->getBase())
16863 if (E->isExplicitProperty())
16864 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16865 E->getExplicitProperty(),
16868 return getDerived().RebuildObjCPropertyRefExpr(
Base.get(),
16870 E->getImplicitPropertyGetter(),
16871 E->getImplicitPropertySetter(),
16875template<
typename Derived>
16880 if (
Base.isInvalid())
16884 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
16885 if (Key.isInvalid())
16889 if (!getDerived().AlwaysRebuild() &&
16890 Key.get() == E->getKeyExpr() &&
Base.get() == E->getBaseExpr())
16893 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
16894 Base.get(), Key.get(),
16895 E->getAtIndexMethodDecl(),
16896 E->setAtIndexMethodDecl());
16899template<
typename Derived>
16904 if (
Base.isInvalid())
16908 if (!getDerived().AlwaysRebuild() &&
16909 Base.get() == E->getBase())
16912 return getDerived().RebuildObjCIsaExpr(
Base.get(), E->getIsaMemberLoc(),
16917template<
typename Derived>
16920 bool ArgumentChanged =
false;
16922 SubExprs.reserve(E->getNumSubExprs());
16923 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
16924 SubExprs, &ArgumentChanged))
16927 if (!getDerived().AlwaysRebuild() &&
16931 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
16933 E->getRParenLoc());
16936template<
typename Derived>
16939 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
16940 if (SrcExpr.isInvalid())
16947 if (!getDerived().AlwaysRebuild() &&
16948 Type == E->getTypeSourceInfo() &&
16949 SrcExpr.get() == E->getSrcExpr())
16952 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
16953 SrcExpr.get(),
Type,
16954 E->getRParenLoc());
16957template<
typename Derived>
16960 BlockDecl *oldBlock = E->getBlockDecl();
16966 blockScope->TheDecl->setBlockMissingReturnType(
16967 oldBlock->blockMissingReturnType());
16976 if (getDerived().TransformFunctionTypeParams(
16977 E->getCaretLocation(), oldBlock->parameters(),
nullptr,
16978 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, ¶ms,
16980 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
16985 getDerived().TransformType(exprFunctionType->getReturnType());
16987 auto epi = exprFunctionType->getExtProtoInfo();
16988 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
16991 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
16995 if (!params.empty())
16996 blockScope->TheDecl->setParams(params);
16998 if (!oldBlock->blockMissingReturnType()) {
16999 blockScope->HasImplicitReturnType =
false;
17000 blockScope->ReturnType = exprResultType;
17004 StmtResult body = getDerived().TransformStmt(E->getBody());
17005 if (body.isInvalid()) {
17006 getSema().ActOnBlockError(E->getCaretLocation(),
nullptr);
17014 for (
const auto &I : oldBlock->captures()) {
17015 VarDecl *oldCapture = I.getVariable();
17018 if (oldCapture->isParameterPack())
17022 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
17024 assert(blockScope->CaptureMap.count(newCapture));
17030 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
17031 "this pointer isn't captured in the old block");
17039template<
typename Derived>
17042 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
17043 if (SrcExpr.isInvalid())
17046 QualType Type = getDerived().TransformType(E->getType());
17049 E->getRParenLoc());
17052template<
typename Derived>
17055 bool ArgumentChanged =
false;
17057 SubExprs.reserve(E->getNumSubExprs());
17058 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(),
false,
17059 SubExprs, &ArgumentChanged))
17062 if (!getDerived().AlwaysRebuild() &&
17066 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
17067 E->getOp(), E->getRParenLoc());
17074template<
typename Derived>
17077 return SemaRef.BuildPointerType(PointeeType,
Star,
17081template<
typename Derived>
17084 return SemaRef.BuildBlockPointerType(PointeeType,
Star,
17088template<
typename Derived>
17091 bool WrittenAsLValue,
17093 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
17097template <
typename Derived>
17101 return SemaRef.BuildMemberPointerType(PointeeType, SS, Cls, Sigil,
17105template<
typename Derived>
17112 return SemaRef.ObjC().BuildObjCTypeParamType(
17113 Decl, ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17117template<
typename Derived>
17128 return SemaRef.ObjC().BuildObjCObjectType(
17129 BaseType, Loc, TypeArgsLAngleLoc, TypeArgs, TypeArgsRAngleLoc,
17130 ProtocolLAngleLoc, Protocols, ProtocolLocs, ProtocolRAngleLoc,
17135template<
typename Derived>
17139 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
17142template <
typename Derived>
17145 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17146 if (SizeExpr || !Size)
17147 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
17148 IndexTypeQuals, BracketsRange,
17152 SemaRef.Context.UnsignedCharTy,
SemaRef.Context.UnsignedShortTy,
17154 SemaRef.Context.UnsignedLongLongTy,
SemaRef.Context.UnsignedInt128Ty
17157 for (
const auto &
T : Types)
17158 if (Size->getBitWidth() ==
SemaRef.Context.getIntWidth(
T)) {
17168 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
17169 IndexTypeQuals, BracketsRange,
17173template <
typename Derived>
17176 Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17177 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
17178 IndexTypeQuals, BracketsRange);
17181template <
typename Derived>
17185 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
nullptr,
17186 IndexTypeQuals, BracketsRange);
17189template <
typename Derived>
17192 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17193 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17195 IndexTypeQuals, BracketsRange);
17198template <
typename Derived>
17201 unsigned IndexTypeQuals,
SourceRange BracketsRange) {
17202 return getDerived().RebuildArrayType(ElementType, SizeMod,
nullptr,
17204 IndexTypeQuals, BracketsRange);
17207template <
typename Derived>
17210 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
17214template <
typename Derived>
17216 unsigned NumElements,
17219 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
17222template <
typename Derived>
17226 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
17229template<
typename Derived>
17231 unsigned NumElements,
17233 llvm::APInt numElements(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17234 NumElements,
true);
17238 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
17241template<
typename Derived>
17246 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
17249template <
typename Derived>
17251 QualType ElementType,
unsigned NumRows,
unsigned NumColumns) {
17252 return SemaRef.Context.getConstantMatrixType(ElementType, NumRows,
17256template <
typename Derived>
17260 return SemaRef.BuildMatrixType(ElementType, RowExpr, ColumnExpr,
17264template <
typename Derived>
17268 return SemaRef.BuildFunctionType(
T, ParamTypes,
17274template<
typename Derived>
17276 return SemaRef.Context.getFunctionNoProtoType(
T);
17279template <
typename Derived>
17283 assert(D &&
"no decl found");
17287 if (
auto *UPD = dyn_cast<UsingPackDecl>(D)) {
17291 if (UPD->expansions().empty()) {
17292 getSema().Diag(NameLoc, diag::err_using_pack_expansion_empty)
17293 << UPD->isCXXClassMember() << UPD;
17302 for (
auto *E : UPD->expansions()) {
17309 else if (
T.isNull())
17312 assert(
getSema().Context.hasSameType(ThisT,
T) &&
17313 "mismatched resolved types in using pack expansion");
17315 return T.isNull() ? FallbackT :
T;
17317 if (
auto *Using = dyn_cast<UsingDecl>(D)) {
17318 assert(Using->hasTypename() &&
17319 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17322 assert(++Using->shadow_begin() == Using->shadow_end());
17327 return SemaRef.Context.getUsingType(
Keyword, Qualifier, Shadow);
17330 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17331 return SemaRef.Context.getUnresolvedUsingType(
17335template <
typename Derived>
17338 return SemaRef.BuildTypeofExprType(E, Kind);
17341template<
typename Derived>
17344 return SemaRef.Context.getTypeOfType(Underlying, Kind);
17347template <
typename Derived>
17349 return SemaRef.BuildDecltypeType(E);
17352template <
typename Derived>
17357 return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
17358 FullySubstituted, Expansions);
17361template<
typename Derived>
17363 UnaryTransformType::UTTKind UKind,
17365 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
17368template <
typename Derived>
17372 return SemaRef.CheckTemplateIdType(
17377template<
typename Derived>
17380 return SemaRef.BuildAtomicType(ValueType, KWLoc);
17383template<
typename Derived>
17387 return isReadPipe ?
SemaRef.BuildReadPipeType(ValueType, KWLoc)
17388 :
SemaRef.BuildWritePipeType(ValueType, KWLoc);
17391template <
typename Derived>
17395 llvm::APInt NumBitsAP(
SemaRef.Context.getIntWidth(
SemaRef.Context.IntTy),
17399 return SemaRef.BuildBitIntType(IsUnsigned, Bits, Loc);
17402template <
typename Derived>
17405 return SemaRef.BuildBitIntType(IsUnsigned, NumBitsExpr, Loc);
17408template <
typename Derived>
17416template <
typename Derived>
17423 getSema().ActOnTemplateName(
nullptr, SS, TemplateKWLoc,
17426 AllowInjectedClassName);
17430template<
typename Derived>
17437 bool AllowInjectedClassName) {
17440 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
17445 false,
Template, AllowInjectedClassName);
17449template <
typename Derived>
17454 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
17459 return SemaRef.PseudoObject().checkAssignment(
nullptr, OpLoc,
17460 Opc,
First, Second);
17475 if (Op == OO_Subscript) {
17476 if (!
First->getType()->isOverloadableType() &&
17478 return getSema().CreateBuiltinArraySubscriptExpr(
First, CalleeLoc, Second,
17480 }
else if (Op == OO_Arrow) {
17483 if (
First->getType()->isDependentType())
17486 return SemaRef.BuildOverloadedArrowExpr(
nullptr,
First, OpLoc);
17487 }
else if (Second ==
nullptr || isPostIncDec) {
17488 if (!
First->getType()->isOverloadableType() ||
17489 (Op == OO_Amp &&
getSema().isQualifiedMemberAccess(
First))) {
17496 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc,
First);
17500 !
First->getType()->isOverloadableType() &&
17506 =
SemaRef.CreateBuiltinBinOp(OpLoc, Opc,
First, Second);
17515 if (!Second || isPostIncDec) {
17518 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions,
First,
17525 First, Second, RequiresADL);
17532template<
typename Derived>
17542 QualType CanonicalBaseType =
Base->getType().getCanonicalType();
17548 ->getAsCanonical<RecordType>())) {
17550 return SemaRef.BuildPseudoDestructorExpr(
17551 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
17552 CCLoc, TildeLoc, Destroyed);
17564 if (!
isa<TagType>(ScopeType->getType().getCanonicalType())) {
17565 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17566 diag::err_expected_class_or_namespace)
17567 << ScopeType->getType() <<
getSema().getLangOpts().CPlusPlus;
17571 SS.
Make(
SemaRef.Context, ScopeType->getTypeLoc(), CCLoc);
17575 return getSema().BuildMemberReferenceExpr(
17576 Base,
Base->getType(), OperatorLoc, isArrow, SS, TemplateKWLoc,
17582template<
typename Derived>
17590 for (
unsigned I = 0; I < NumParams; ++I) {
17591 if (I != ContextParamPos) {
17597 Params.push_back(std::make_pair(StringRef(), QualType()));
17600 getSema().ActOnCapturedRegionStart(Loc,
nullptr,
17608 if (Body.isInvalid()) {
17609 getSema().ActOnCapturedRegionError();
17613 return getSema().ActOnCapturedRegionEnd(Body.get());
17616template <
typename Derived>
17622 llvm_unreachable(
"SYCL kernel call statement cannot appear in dependent "
17626template <
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.
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 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)
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.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Wrapper for source info for array parameter types.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayTypeTrait getTrait() const
Expr * getDimensionExpression() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
attr::Kind getKind() const
Represents an attribute applied to a statement.
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
Type source information for an attributed type.
void setAttr(const Attr *A)
Type source information for an btf_tag attributed type.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isAssignmentOp(Opcode Opc)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setIsVariadic(bool value)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Wrapper for source info for block pointers.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
SourceRange getParenOrBraceRange() const
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
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
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
Stmt * getStmtExprResult()
SourceLocation getRBracLoc() const
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const TypeClass * getTypePtr() const
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Wrapper for source info for pointers decayed from arrays and functions.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
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)
void setAttrOperandParensRange(SourceRange range)
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
void setElaboratedKeywordLoc(SourceLocation Loc)
A qualified reference to a name whose declaration cannot yet be resolved.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Represents an array type in C++ whose size is a value-dependent expression.
void setNameLoc(SourceLocation Loc)
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void setNameLoc(SourceLocation Loc)
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
Designation - Represent a full designation, which is a sequence of designators.
static Designator CreateArrayRangeDesignator(Expr *Start, Expr *End, SourceLocation LBracketLoc, SourceLocation EllipsisLoc)
Creates a GNU array-range designator.
static Designator CreateArrayDesignator(Expr *Index, SourceLocation LBracketLoc)
Creates an array designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
bool hasErrorOccurred() const
DoStmt - This represents a 'do/while' stmt.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Expr * getCondition() const
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
Represents a reference to emded data.
RAII object that enters a new expression evaluation context.
Wrapper for source info for enum types.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
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.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Represents a C array with an unspecified size.
IndirectGotoStmt - This represents an indirect goto.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
InitListExpr * getSyntacticForm() const
Wrapper for source info for injected class names of class templates.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
const LambdaCapture * capture_iterator
An iterator that walks over the captures of the lambda, both implicit and explicit.
Represents the results of name lookup.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
DeclarationName getLookupName() const
Gets the name to look up.
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.
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
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 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
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 represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
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 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This represents clauses with a list of expressions that are mappable.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' 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 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' 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)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getNameLoc() const
Gets the location of the name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
TemplateArgumentLoc const * getTemplateArgs() const
llvm::iterator_range< decls_iterator > decls() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Represents a C++11 pack expansion that produces a sequence of expressions.
void setEllipsisLoc(SourceLocation Loc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
void setEllipsisLoc(SourceLocation Loc)
ParenExpr - This represents a parenthesized expression, e.g.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getFunctionScopeDepth() const
void setKWLoc(SourceLocation Loc)
Pointer-authentication qualifiers.
void setSigilLoc(SourceLocation Loc)
TypeLoc getPointeeLoc() const
SourceLocation getSigilLoc() const
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
Stores the type being destroyed by a pseudo-destructor expression.
const IdentifierInfo * getIdentifier() const
SourceLocation getLocation() const
TypeSourceInfo * getTypeSourceInfo() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
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, bool DeferHint=false)
Emit a diagnostic.
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 * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' 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 * 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 * 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 * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' 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 * 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 * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' 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 * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
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 * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
A RAII object to enter scope of a compound statement.
A helper class for building up ExtParameterInfos.
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult ActOnCXXParenListInitExpr(ArrayRef< Expr * > Args, QualType T, unsigned NumUserSpecifiedExprs, SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
ExprResult 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'.
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)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
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 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)
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 *.
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 BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
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.
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
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 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.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
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)
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 BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc)
Complete a lambda-expression having processed and attached the lambda body.
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnGCCAsmStmtString(Expr *Stm, bool ForAsmLabel)
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
OpaquePtr< TemplateName > TemplateTy
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
static ConditionResult ConditionError()
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaPseudoObject & PseudoObject()
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, UnsignedOrNone NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, UnsignedOrNone Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
static bool MayBeDependent(SourceLocIdentKind Kind)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
A structure for storing an already-substituted template template parameter pack.
A structure for storing the information associated with a substituted template template parameter.
Wrapper for substituted template type parameters.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
TemplateArgumentLoc operator*() const
TemplateArgumentLocContainerIterator operator++(int)
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator()
TemplateArgumentLoc value_type
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
TemplateArgumentLocContainerIterator & operator++()
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
pointer operator->() const
const TemplateArgumentLoc * operator->() const
pointer(TemplateArgumentLoc Arg)
Iterator adaptor that invents template argument location information for each of the template argumen...
TemplateArgumentLocInventIterator & operator++()
pointer operator->() const
std::iterator_traits< InputIterator >::difference_type difference_type
reference operator*() const
TemplateArgumentLocInventIterator operator++(int)
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
std::input_iterator_tag iterator_category
TemplateArgumentLoc reference
TemplateArgumentLoc value_type
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument * pack_iterator
Iterator that traverses the elements of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NestedNameSpecifier getQualifier() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
The top declaration context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setTypeofLoc(SourceLocation Loc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
Represents a C++ unqualified-id that has been parsed.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A set of unresolved declarations.
void append(iterator I, iterator E)
A set of unresolved declarations.
Wrapper for source info for unresolved typename using decls.
Represents the dependent type named by a dependently-scoped typename using declaration,...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Wrapper for source info for types used via transparent aliases.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a C array with a specified size that is not an integer-constant-expression.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
SourceLocation getNoexceptLoc() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
TypeSourceInfo * getType() const
Retains information about a block that is currently being parsed.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const AstTypeMatcher< FunctionType > functionType
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
ArrayTypeTrait
Names for the array type traits.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ Found
Name lookup found a single declaration that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl *, const TemplateSpecializationType *, const SubstBuiltinTemplatePackType * >, SourceLocation > UnexpandedParameterPack
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
TypeOfKind
The kind of 'typeof' expression we're after.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
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.
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)
@ 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.
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
@ Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
@ Exists
The symbol exists.
@ Error
An error occurred.
@ DoesNotExist
The symbol does not exist.
MutableArrayRef< Stmt * > MultiStmtArg
OpenMPNumThreadsClauseModifier
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ActionResult< Expr * > ExprResult
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
ActionResult< Stmt * > StmtResult
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
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)
UnsignedOrNone ArgPackSubstIndex
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
getNamedTypeInfo - Returns the source type info associated to the name.
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].
Data for list of allocators.
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.
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